Changeset 260490 in webkit
- Timestamp:
- Apr 21, 2020, 7:54:28 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 10 edited
-
JSTests/ChangeLog (modified) (1 diff)
-
JSTests/stress/heap-and-32-bigint-eq.js (added)
-
JSTests/stress/heap-and-32-bigint-stricteq.js (added)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp (modified) (3 diffs)
-
Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h (modified) (1 diff)
-
Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp (modified) (2 diffs)
-
Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp (modified) (1 diff)
-
Source/JavaScriptCore/jsc.cpp (modified) (4 diffs)
-
Source/JavaScriptCore/runtime/BigIntConstructor.cpp (modified) (2 diffs)
-
Source/JavaScriptCore/runtime/BigIntConstructor.h (modified) (1 diff)
-
Source/JavaScriptCore/runtime/JSBigInt.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r260447 r260490 1 2020-04-21 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] SpeculativeJIT::nonSpeculativeNonPeepholeStrictEq should expect AnyBigIntUse 4 https://bugs.webkit.org/show_bug.cgi?id=210832 5 6 Reviewed by Mark Lam. 7 8 * stress/heap-and-32-bigint-eq.js: Added. 9 (shouldBe): 10 * stress/heap-and-32-bigint-stricteq.js: Added. 11 (shouldBe): 12 1 13 2020-04-21 Alexey Shvayka <shvaikalesh@gmail.com> 2 14 -
trunk/Source/JavaScriptCore/ChangeLog
r260489 r260490 1 2020-04-21 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] SpeculativeJIT::nonSpeculativeNonPeepholeStrictEq should expect AnyBigIntUse 4 https://bugs.webkit.org/show_bug.cgi?id=210832 5 6 Reviewed by Mark Lam. 7 8 SpeculativeJIT::nonSpeculativeNonPeepholeStrictEq will get AnyBigIntUse now. We should use ManualOperandSpeculation 9 and speculate function to perform speculation check. 10 11 * dfg/DFGSpeculativeJIT32_64.cpp: 12 (JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeStrictEq): 13 (JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeStrictEq): 14 * dfg/DFGSpeculativeJIT64.cpp: 15 (JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeStrictEq): 16 * jsc.cpp: 17 (functionCreateHeapBigInt): 18 (functionCreateBigInt32): 19 * runtime/BigIntConstructor.cpp: 20 (JSC::toBigInt): 21 (JSC::callBigIntConstructor): 22 * runtime/BigIntConstructor.h: 23 * runtime/JSBigInt.h: 24 1 25 2020-04-21 Yusuke Suzuki <ysuzuki@apple.com> 2 26 -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
r260331 r260490 1185 1185 } 1186 1186 1187 bool SpeculativeJIT:: nonSpeculativeStrictEq(Node* node, bool invert)1187 bool SpeculativeJIT::genericJSValueStrictEq(Node* node, bool invert) 1188 1188 { 1189 1189 unsigned branchIndexInBlock = detectPeepHoleBranch(); … … 1201 1201 } 1202 1202 1203 nonSpeculativeNonPeepholeStrictEq(node, invert);1203 genericJSValueNonPeepholeStrictEq(node, invert); 1204 1204 1205 1205 return false; … … 6523 6523 6524 6524 ASSERT(node->isBinaryUseKind(UntypedUse) || node->isBinaryUseKind(AnyBigIntUse)); 6525 return nonSpeculativeStrictEq(node);6525 return genericJSValueStrictEq(node); 6526 6526 } 6527 6527 -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
r260331 r260490 747 747 748 748 void nonSpeculativePeepholeStrictEq(Node*, Node* branchNode, bool invert = false); 749 void nonSpeculativeNonPeepholeStrictEq(Node*, bool invert = false);750 bool nonSpeculativeStrictEq(Node*, bool invert = false);749 void genericJSValueNonPeepholeStrictEq(Node*, bool invert = false); 750 bool genericJSValueStrictEq(Node*, bool invert = false); 751 751 752 752 void compileInstanceOfForCells(Node*, JSValueRegs valueGPR, JSValueRegs prototypeGPR, GPRReg resultGPT, GPRReg scratchGPR, GPRReg scratch2GPR, JITCompiler::Jump slowCase = JITCompiler::Jump()); -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
r260331 r260490 398 398 } 399 399 400 JSValueOperand arg1(this, node->child1()); 401 JSValueOperand arg2(this, node->child2()); 400 JSValueOperand arg1(this, node->child1(), ManualOperandSpeculation); 401 JSValueOperand arg2(this, node->child2(), ManualOperandSpeculation); 402 speculate(node, node->child1()); 403 speculate(node, node->child2()); 402 404 GPRReg arg1PayloadGPR = arg1.payloadGPR(); 403 405 GPRReg arg2PayloadGPR = arg2.payloadGPR(); … … 436 438 } 437 439 438 void SpeculativeJIT:: nonSpeculativeNonPeepholeStrictEq(Node* node, bool invert)440 void SpeculativeJIT::genericJSValueNonPeepholeStrictEq(Node* node, bool invert) 439 441 { 440 JSValueOperand arg1(this, node->child1()); 441 JSValueOperand arg2(this, node->child2()); 442 JSValueOperand arg1(this, node->child1(), ManualOperandSpeculation); 443 JSValueOperand arg2(this, node->child2(), ManualOperandSpeculation); 444 speculate(node, node->child1()); 445 speculate(node, node->child2()); 442 446 GPRReg arg1PayloadGPR = arg1.payloadGPR(); 443 447 GPRReg arg2PayloadGPR = arg2.payloadGPR(); -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
r260331 r260490 420 420 } 421 421 422 void SpeculativeJIT:: nonSpeculativeNonPeepholeStrictEq(Node* node, bool invert)422 void SpeculativeJIT::genericJSValueNonPeepholeStrictEq(Node* node, bool invert) 423 423 { 424 424 // FIXME: some of this code should be shareable with nonSpeculativePeepholeStrictEq 425 JSValueOperand arg1(this, node->child1()); 426 JSValueOperand arg2(this, node->child2()); 425 JSValueOperand arg1(this, node->child1(), ManualOperandSpeculation); 426 JSValueOperand arg2(this, node->child2(), ManualOperandSpeculation); 427 speculate(node, node->child1()); 428 speculate(node, node->child2()); 427 429 JSValueRegs arg1Regs = arg1.jsValueRegs(); 428 430 JSValueRegs arg2Regs = arg2.jsValueRegs(); -
trunk/Source/JavaScriptCore/jsc.cpp
r260415 r260490 25 25 #include "ArrayBuffer.h" 26 26 #include "ArrayPrototype.h" 27 #include "BigIntConstructor.h" 27 28 #include "BuiltinNames.h" 28 29 #include "ButterflyInlines.h" … … 271 272 272 273 static EncodedJSValue JSC_HOST_CALL functionCreateGlobalObject(JSGlobalObject*, CallFrame*); 274 static EncodedJSValue JSC_HOST_CALL functionCreateHeapBigInt(JSGlobalObject*, CallFrame*); 275 static EncodedJSValue JSC_HOST_CALL functionCreateBigInt32(JSGlobalObject*, CallFrame*); 273 276 274 277 static EncodedJSValue JSC_HOST_CALL functionPrintStdOut(JSGlobalObject*, CallFrame*); … … 542 545 543 546 addFunction(vm, "createGlobalObject", functionCreateGlobalObject, 0); 547 addFunction(vm, "createHeapBigInt", functionCreateHeapBigInt, 1); 548 #if USE(BIGINT32) 549 addFunction(vm, "createBigInt32", functionCreateBigInt32, 1); 550 #endif 544 551 545 552 addFunction(vm, "dumpTypesForAllVariables", functionDumpTypesForAllVariables , 0); … … 2245 2252 } 2246 2253 2254 EncodedJSValue JSC_HOST_CALL functionCreateHeapBigInt(JSGlobalObject* globalObject, CallFrame* callFrame) 2255 { 2256 VM& vm = globalObject->vm(); 2257 auto scope = DECLARE_THROW_SCOPE(vm); 2258 JSValue argument = callFrame->argument(0); 2259 JSValue bigInt = toBigInt(globalObject, argument); 2260 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 2261 #if USE(BIGINT32) 2262 if (bigInt.isHeapBigInt()) 2263 return JSValue::encode(bigInt); 2264 ASSERT(bigInt.isBigInt32()); 2265 int32_t value = bigInt.bigInt32AsInt32(); 2266 return JSValue::encode(JSBigInt::createFrom(vm, value)); 2267 #else 2268 return JSValue::encode(bigInt); 2269 #endif 2270 } 2271 2272 #if USE(BIGINT32) 2273 EncodedJSValue JSC_HOST_CALL functionCreateBigInt32(JSGlobalObject* globalObject, CallFrame* callFrame) 2274 { 2275 VM& vm = globalObject->vm(); 2276 auto scope = DECLARE_THROW_SCOPE(vm); 2277 JSValue argument = callFrame->argument(0); 2278 JSValue bigIntValue = toBigInt(globalObject, argument); 2279 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 2280 if (bigIntValue.isBigInt32()) 2281 return JSValue::encode(bigIntValue); 2282 ASSERT(bigIntValue.isHeapBigInt()); 2283 JSBigInt* bigInt = jsCast<JSBigInt*>(bigIntValue); 2284 if (!bigInt->length()) 2285 return JSValue::encode(JSValue(JSValue::JSBigInt32, 0)); 2286 if (bigInt->length() == 1) { 2287 JSBigInt::Digit digit = bigInt->digit(0); 2288 if (bigInt->sign()) { 2289 if (digit <= static_cast<uint64_t>(-static_cast<int64_t>(INT32_MIN))) 2290 return JSValue::encode(JSValue(JSValue::JSBigInt32, static_cast<int32_t>(-static_cast<int64_t>(digit)))); 2291 } else { 2292 if (digit <= INT32_MAX) 2293 return JSValue::encode(JSValue(JSValue::JSBigInt32, static_cast<int32_t>(digit))); 2294 } 2295 } 2296 throwTypeError(globalObject, scope, "Out of range of BigInt32"_s); 2297 return { }; 2298 } 2299 #endif 2300 2247 2301 EncodedJSValue JSC_HOST_CALL functionCheckModuleSyntax(JSGlobalObject* globalObject, CallFrame* callFrame) 2248 2302 { -
trunk/Source/JavaScriptCore/runtime/BigIntConstructor.cpp
r260384 r260490 76 76 // ------------------------------ Functions --------------------------- 77 77 78 static EncodedJSValue toBigInt(JSGlobalObject* globalObject, JSValue argument)78 JSValue toBigInt(JSGlobalObject* globalObject, JSValue argument) 79 79 { 80 80 ASSERT(argument.isPrimitive()); 81 81 VM& vm = globalObject->vm(); 82 auto scope = DECLARE_THROW_SCOPE(vm); 82 83 83 84 if (argument.isBigInt()) 84 return JSValue::encode(argument);85 return argument; 85 86 86 87 if (argument.isBoolean()) { 87 88 #if USE(BIGINT32) 88 return JSValue ::encode(JSValue(JSValue::JSBigInt32, argument.asBoolean()));89 return JSValue(JSValue::JSBigInt32, argument.asBoolean()); 89 90 #else 90 return JS Value::encode(JSBigInt::createFrom(vm, argument.asBoolean()));91 return JSBigInt::createFrom(vm, argument.asBoolean()); 91 92 #endif 92 93 } 93 94 94 95 if (argument.isString()) { 96 scope.release(); 95 97 return toStringView(globalObject, argument, [&] (StringView view) { 96 return JS Value::encode(JSBigInt::parseInt(globalObject, view));98 return JSBigInt::parseInt(globalObject, view); 97 99 }); 98 100 } 99 101 100 102 ASSERT(argument.isUndefinedOrNull() || argument.isNumber() || argument.isSymbol()); 101 auto scope = DECLARE_THROW_SCOPE(vm);102 return throwVMTypeError(globalObject, scope, "Invalid argument type in ToBigInt operation"_s);103 throwTypeError(globalObject, scope, "Invalid argument type in ToBigInt operation"_s); 104 return jsUndefined(); 103 105 } 104 106 … … 130 132 } 131 133 132 EncodedJSValue result = toBigInt(globalObject, primitive); 133 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 134 return result; 134 RELEASE_AND_RETURN(scope, JSValue::encode(toBigInt(globalObject, primitive))); 135 135 } 136 136 -
trunk/Source/JavaScriptCore/runtime/BigIntConstructor.h
r260415 r260490 59 59 STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(BigIntConstructor, InternalFunction); 60 60 61 JS_EXPORT_PRIVATE JSValue toBigInt(JSGlobalObject*, JSValue); 62 61 63 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/JSBigInt.h
r260489 r260490 64 64 static JSBigInt* createWithLengthUnchecked(VM&, unsigned length); 65 65 66 static JSBigInt* createFrom(VM&, int32_t value);66 JS_EXPORT_PRIVATE static JSBigInt* createFrom(VM&, int32_t value); 67 67 static JSBigInt* createFrom(VM&, uint32_t value); 68 68 static JSBigInt* createFrom(VM&, int64_t value);
Note:
See TracChangeset
for help on using the changeset viewer.