| 1 | /* |
| 2 | * Copyright (C) 1999-2000 Harri Porten ([email protected]) |
| 3 | * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 4 | * |
| 5 | * This library is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Library General Public |
| 7 | * License as published by the Free Software Foundation; either |
| 8 | * version 2 of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This library is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * Library General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU Library General Public License |
| 16 | * along with this library; see the file COPYING.LIB. If not, write to |
| 17 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 | * Boston, MA 02110-1301, USA. |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | #include "config.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/config.h`/ |
| 23 | #include "Operations.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Operations.h`/ |
| 24 | |
| 25 | #include "Error.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Error.h`/ |
| 26 | #include "JSObject.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSObject.h`/ |
| 27 | #include "JSString.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSString.h`/ |
| 28 | #include <math.h> |
| 29 | #include <stdio.h> |
| 30 | #include <wtf/MathExtras.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/MathExtras.h`/ |
| 31 | |
| 32 | namespace JSCcxx . . $ `<built-in>:463:9`! { |
| 33 | |
| 34 | bool JSValuecxx . . $ QTJSC/JSValue#::equalSlowCasecxx . . $ QTJSC/JSValue#equalSlowCase(658e1865c47113e6).(ExecStatecxx . . $ QTJSC/ExecState#* exec, JSValuecxx . . $ QTJSC/JSValue# v1, JSValuecxx . . $ QTJSC/JSValue# v2) |
| 35 | { |
| 36 | return equalSlowCaseInlinecxx . . $ QTJSC/JSValue#equalSlowCaseInline(658e1865c47113e6).(exec, v1, v2); |
| 37 | } |
| 38 | |
| 39 | bool JSValuecxx . . $ QTJSC/JSValue#::strictEqualSlowCasecxx . . $ QTJSC/JSValue#strictEqualSlowCase(658e1865c47113e6).(ExecStatecxx . . $ QTJSC/ExecState#* exec, JSValuecxx . . $ QTJSC/JSValue# v1, JSValuecxx . . $ QTJSC/JSValue# v2) |
| 40 | { |
| 41 | return strictEqualSlowCaseInlinecxx . . $ QTJSC/JSValue#strictEqualSlowCaseInline(658e1865c47113e6).(exec, v1, v2); |
| 42 | } |
| 43 | |
| 44 | NEVER_INLINEcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/AlwaysInline.h:35:9`! JSValuecxx . . $ QTJSC/JSValue# throwOutOfMemoryErrorcxx . . $ QTJSC/throwOutOfMemoryError(3fbe51058e39576a).(ExecStatecxx . . $ QTJSC/ExecState#* exec) |
| 45 | { |
| 46 | JSObjectcxx . . $ QTJSC/JSObject#* error = Errorcxx . . $ QTJSC/Error#::createcxx . . $ QTJSC/Error#create(c8108d54e75f502b).(exec, GeneralErrorcxx . . $ QTJSC/GeneralError., "Out of memory"); |
| 47 | exec->setExceptioncxx . . $ QTJSC/ExecState#setException(5c2ac18db087b3e6).(error); |
| 48 | return error; |
| 49 | } |
| 50 | |
| 51 | NEVER_INLINEcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/AlwaysInline.h:35:9`! JSValuecxx . . $ QTJSC/JSValue# jsAddSlowCasecxx . . $ QTJSC/jsAddSlowCase(b8fa476a5be1c821).(CallFramecxx . . $ QTJSC/CallFrame#* callFrame, JSValuecxx . . $ QTJSC/JSValue# v1, JSValuecxx . . $ QTJSC/JSValue# v2) |
| 52 | { |
| 53 | // exception for the Date exception in defaultValue() |
| 54 | JSValuecxx . . $ QTJSC/JSValue# p1 = v1.toPrimitivecxx . . $ QTJSC/JSValue#toPrimitive(9c1c7f5535dadf1e).(callFrame); |
| 55 | JSValuecxx . . $ QTJSC/JSValue# p2 = v2.toPrimitivecxx . . $ QTJSC/JSValue#toPrimitive(9c1c7f5535dadf1e).(callFrame); |
| 56 | |
| 57 | if (p1.isStringcxx . . $ QTJSC/JSValue#isString(50ce9a9e25b4a850).()) { |
| 58 | return p2.isStringcxx . . $ QTJSC/JSValue#isString(50ce9a9e25b4a850).() |
| 59 | ? jsStringcxx . . $ QTJSC/jsString(1d20702c49229e34).(callFrame, asStringcxx . . $ QTJSC/asString(3a349c2233e4a703).(p1), asStringcxx . . $ QTJSC/asString(3a349c2233e4a703).(p2)) |
| 60 | : jsStringcxx . . $ QTJSC/jsString(d78052f683f48fad).(callFrame, asStringcxx . . $ QTJSC/asString(3a349c2233e4a703).(p1), p2.toStringcxx . . $ QTJSC/JSValue#toString(9c94f5abb1995042).(callFrame)); |
| 61 | } |
| 62 | if (p2.isStringcxx . . $ QTJSC/JSValue#isString(50ce9a9e25b4a850).()) |
| 63 | return jsStringcxx . . $ QTJSC/jsString(7bff5709425c3996).(callFrame, p1.toStringcxx . . $ QTJSC/JSValue#toString(9c94f5abb1995042).(callFrame), asStringcxx . . $ QTJSC/asString(3a349c2233e4a703).(p2)); |
| 64 | |
| 65 | return jsNumbercxx . . $ QTJSC/jsNumber(88e66938454912cb).(callFrame, p1.toNumbercxx . . $ QTJSC/JSValue#toNumber(1fd034e372fd1279).(callFrame) + p2.toNumbercxx . . $ QTJSC/JSValue#toNumber(1fd034e372fd1279).(callFrame)); |
| 66 | } |
| 67 | |
| 68 | JSValuecxx . . $ QTJSC/JSValue# jsTypeStringForValuecxx . . $ QTJSC/jsTypeStringForValue(3f1194ef29991aa4).(CallFramecxx . . $ QTJSC/CallFrame#* callFrame, JSValuecxx . . $ QTJSC/JSValue# v) |
| 69 | { |
| 70 | if (v.isUndefinedcxx . . $ QTJSC/JSValue#isUndefined(50ce9a9e25b4a850).()) |
| 71 | return jsNontrivialStringcxx . . $ QTJSC/jsNontrivialString(e2c2a5e45ecf2c5d).(callFrame, "undefined"); |
| 72 | if (v.isBooleancxx . . $ QTJSC/JSValue#isBoolean(50ce9a9e25b4a850).()) |
| 73 | return jsNontrivialStringcxx . . $ QTJSC/jsNontrivialString(e2c2a5e45ecf2c5d).(callFrame, "boolean"); |
| 74 | if (v.isNumbercxx . . $ QTJSC/JSValue#isNumber(50ce9a9e25b4a850).()) |
| 75 | return jsNontrivialStringcxx . . $ QTJSC/jsNontrivialString(e2c2a5e45ecf2c5d).(callFrame, "number"); |
| 76 | if (v.isStringcxx . . $ QTJSC/JSValue#isString(50ce9a9e25b4a850).()) |
| 77 | return jsNontrivialStringcxx . . $ QTJSC/jsNontrivialString(e2c2a5e45ecf2c5d).(callFrame, "string"); |
| 78 | if (v.isObjectcxx . . $ QTJSC/JSValue#isObject(50ce9a9e25b4a850).()) { |
| 79 | // Return "undefined" for objects that should be treated |
| 80 | // as null when doing comparisons. |
| 81 | if (asObjectcxx . . $ QTJSC/asObject(107e81180f8dd622).(v)->structurecxx . . $ QTJSC/JSCell#structure(a25848528202c7a).()->typeInfo().masqueradesAsUndefined()) |
| 82 | return jsNontrivialStringcxx . . $ QTJSC/jsNontrivialString(e2c2a5e45ecf2c5d).(callFrame, "undefined"); |
| 83 | CallDatacxx . . $ QTJSC/CallData# callData; |
| 84 | if (asObjectcxx . . $ QTJSC/asObject(107e81180f8dd622).(v)->getCallDatacxx . . $ QTJSC/JSCell#getCallData(9482040cf952d29d).(callData) !=cxx . . $ QTJSC/`operator!=`(8208a731c2dadbc2). CallTypeNonecxx . . $ QTJSC/CallTypeNone.) |
| 85 | return jsNontrivialStringcxx . . $ QTJSC/jsNontrivialString(e2c2a5e45ecf2c5d).(callFrame, "function"); |
| 86 | } |
| 87 | return jsNontrivialStringcxx . . $ QTJSC/jsNontrivialString(e2c2a5e45ecf2c5d).(callFrame, "object"); |
| 88 | } |
| 89 | |
| 90 | bool jsIsObjectTypecxx . . $ QTJSC/jsIsObjectType(a6f765323ba532ee).(JSValuecxx . . $ QTJSC/JSValue# v) |
| 91 | { |
| 92 | if (!v.isCellcxx . . $ QTJSC/JSValue#isCell(50ce9a9e25b4a850).()) |
| 93 | return v.isNullcxx . . $ QTJSC/JSValue#isNull(50ce9a9e25b4a850).(); |
| 94 | |
| 95 | JSTypecxx . . $ QTJSC/JSType# type = asCellcxx . . $ QTJSC/asCell(31485abf284d9c5).(v)->structurecxx . . $ QTJSC/JSCell#structure(a25848528202c7a).()->typeInfocxx . . $ QTJSC/Structure#typeInfo(2e356ef879c79f0c).().typecxx . . $ QTJSC/TypeInfo#type(81c355aa0b104834).(); |
| 96 | if (type == NumberTypecxx . . $ QTJSC/NumberType. || type == StringTypecxx . . $ QTJSC/StringType.) |
| 97 | return false; |
| 98 | if (type == ObjectTypecxx . . $ QTJSC/ObjectType.) { |
| 99 | if (asObjectcxx . . $ QTJSC/asObject(107e81180f8dd622).(v)->structurecxx . . $ QTJSC/JSCell#structure(a25848528202c7a).()->typeInfo().masqueradesAsUndefined()) |
| 100 | return false; |
| 101 | CallDatacxx . . $ QTJSC/CallData# callData; |
| 102 | if (asObjectcxx . . $ QTJSC/asObject(107e81180f8dd622).(v)->getCallDatacxx . . $ QTJSC/JSCell#getCallData(9482040cf952d29d).(callData) !=cxx . . $ QTJSC/`operator!=`(8208a731c2dadbc2). CallTypeNonecxx . . $ QTJSC/CallTypeNone.) |
| 103 | return false; |
| 104 | } |
| 105 | return true; |
| 106 | } |
| 107 | |
| 108 | bool jsIsFunctionTypecxx . . $ QTJSC/jsIsFunctionType(a6f765323ba532ee).(JSValuecxx . . $ QTJSC/JSValue# v) |
| 109 | { |
| 110 | if (v.isObjectcxx . . $ QTJSC/JSValue#isObject(50ce9a9e25b4a850).()) { |
| 111 | CallDatacxx . . $ QTJSC/CallData# callData; |
| 112 | if (asObjectcxx . . $ QTJSC/asObject(107e81180f8dd622).(v)->getCallDatacxx . . $ QTJSC/JSCell#getCallData(9482040cf952d29d).(callData) !=cxx . . $ QTJSC/`operator!=`(8208a731c2dadbc2). CallTypeNonecxx . . $ QTJSC/CallTypeNone.) |
| 113 | return true; |
| 114 | } |
| 115 | return false; |
| 116 | } |
| 117 | |
| 118 | } // namespace JSC |