diff options
Diffstat (limited to 'src/3rdparty/javascriptcore/JavaScriptCore/runtime/Operations.h')
-rw-r--r-- | src/3rdparty/javascriptcore/JavaScriptCore/runtime/Operations.h | 46 |
1 files changed, 19 insertions, 27 deletions
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Operations.h b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Operations.h index a0caff48c6..21120f5106 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Operations.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Operations.h @@ -38,7 +38,7 @@ namespace JSC { // ECMA 11.9.3 inline bool JSValue::equal(ExecState* exec, JSValue v1, JSValue v2) { - if (JSImmediate::areBothImmediateIntegerNumbers(v1, v2)) + if (v1.isInt32() && v2.isInt32()) return v1 == v2; return equalSlowCase(exec, v1, v2); @@ -46,8 +46,6 @@ namespace JSC { ALWAYS_INLINE bool JSValue::equalSlowCaseInline(ExecState* exec, JSValue v1, JSValue v2) { - ASSERT(!JSImmediate::areBothImmediateIntegerNumbers(v1, v2)); - do { if (v1.isNumber() && v2.isNumber()) return v1.uncheckedGetNumber() == v2.uncheckedGetNumber(); @@ -60,29 +58,30 @@ namespace JSC { if (v1.isUndefinedOrNull()) { if (v2.isUndefinedOrNull()) return true; - if (JSImmediate::isImmediate(v2)) + if (!v2.isCell()) return false; return v2.asCell()->structure()->typeInfo().masqueradesAsUndefined(); } if (v2.isUndefinedOrNull()) { - if (JSImmediate::isImmediate(v1)) + if (!v1.isCell()) return false; return v1.asCell()->structure()->typeInfo().masqueradesAsUndefined(); } if (v1.isObject()) { - if (v2.isObject()) + if (v2.isObject()) { return v1 == v2 #ifdef QT_BUILD_SCRIPT_LIB || asObject(v1)->compareToObject(exec, asObject(v2)) #endif ; + } JSValue p1 = v1.toPrimitive(exec); if (exec->hadException()) return false; v1 = p1; - if (JSImmediate::areBothImmediateIntegerNumbers(v1, v2)) + if (v1.isInt32() && v2.isInt32()) return v1 == v2; continue; } @@ -92,7 +91,7 @@ namespace JSC { if (exec->hadException()) return false; v2 = p2; - if (JSImmediate::areBothImmediateIntegerNumbers(v1, v2)) + if (v1.isInt32() && v2.isInt32()) return v1 == v2; continue; } @@ -118,7 +117,7 @@ namespace JSC { // ECMA 11.9.3 ALWAYS_INLINE bool JSValue::strictEqualSlowCaseInline(JSValue v1, JSValue v2) { - ASSERT(!JSImmediate::isEitherImmediate(v1, v2)); + ASSERT(v1.isCell() && v2.isCell()); if (v1.asCell()->isString() && v2.asCell()->isString()) return asString(v1)->value() == asString(v2)->value(); @@ -128,13 +127,13 @@ namespace JSC { inline bool JSValue::strictEqual(JSValue v1, JSValue v2) { - if (JSImmediate::areBothImmediateIntegerNumbers(v1, v2)) + if (v1.isInt32() && v2.isInt32()) return v1 == v2; if (v1.isNumber() && v2.isNumber()) return v1.uncheckedGetNumber() == v2.uncheckedGetNumber(); - if (JSImmediate::isEitherImmediate(v1, v2)) + if (!v1.isCell() || !v2.isCell()) return v1 == v2; return strictEqualSlowCaseInline(v1, v2); @@ -142,8 +141,8 @@ namespace JSC { inline bool jsLess(CallFrame* callFrame, JSValue v1, JSValue v2) { - if (JSValue::areBothInt32Fast(v1, v2)) - return v1.getInt32Fast() < v2.getInt32Fast(); + if (v1.isInt32() && v2.isInt32()) + return v1.asInt32() < v2.asInt32(); double n1; double n2; @@ -167,8 +166,8 @@ namespace JSC { inline bool jsLessEq(CallFrame* callFrame, JSValue v1, JSValue v2) { - if (JSValue::areBothInt32Fast(v1, v2)) - return v1.getInt32Fast() <= v2.getInt32Fast(); + if (v1.isInt32() && v2.isInt32()) + return v1.asInt32() <= v2.asInt32(); double n1; double n2; @@ -217,8 +216,8 @@ namespace JSC { } if (rightIsNumber & leftIsString) { - RefPtr<UString::Rep> value = v2.isInt32Fast() ? - concatenate(asString(v1)->value().rep(), v2.getInt32Fast()) : + RefPtr<UString::Rep> value = v2.isInt32() ? + concatenate(asString(v1)->value().rep(), v2.asInt32()) : concatenate(asString(v1)->value().rep(), right); if (!value) @@ -314,20 +313,13 @@ namespace JSC { resultRep = UString::Rep::createEmptyBuffer(bufferSize); UString result(resultRep); - // Loop over the openards, writing them into the output buffer. + // Loop over the operands, writing them into the output buffer. for (unsigned i = 0; i < count; ++i) { JSValue v = strings[i].jsValue(); if (LIKELY(v.isString())) result.append(asString(v)->value()); - else if (v.isInt32Fast()) - result.appendNumeric(v.getInt32Fast()); - else { - double d; - if (v.getNumber(d)) - result.appendNumeric(d); - else - result.append(v.toString(callFrame)); - } + else + result.append(v.toString(callFrame)); } return jsString(callFrame, result); |