Changeset 205267 in webkit
- Timestamp:
- Aug 31, 2016 2:03:34 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r205112 r205267 1 2016-08-31 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 stress/random-53bit.js.ftl-no-cjit-no-inline-validate sometimes fails 4 https://bugs.webkit.org/show_bug.cgi?id=161436 5 6 Reviewed by Filip Pizlo. 7 8 The test checks Math.random() correctly produces 53bit random values. 9 The test can fail by design, but this should be fairly rare. 10 11 However, when introducing, we wrap the `test()` with 1e4 to ensure the FTL compilation, and this 12 increases the failure rate. By increasing the MAX in the test, we make the failures much more rare case. 13 14 And we also add getRandomSeed() and setRandomSeed(seed) JSC shell helpers to dump more useful information 15 and reproduce the situation easily. 16 17 * stress/random-53bit.js: 18 (test): 19 1 20 2016-08-29 Benjamin Poulain <bpoulain@apple.com> 2 21 -
trunk/JSTests/stress/random-53bit.js
r194087 r205267 1 1 function test() { 2 var MAX = 30;2 var MAX = 50; 3 3 var found53Bit = false; 4 4 var foundLessThan53Bit = false; 5 var results = new Array(MAX); 5 6 6 7 for (var i = 0; i < MAX; ++i) { 7 8 var str = Math.random().toString(2); 9 results[i] = str; 8 10 // 53 bit + '0.'.length 9 11 if (str.length === (53 + 2)) … … 15 17 return true; 16 18 } 19 print(`Random seed ${getRandomSeed()}`); 20 print(results.join('\n')); 17 21 return false; 18 22 } -
trunk/Source/JavaScriptCore/ChangeLog
r205258 r205267 1 2016-08-31 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 stress/random-53bit.js.ftl-no-cjit-no-inline-validate sometimes fails 4 https://bugs.webkit.org/show_bug.cgi?id=161436 5 6 Reviewed by Filip Pizlo. 7 8 * jsc.cpp: 9 (GlobalObject::finishCreation): 10 (functionGetRandomSeed): 11 (functionSetRandomSeed): 12 * runtime/JSGlobalObject.h: 13 (JSC::JSGlobalObject::weakRandom): 14 (JSC::JSGlobalObject::weakRandomInteger): Deleted. 15 1 16 2016-08-31 Chris Dumez <cdumez@apple.com> 2 17 -
trunk/Source/JavaScriptCore/jsc.cpp
r205198 r205267 648 648 static EncodedJSValue JSC_HOST_CALL functionShadowChickenFunctionsOnStack(ExecState*); 649 649 static EncodedJSValue JSC_HOST_CALL functionSetGlobalConstRedeclarationShouldNotThrow(ExecState*); 650 static EncodedJSValue JSC_HOST_CALL functionGetRandomSeed(ExecState*); 651 static EncodedJSValue JSC_HOST_CALL functionSetRandomSeed(ExecState*); 650 652 651 653 struct Script { … … 857 859 858 860 addFunction(vm, "drainMicrotasks", functionDrainMicrotasks, 0); 861 862 addFunction(vm, "getRandomSeed", functionGetRandomSeed, 0); 863 addFunction(vm, "setRandomSeed", functionSetRandomSeed, 1); 859 864 860 865 addFunction(vm, "is32BitPlatform", functionIs32BitPlatform, 0); … … 1598 1603 } 1599 1604 1605 EncodedJSValue JSC_HOST_CALL functionGetRandomSeed(ExecState* exec) 1606 { 1607 return JSValue::encode(jsNumber(exec->lexicalGlobalObject()->weakRandom().seed())); 1608 } 1609 1610 EncodedJSValue JSC_HOST_CALL functionSetRandomSeed(ExecState* exec) 1611 { 1612 unsigned seed = exec->argument(0).toUInt32(exec); 1613 if (exec->hadException()) 1614 return JSValue::encode(jsUndefined()); 1615 exec->lexicalGlobalObject()->weakRandom().setSeed(seed); 1616 return JSValue::encode(jsUndefined()); 1617 } 1618 1600 1619 EncodedJSValue JSC_HOST_CALL functionReadline(ExecState* exec) 1601 1620 { -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r204330 r205267 767 767 double weakRandomNumber() { return m_weakRandom.get(); } 768 768 unsigned weakRandomInteger() { return m_weakRandom.getUint32(); } 769 WeakRandom& weakRandom() { return m_weakRandom; } 769 770 770 771 UnlinkedProgramCodeBlock* createProgramCodeBlock(CallFrame*, ProgramExecutable*, JSObject** exception);
Note: See TracChangeset
for help on using the changeset viewer.