Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (189843 => 189844)
--- trunk/Source/_javascript_Core/ChangeLog 2015-09-16 03:46:46 UTC (rev 189843)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-09-16 03:52:20 UTC (rev 189844)
@@ -1,3 +1,27 @@
+2015-09-15 Sukolsak Sakshuwong <sukol...@gmail.com>
+
+ Fix asm.js errors in WebAssembly tests
+ https://bugs.webkit.org/show_bug.cgi?id=149203
+
+ Reviewed by Geoffrey Garen.
+
+ Our WebAssembly implementation uses asm.js for testing. Using Firefox to
+ parse asm.js reveals many errors that are not caught by pack-asmjs. For
+ example,
+ - asm.js does not allow the use of the multiplication operator (*) to
+ multiply two integers, because the result can be so large that some
+ lower bits of precision are lost. Math.imul is used instead.
+ - an int variable must be coerced to either signed (via x|0) or unsigned
+ (via x>>>0) before it's returned.
+
+ * tests/stress/wasm-arithmetic-int32.js:
+ * tests/stress/wasm-calls.js:
+ * tests/stress/wasm-control-flow.js:
+ * tests/stress/wasm-globals.js:
+ * tests/stress/wasm-locals.js:
+ * tests/stress/wasm-relational.js:
+ * tests/stress/wasm/control-flow.wasm:
+
2015-09-15 Ryosuke Niwa <rn...@webkit.org>
Add ShadowRoot interface and Element.prototype.attachShadow
Modified: trunk/Source/_javascript_Core/tests/stress/wasm/control-flow.wasm (189843 => 189844)
--- trunk/Source/_javascript_Core/tests/stress/wasm/control-flow.wasm 2015-09-16 03:46:46 UTC (rev 189843)
+++ trunk/Source/_javascript_Core/tests/stress/wasm/control-flow.wasm 2015-09-16 03:52:20 UTC (rev 189844)
@@ -1,3 +1,3 @@
-wasm6\x81\x80\xA5<\xC0\xA0\xA1\xA0\x81<\xC0\xA0\xA1\xA0\x81\x80\xA5<\xC0\xA0\xA1\xA2\x81<\xC0\xA0\xA1\xA2\x82\x80\xA1.\xC0\xA0.\xC1\xA0\xA1\xA2.\xC1\xA0\xA3\xA4\x824\xC1\xA5\x80\xC0\xA1\x81\xC1\xA1\xC0\x82\xA1.\xC1\xA2\x80\xC0\xA1\x81\xC1\xA1\xC0\x824\xC1\xA5.\xC1\xA2\x81\xA3\x80\xC0\xA1\x81\xC1\xA1\xC0\x834\xC1\xA5\x82\xA04¢\x80\xC0\xA1\x82¡\x81\xC1\xA1\xC0\x82\x80\xC0\xA1\x81\xC1\xA14\xC1\xA0\xC0\x82.\xC1\xA2\x80\xC0\xA1\x81\xC1\xA1\xA1\xC0\x82.\xC1\xA2\x81\xA3\x80\xC0\xA1\x81\xC1\xA14\xC1\xA5\xC0\x81\x80\xA1\x80\xA2\xA0\xC0\x81.\xC0\xA1\x80\xA1\x80\xA2\xA0\xC0\x81\x80\xA1\x80\xA2\x80\xA3\xA0\x80\xA4\xA0\xC0\x81\x80\xA1\x80\xA2\x80\xA3\xA0\x80\xA4\xA0\xC0\x834\xC1\xA5\x82\xA04¢\x80\xC0\xA1.\xC0\xA8\x82¡\x81\xC1\xA1\xC0\x81\xC0\x81\xA1\x81\xA2\
x81\xA3\xC1\x81\xC0\x81\xC1\xE8\x81\xC1d\x81\xC1\xAA\x81\xC1\xA1\xC1ifTrueifFalseifElseTrueifElseFalseifInIfwhileLoopwhileBreakwhileContinuewhileInWhiledoLoop doBreak
+wasmT\x81\x80\xA5<\xC0\xA0\xA1\xA0\x81<\xC0\xA0\xA1\xA0\x81\x80\xA5<\xC0\xA0\xA1\xA2\xA0\x81<\xC0\xA0\xA1\xA2\xA0\x82\x80\xA1.\xC0\xA0.\xC1\xA0\xA1\xA2.\xC1\xA0\xA3\xA4\xA0\x824\xC1\xA5\x80\xC0\xA1\x81\xC1\xA1\xC0\x82\xA1.\xC1\xA2\x80\xC0\xA1\x81\xC1\xA1\xC0\x824\xC1\xA5.\xC1\xA2\x81\xA3\x80\xC0\xA1\x81\xC1\xA1\xC0\x834\xC1\xA5\x82\xA04¢\x80\xC0\xA1\x82¡\x81\xC1\xA1\xC0\x82\x80\xC0\xA1\x81\xC1\xA14\xC1\xA0\xC0\x82.\xC1\xA2\x80\xC0\xA1\x81\xC1\xA1\xA1\xC0\x82.\xC1\xA2\x81\xA3\x80\xC0\xA1\x81\xC1\xA14\xC1\xA5\xC0\x81\x80\xA1\x80\xA2\xA0\xC0\x81.\xC0\xA1\x80\xA1\x80\xA2\xA0\xC0\x81\x80\xA1\x80\xA2\x80\xA3\xA0\x80\xA4\xA0\xC0\x81\x80\xA1\x80\xA2\x80\xA3\xA0\x80\xA4\xA0\xC0\x834\xC1\xA5\x82\xA04¢\x80\xC0\xA1.\xC0\xA8\x82¡\x81\xC1\xA1\xC0\x81\xC0\x81\xA1
\x81\xA2\x81\xA3\xC1\x81\xC0\x81\xC1\xE8\x81\xC1d\x81\xC1\xAA\x81\xC1\xA1\xC1ifTrueifFalseifElseTrueifElseFalseifInIfwhileLoopwhileBreakwhileContinuewhileInWhiledoLoop doBreak
doContinuelabelBreaklabelContinue labelInLabelBreakInnerlabelInLabelBreakOuterwhileInWhileBreakOuterswitchCaseswitchFallThrough
\ No newline at end of file
Modified: trunk/Source/_javascript_Core/tests/stress/wasm-arithmetic-int32.js (189843 => 189844)
--- trunk/Source/_javascript_Core/tests/stress/wasm-arithmetic-int32.js 2015-09-16 03:46:46 UTC (rev 189843)
+++ trunk/Source/_javascript_Core/tests/stress/wasm-arithmetic-int32.js 2015-09-16 03:52:20 UTC (rev 189844)
@@ -25,11 +25,12 @@
"use asm";
var clz32 = global.Math.clz32;
+ var imul = global.Math.imul;
var abs = global.Math.abs;
function negate(x) {
x = x | 0;
- return -x;
+ return (-x) | 0;
}
function add(x, y) {
@@ -47,7 +48,7 @@
function multiply(x, y) {
x = x | 0;
y = y | 0;
- return (x * y) | 0;
+ return imul(x, y) | 0;
}
function divide(x, y) {
@@ -112,7 +113,7 @@
function logicalRightShift(x, y) {
x = x | 0;
y = y | 0;
- return x >>> y;
+ return (x >>> y) | 0;
}
function countLeadingZeros(x) {
@@ -127,7 +128,7 @@
function absolute(x) {
x = x | 0;
- return abs(x | 0);
+ return abs(x | 0) | 0;
}
return {
Modified: trunk/Source/_javascript_Core/tests/stress/wasm-calls.js (189843 => 189844)
--- trunk/Source/_javascript_Core/tests/stress/wasm-calls.js 2015-09-16 03:46:46 UTC (rev 189843)
+++ trunk/Source/_javascript_Core/tests/stress/wasm-calls.js 2015-09-16 03:52:20 UTC (rev 189844)
@@ -11,6 +11,7 @@
function asmModule(global, imports, buffer) {
"use asm";
+ var imul = global.Math.imul;
var sum = imports.sum;
var max = imports.max;
@@ -24,27 +25,27 @@
function gcd(x, y) {
x = x | 0;
y = y | 0;
- if (y == 0)
- return x;
- return gcd(y, (x | 0) % (y | 0)) | 0;
+ if ((y | 0) == 0)
+ return x | 0;
+ return gcd(y, ((x | 0) % (y | 0)) | 0) | 0;
}
function lcm(x, y) {
x = x | 0;
y = y | 0;
- return (((x * y) | 0) / (gcd(x, y) | 0)) | 0;
+ return (imul(x, y) / (gcd(x, y) | 0)) | 0;
}
function callSum(x, y) {
x = x | 0;
y = y | 0;
- return sum(x, y) | 0;
+ return sum(x | 0, y | 0) | 0;
}
function callMax(x, y) {
x = x | 0;
y = y | 0;
- return max(x, y) | 0;
+ return max(x | 0, y | 0) | 0;
}
return {
Modified: trunk/Source/_javascript_Core/tests/stress/wasm-control-flow.js (189843 => 189844)
--- trunk/Source/_javascript_Core/tests/stress/wasm-control-flow.js 2015-09-16 03:46:46 UTC (rev 189843)
+++ trunk/Source/_javascript_Core/tests/stress/wasm-control-flow.js 2015-09-16 03:52:20 UTC (rev 189844)
@@ -33,6 +33,7 @@
return 1;
else
return 2;
+ return 0;
}
function ifElseFalse() {
@@ -41,22 +42,24 @@
return 1;
else
return 2;
+ return 0;
}
function ifInIf() {
var x = 0, y = 0;
x = 1;
- if (x == 0) {
- if (y == 0)
+ if ((x | 0) == 0) {
+ if ((y | 0) == 0)
return 1;
else
return 2;
} else {
- if (y == 0)
+ if ((y | 0) == 0)
return 3;
else
return 4;
}
+ return 0;
}
function whileLoop() {
@@ -65,31 +68,31 @@
x = (x + 1) | 0;
i = (i + 1) | 0;
}
- return x;
+ return x | 0;
}
function whileBreak() {
var x = 0, i = 0;
while (1) {
- if (i == 2)
+ if ((i | 0) == 2)
break;
x = (x + 1) | 0;
i = (i + 1) | 0;
}
- return x;
+ return x | 0;
}
function whileContinue() {
var x = 0, i = 0;
while ((i | 0) < 5) {
- if (i == 2) {
+ if ((i | 0) == 2) {
i = 3;
continue;
}
x = (x + 1) | 0;
i = (i + 1) | 0;
}
- return x;
+ return x | 0;
}
function whileInWhile() {
@@ -102,7 +105,7 @@
}
i = (i + 1) | 0;
}
- return x;
+ return x | 0;
}
function doLoop() {
@@ -111,31 +114,31 @@
x = (x + 1) | 0;
i = (i + 1) | 0;
} while ((i | 0) < 0);
- return x;
+ return x | 0;
}
function doBreak() {
var x = 0, i = 0;
do {
- if (i == 2)
+ if ((i | 0) == 2)
break;
x = (x + 1) | 0;
i = (i + 1) | 0;
} while (1);
- return x;
+ return x | 0;
}
function doContinue() {
var x = 0, i = 0;
do {
- if (i == 2) {
+ if ((i | 0) == 2) {
i = 3;
continue;
}
x = (x + 1) | 0;
i = (i + 1) | 0;
} while ((i | 0) < 5);
- return x;
+ return x | 0;
}
function labelBreak() {
@@ -145,19 +148,19 @@
break label;
x = 2;
} while (0);
- return x;
+ return x | 0;
}
function labelContinue() {
var x = 0;
label: do {
- if (x == 1)
+ if ((x | 0) == 1)
break label;
x = 1;
continue label;
x = 2;
} while (0);
- return x;
+ return x | 0;
}
function labelInLabelBreakInner() {
@@ -171,7 +174,7 @@
} while (0);
x = 4;
} while (0);
- return x;
+ return x | 0;
}
function labelInLabelBreakOuter() {
@@ -185,7 +188,7 @@
} while (0);
x = 4;
} while (0);
- return x;
+ return x | 0;
}
function whileInWhileBreakOuter() {
@@ -195,19 +198,19 @@
j = 0;
while ((j | 0) < 2) {
x = (x + 1) | 0;
- if (x == 8)
+ if ((x | 0) == 8)
break label;
j = (j + 1) | 0;
}
i = (i + 1) | 0;
}
- return x;
+ return x | 0;
}
function switchCase(x) {
x = x | 0;
var y = 0;
- switch (x) {
+ switch (x | 0) {
case 0:
y = 1;
break;
@@ -218,13 +221,13 @@
y = 3;
break;
}
- return y;
+ return y | 0;
}
function switchFallThrough(x) {
x = x | 0;
var y = 0;
- switch (x) {
+ switch (x | 0) {
case 3:
y = (y + 1000) | 0;
case 2:
@@ -234,7 +237,7 @@
default:
y = (y + 1) | 0;
}
- return y;
+ return y | 0;
}
return {
Modified: trunk/Source/_javascript_Core/tests/stress/wasm-globals.js (189843 => 189844)
--- trunk/Source/_javascript_Core/tests/stress/wasm-globals.js 2015-09-16 03:46:46 UTC (rev 189843)
+++ trunk/Source/_javascript_Core/tests/stress/wasm-globals.js 2015-09-16 03:52:20 UTC (rev 189844)
@@ -17,7 +17,7 @@
var z = 0.0;
function getX() {
- return x;
+ return x | 0;
}
function getY() {
Modified: trunk/Source/_javascript_Core/tests/stress/wasm-locals.js (189843 => 189844)
--- trunk/Source/_javascript_Core/tests/stress/wasm-locals.js 2015-09-16 03:46:46 UTC (rev 189843)
+++ trunk/Source/_javascript_Core/tests/stress/wasm-locals.js 2015-09-16 03:52:20 UTC (rev 189844)
@@ -16,7 +16,7 @@
y = y | 0;
var result = 0;
result = (x + y) | 0;
- return result;
+ return result | 0;
}
function add1(x) {
Modified: trunk/Source/_javascript_Core/tests/stress/wasm-relational.js (189843 => 189844)
--- trunk/Source/_javascript_Core/tests/stress/wasm-relational.js 2015-09-16 03:46:46 UTC (rev 189843)
+++ trunk/Source/_javascript_Core/tests/stress/wasm-relational.js 2015-09-16 03:52:20 UTC (rev 189844)
@@ -11,16 +11,18 @@
function asmModule(global, env, buffer) {
"use asm";
+ var fround = global.Math.fround;
+
function equal(x, y) {
x = x | 0;
y = y | 0;
- return (x == y) | 0;
+ return ((x | 0) == (y | 0)) | 0;
}
function notEqual(x, y) {
x = x | 0;
y = y | 0;
- return (x != y) | 0;
+ return ((x | 0) != (y | 0)) | 0;
}
function lessThan(x, y) {