- Revision
- 205608
- Author
- [email protected]
- Date
- 2016-09-08 02:04:02 -0700 (Thu, 08 Sep 2016)
Log Message
Merge r205267 - stress/random-53bit.js.ftl-no-cjit-no-inline-validate sometimes fails
https://bugs.webkit.org/show_bug.cgi?id=161436
Reviewed by Filip Pizlo.
JSTests:
The test checks Math.random() correctly produces 53bit random values.
The test can fail by design, but this should be fairly rare.
However, when introducing, we wrap the `test()` with 1e4 to ensure the FTL compilation, and this
increases the failure rate. By increasing the MAX in the test, we make the failures much more rare case.
And we also add getRandomSeed() and setRandomSeed(seed) JSC shell helpers to dump more useful information
and reproduce the situation easily.
* stress/random-53bit.js:
(test):
Source/_javascript_Core:
* jsc.cpp:
(GlobalObject::finishCreation):
(functionGetRandomSeed):
(functionSetRandomSeed):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::weakRandom):
(JSC::JSGlobalObject::weakRandomInteger): Deleted.
Modified Paths
Diff
Modified: releases/WebKitGTK/webkit-2.14/JSTests/ChangeLog (205607 => 205608)
--- releases/WebKitGTK/webkit-2.14/JSTests/ChangeLog 2016-09-08 08:46:47 UTC (rev 205607)
+++ releases/WebKitGTK/webkit-2.14/JSTests/ChangeLog 2016-09-08 09:04:02 UTC (rev 205608)
@@ -1,3 +1,22 @@
+2016-08-31 Yusuke Suzuki <[email protected]>
+
+ stress/random-53bit.js.ftl-no-cjit-no-inline-validate sometimes fails
+ https://bugs.webkit.org/show_bug.cgi?id=161436
+
+ Reviewed by Filip Pizlo.
+
+ The test checks Math.random() correctly produces 53bit random values.
+ The test can fail by design, but this should be fairly rare.
+
+ However, when introducing, we wrap the `test()` with 1e4 to ensure the FTL compilation, and this
+ increases the failure rate. By increasing the MAX in the test, we make the failures much more rare case.
+
+ And we also add getRandomSeed() and setRandomSeed(seed) JSC shell helpers to dump more useful information
+ and reproduce the situation easily.
+
+ * stress/random-53bit.js:
+ (test):
+
2016-08-29 Benjamin Poulain <[email protected]>
[JSC] Improve ArithAbs with polymorphic input
Modified: releases/WebKitGTK/webkit-2.14/JSTests/stress/random-53bit.js (205607 => 205608)
--- releases/WebKitGTK/webkit-2.14/JSTests/stress/random-53bit.js 2016-09-08 08:46:47 UTC (rev 205607)
+++ releases/WebKitGTK/webkit-2.14/JSTests/stress/random-53bit.js 2016-09-08 09:04:02 UTC (rev 205608)
@@ -1,10 +1,12 @@
function test() {
- var MAX = 30;
+ var MAX = 50;
var found53Bit = false;
var foundLessThan53Bit = false;
+ var results = new Array(MAX);
for (var i = 0; i < MAX; ++i) {
var str = Math.random().toString(2);
+ results[i] = str;
// 53 bit + '0.'.length
if (str.length === (53 + 2))
found53Bit = true;
@@ -14,6 +16,8 @@
if (found53Bit && foundLessThan53Bit)
return true;
}
+ print(`Random seed ${getRandomSeed()}`);
+ print(results.join('\n'));
return false;
}
noInline(test);
Modified: releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/ChangeLog (205607 => 205608)
--- releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/ChangeLog 2016-09-08 08:46:47 UTC (rev 205607)
+++ releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/ChangeLog 2016-09-08 09:04:02 UTC (rev 205608)
@@ -1,3 +1,18 @@
+2016-08-31 Yusuke Suzuki <[email protected]>
+
+ stress/random-53bit.js.ftl-no-cjit-no-inline-validate sometimes fails
+ https://bugs.webkit.org/show_bug.cgi?id=161436
+
+ Reviewed by Filip Pizlo.
+
+ * jsc.cpp:
+ (GlobalObject::finishCreation):
+ (functionGetRandomSeed):
+ (functionSetRandomSeed):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::weakRandom):
+ (JSC::JSGlobalObject::weakRandomInteger): Deleted.
+
2016-08-31 Chris Dumez <[email protected]>
Object.getPrototypeOf() should return null cross-origin
Modified: releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/jsc.cpp (205607 => 205608)
--- releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/jsc.cpp 2016-09-08 08:46:47 UTC (rev 205607)
+++ releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/jsc.cpp 2016-09-08 09:04:02 UTC (rev 205608)
@@ -647,6 +647,8 @@
static EncodedJSValue JSC_HOST_CALL functionShadowChickenFunctionsOnStack(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionSetGlobalConstRedeclarationShouldNotThrow(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionGetRandomSeed(ExecState*);
+static EncodedJSValue JSC_HOST_CALL functionSetRandomSeed(ExecState*);
struct Script {
enum class StrictMode {
@@ -857,6 +859,9 @@
addFunction(vm, "drainMicrotasks", functionDrainMicrotasks, 0);
+ addFunction(vm, "getRandomSeed", functionGetRandomSeed, 0);
+ addFunction(vm, "setRandomSeed", functionSetRandomSeed, 1);
+
addFunction(vm, "is32BitPlatform", functionIs32BitPlatform, 0);
addFunction(vm, "loadModule", functionLoadModule, 1);
@@ -1597,6 +1602,20 @@
return JSValue::encode(jsUndefined());
}
+EncodedJSValue JSC_HOST_CALL functionGetRandomSeed(ExecState* exec)
+{
+ return JSValue::encode(jsNumber(exec->lexicalGlobalObject()->weakRandom().seed()));
+}
+
+EncodedJSValue JSC_HOST_CALL functionSetRandomSeed(ExecState* exec)
+{
+ unsigned seed = exec->argument(0).toUInt32(exec);
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+ exec->lexicalGlobalObject()->weakRandom().setSeed(seed);
+ return JSValue::encode(jsUndefined());
+}
+
EncodedJSValue JSC_HOST_CALL functionReadline(ExecState* exec)
{
Vector<char, 256> line;
Modified: releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/runtime/JSGlobalObject.h (205607 => 205608)
--- releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/runtime/JSGlobalObject.h 2016-09-08 08:46:47 UTC (rev 205607)
+++ releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/runtime/JSGlobalObject.h 2016-09-08 09:04:02 UTC (rev 205608)
@@ -766,6 +766,7 @@
static ptrdiff_t weakRandomOffset() { return OBJECT_OFFSETOF(JSGlobalObject, m_weakRandom); }
double weakRandomNumber() { return m_weakRandom.get(); }
unsigned weakRandomInteger() { return m_weakRandom.getUint32(); }
+ WeakRandom& weakRandom() { return m_weakRandom; }
UnlinkedProgramCodeBlock* createProgramCodeBlock(CallFrame*, ProgramExecutable*, JSObject** exception);
UnlinkedEvalCodeBlock* createEvalCodeBlock(CallFrame*, EvalExecutable*, const VariableEnvironment*);