<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[189532] trunk/Source/JavaScriptCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/189532">189532</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-09-08 21:19:01 -0700 (Tue, 08 Sep 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Refactor the test for the arithmetic instructions in WebAssembly
https://bugs.webkit.org/show_bug.cgi?id=148983
Patch by Sukolsak Sakshuwong <sukolsak@gmail.com> on 2015-09-08
Reviewed by Mark Lam.
Pass the values into the test functions as Mark Lam suggested in
https://bugs.webkit.org/show_bug.cgi?id=148882#c3
* tests/stress/wasm-arithmetic-int32.js: Added.
(shouldBe):
(shouldThrow):
* tests/stress/wasm-arithmetic.js: Removed.
(shouldBe): Deleted.
(shouldThrow): Deleted.
* tests/stress/wasm/arithmetic-int32.wasm: Added.
* tests/stress/wasm/arithmetic.wasm: Removed.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoretestsstresswasmarithmeticint32wasm">trunk/Source/JavaScriptCore/tests/stress/wasm/arithmetic-int32.wasm</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstresswasmarithmeticint32js">trunk/Source/JavaScriptCore/tests/stress/wasm-arithmetic-int32.js</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoretestsstresswasmarithmeticwasm">trunk/Source/JavaScriptCore/tests/stress/wasm/arithmetic.wasm</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstresswasmarithmeticjs">trunk/Source/JavaScriptCore/tests/stress/wasm-arithmetic.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (189531 => 189532)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-09-09 04:02:24 UTC (rev 189531)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-09-09 04:19:01 UTC (rev 189532)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2015-09-08 Sukolsak Sakshuwong <sukolsak@gmail.com>
+
+ Refactor the test for the arithmetic instructions in WebAssembly
+ https://bugs.webkit.org/show_bug.cgi?id=148983
+
+ Reviewed by Mark Lam.
+
+ Pass the values into the test functions as Mark Lam suggested in
+ https://bugs.webkit.org/show_bug.cgi?id=148882#c3
+
+ * tests/stress/wasm-arithmetic-int32.js: Added.
+ (shouldBe):
+ (shouldThrow):
+ * tests/stress/wasm-arithmetic.js: Removed.
+ (shouldBe): Deleted.
+ (shouldThrow): Deleted.
+ * tests/stress/wasm/arithmetic-int32.wasm: Added.
+ * tests/stress/wasm/arithmetic.wasm: Removed.
+
</ins><span class="cx"> 2015-09-08 Benjamin Poulain <bpoulain@apple.com>
</span><span class="cx">
</span><span class="cx"> [JSC] reduce the amount of memory access needed for LivenessAnalysisPhase
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstresswasmarithmeticint32wasm"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/wasm/arithmetic-int32.wasm (0 => 189532)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/wasm/arithmetic-int32.wasm         (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/wasm/arithmetic-int32.wasm        2015-09-09 04:19:01 UTC (rev 189532)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+wasm\x80\xC0\x80\xC0\xC1\x80\xC0\xC1\x80 \xC0\xC1\x80!\xC0\xC1\x80"\xC0\xC1\x80#\xC0\xC1\x80$\xC0\xC1\x80%\xC0\x80&\xC0\xC1\x80'\xC0\xC1\x80(\xC0\xC1\x80)\xC0\xC1\x80*\xC0\xC1\x80+\xC0\xC1\x80,\xC0\x80-\xC0\x80H\xC0negateaddsubtractmultiplydivideunsignedDividemodulounsignedModulobitNotbitOr        bitAnd
+bitXorleftShiftarithmeticRightShift+logicalRightShiftcountLeadingZeroslogicalNotabsolute
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstresswasmarithmeticwasm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/tests/stress/wasm/arithmetic.wasm (189531 => 189532)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/wasm/arithmetic.wasm        2015-09-09 04:02:24 UTC (rev 189531)
+++ trunk/Source/JavaScriptCore/tests/stress/wasm/arithmetic.wasm        2015-09-09 04:19:01 UTC (rev 189532)
</span><span class="lines">@@ -1,3 +0,0 @@
</span><del>-wasm\xD2\xFF\xFF\xFF\xFF*\x80\x80\x80\x80\xD6\xFF\xFF\xFF(\x81\x80\x81\xC0\x80\xAA\x84\xA8\x80\xFF\xFF\xFF\xFF\xA1\x80 \xA6\xA7\x80 \x82\x80\x80!\x81\xA5\x80!\xA1\xA0\x80!\x82\x80\x80"\x80\xA2\x80"\x80\xA0\x80#\x81\xA5\x80#\x83\xA5\x80#\xA1\xA0\x80#\x82\x80\x80$\x80\xA0\x8D\x80$\x80\xA0\x80%\xD5\xFF\xFF\xFF\x80&\xAA\x84\x80'/:\x80(\xB5?\x80)\xB5\xA1\x80*\x80\xBC\x80+\x80\xBC\x80,\x81\x80,\xA0\x80-\x81\x80-\xA0\x80H\x83\x80H\x81negateaddSubtractaddOverflowmultiplymultiplyOverflowdividedivideByZerodivideOverflowunsignedDivideunsignedDivideByZero        modulo
-moduloNegativemoduloZeromoduloOverflow-unsignedModulounsignedModuloZerobitNotbitOrbitAndbitXorleftShiftarithmeticRightShiftlogicalRightShiftcountLeadingZeroscountLeadingZerosOfZerologicalNotNonZerologicalNotZeroabsoluteNegativeabsolutePositive
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstresswasmarithmeticint32js"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/wasm-arithmetic-int32.js (0 => 189532)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/wasm-arithmetic-int32.js         (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/wasm-arithmetic-int32.js        2015-09-09 04:19:01 UTC (rev 189532)
</span><span class="lines">@@ -0,0 +1,199 @@
</span><ins>+//@ skip
+
+function shouldBe(actual, expected) {
+ if (actual !== expected)
+ throw new Error('bad value: ' + actual);
+}
+
+function shouldThrow(func, message) {
+ var error = null;
+ try {
+ func();
+ } catch (e) {
+ error = e;
+ }
+ if (!error)
+ throw new Error("not thrown.");
+ if (String(error) !== message)
+ throw new Error("bad error: " + String(error));
+}
+
+/*
+wasm/arithmetic-int32.wasm is generated by pack-asmjs <https://github.com/WebAssembly/polyfill-prototype-1> from the following script:
+
+function asmModule(global, env, buffer) {
+ "use asm";
+
+ var clz32 = global.Math.clz32;
+ var abs = global.Math.abs;
+
+ function negate(x) {
+ x = x | 0;
+ return -x;
+ }
+
+ function add(x, y) {
+ x = x | 0;
+ y = y | 0;
+ return (x + y) | 0;
+ }
+
+ function subtract(x, y) {
+ x = x | 0;
+ y = y | 0;
+ return (x - y) | 0;
+ }
+
+ function multiply(x, y) {
+ x = x | 0;
+ y = y | 0;
+ return (x * y) | 0;
+ }
+
+ function divide(x, y) {
+ x = x | 0;
+ y = y | 0;
+ return ((x | 0) / (y | 0)) | 0;
+ }
+
+ function unsignedDivide(x, y) {
+ x = x | 0;
+ y = y | 0;
+ return ((x >>> 0) / (y >>> 0)) | 0;
+ }
+
+ function modulo(x, y) {
+ x = x | 0;
+ y = y | 0;
+ return ((x | 0) % (y | 0)) | 0;
+ }
+
+ function unsignedModulo(x, y) {
+ x = x | 0;
+ y = y | 0;
+ return ((x >>> 0) % (y >>> 0)) | 0;
+ }
+
+ function bitNot(x) {
+ x = x | 0;
+ return ~x;
+ }
+
+ function bitOr(x, y) {
+ x = x | 0;
+ y = y | 0;
+ return x | y;
+ }
+
+ function bitAnd(x, y) {
+ x = x | 0;
+ y = y | 0;
+ return x & y;
+ }
+
+ function bitXor(x, y) {
+ x = x | 0;
+ y = y | 0;
+ return x ^ y;
+ }
+
+ function leftShift(x, y) {
+ x = x | 0;
+ y = y | 0;
+ return x << y;
+ }
+
+ function arithmeticRightShift(x, y) {
+ x = x | 0;
+ y = y | 0;
+ return x >> y;
+ }
+
+ function logicalRightShift(x, y) {
+ x = x | 0;
+ y = y | 0;
+ return x >>> y;
+ }
+
+ function countLeadingZeros(x) {
+ x = x | 0;
+ return clz32(x);
+ }
+
+ function logicalNot(x) {
+ x = x | 0;
+ return (!x) | 0;
+ }
+
+ function absolute(x) {
+ x = x | 0;
+ return abs(x | 0);
+ }
+
+ return {
+ negate: negate,
+ add: add,
+ subtract: subtract,
+ multiply: multiply,
+ divide: divide,
+ unsignedDivide: unsignedDivide,
+ modulo: modulo,
+ unsignedModulo: unsignedModulo,
+ bitNot: bitNot,
+ bitOr: bitOr,
+ bitAnd: bitAnd,
+ bitXor: bitXor,
+ leftShift: leftShift,
+ arithmeticRightShift: arithmeticRightShift,
+ logicalRightShift: logicalRightShift,
+ countLeadingZeros: countLeadingZeros,
+ logicalNot: logicalNot,
+ absolute: absolute,
+ };
+}
+*/
+
+var module = loadWebAssembly("wasm/arithmetic-int32.wasm");
+
+shouldBe(module.negate(42), -42);
+shouldBe(module.add(1, 2), 3);
+shouldBe(module.add(2147483647, 1), -2147483648);
+shouldBe(module.subtract(1, 2), -1);
+shouldBe(module.multiply(2, 3), 6);
+shouldBe(module.multiply(-2147483648, -1), -2147483648);
+shouldBe(module.divide(7, 3), 2);
+shouldThrow(() => {
+ module.divide(1, 0);
+}, "Error: Division by zero or division overflow.");
+shouldThrow(() => {
+ module.divide(-2147483648, -1);
+}, "Error: Division by zero or division overflow.");
+shouldBe(module.unsignedDivide(-1, 2), 2147483647);
+shouldThrow(() => {
+ module.unsignedDivide(-1, 0);
+}, "Error: Division by zero or division overflow.");
+shouldBe(module.modulo(7, 3), 1);
+shouldBe(module.modulo(-7, 3), -1);
+shouldThrow(() => {
+ module.modulo(1, 0);
+}, "Error: Division by zero or division overflow.");
+shouldThrow(() => {
+ module.modulo(-2147483648, -1);
+}, "Error: Division by zero or division overflow.");
+shouldBe(module.unsignedModulo(-1, 100000), 67295);
+shouldThrow(() => {
+ module.unsignedModulo(-1, 0);
+}, "Error: Division by zero or division overflow.");
+shouldBe(module.bitNot(1), -2);
+shouldBe(module.bitOr(3, 5), 7);
+shouldBe(module.bitAnd(3, 5), 1);
+shouldBe(module.bitXor(3, 5), 6);
+shouldBe(module.leftShift(1, 16), 65536);
+shouldBe(module.arithmeticRightShift(-1, 16), -1);
+shouldBe(module.logicalRightShift(-1, 16), 65535);
+shouldBe(module.countLeadingZeros(42), 26);
+shouldBe(module.countLeadingZeros(0), 32);
+shouldBe(module.logicalNot(42), 0);
+shouldBe(module.logicalNot(0), 1);
+shouldBe(module.absolute(-42), 42);
+shouldBe(module.absolute(42), 42);
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstresswasmarithmeticjs"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/tests/stress/wasm-arithmetic.js (189531 => 189532)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/wasm-arithmetic.js        2015-09-09 04:02:24 UTC (rev 189531)
+++ trunk/Source/JavaScriptCore/tests/stress/wasm-arithmetic.js        2015-09-09 04:19:01 UTC (rev 189532)
</span><span class="lines">@@ -1,252 +0,0 @@
</span><del>-//@ skip
-
-function shouldBe(actual, expected) {
- if (actual !== expected)
- throw new Error('bad value: ' + actual);
-}
-
-function shouldThrow(func, message) {
- var error = null;
- try {
- func();
- } catch (e) {
- error = e;
- }
- if (!error)
- throw new Error("not thrown.");
- if (String(error) !== message)
- throw new Error("bad error: " + String(error));
-}
-
-/*
-wasm/arithmetic.wasm is generated by pack-asmjs <https://github.com/WebAssembly/polyfill-prototype-1> from the following script:
-
-function asmModule(global, env, buffer) {
- "use asm";
-
- var clz32 = global.Math.clz32;
- var abs = global.Math.abs;
-
- function negate() {
- var x = 0;
- x = 42;
- return -x;
- }
-
- function addSubtract() {
- return ((10 + 40) - 8) | 0;
- }
-
- function addOverflow() {
- return (2147483647 + 1) | 0;
- }
-
- function multiply() {
- return (6 * 7) | 0;
- }
-
- function multiplyOverflow() {
- return (-2147483648 * -1) | 0;
- }
-
- function divide() {
- return (42 / 5) | 0;
- }
-
- function divideByZero() {
- return (1 / 0) | 0;
- }
-
- function divideOverflow() {
- return (-2147483648 / -1) | 0;
- }
-
- function unsignedDivide() {
- return ((-1 >>> 0) / 2) | 0;
- }
-
- function unsignedDivideByZero() {
- return ((-1 >>> 0) / 0) | 0;
- }
-
- function modulo() {
- return (42 % 5) | 0;
- }
-
- function moduloNegative() {
- return (-42 % 5) | 0;
- }
-
- function moduloZero() {
- return (1 % 0) | 0;
- }
-
- function moduloOverflow() {
- return (-2147483648 % -1) | 0;
- }
-
- function unsignedModulo() {
- return ((-1 >>> 0) % 100000) | 0;
- }
-
- function unsignedModuloZero() {
- return ((-1 >>> 0) % 0) | 0;
- }
-
- function bitNot() {
- return ~1;
- }
-
- function bitOr() {
- return 3 | 5;
- }
-
- function bitAnd() {
- return 3 & 5;
- }
-
- function bitXor() {
- return 3 ^ 5;
- }
-
- function leftShift() {
- return 1 << 16;
- }
-
- function arithmeticRightShift() {
- return (-1) >> 16;
- }
-
- function logicalRightShift() {
- return (-1) >>> 16;
- }
-
- function countLeadingZeros() {
- return clz32(42);
- }
-
- function countLeadingZerosOfZero() {
- return clz32(0);
- }
-
- function logicalNotNonZero() {
- return (!42) | 0;
- }
-
- function logicalNotZero() {
- return (!0) | 0;
- }
-
- function absoluteNegative() {
- return abs(-42);
- }
-
- function absolutePositive() {
- return abs(42);
- }
-
- return {
- negate: negate,
- addSubtract: addSubtract,
- addOverflow: addOverflow,
- multiply: multiply,
- multiplyOverflow: multiplyOverflow,
- divide: divide,
- divideByZero: divideByZero,
- divideOverflow: divideOverflow,
- unsignedDivide: unsignedDivide,
- unsignedDivideByZero: unsignedDivideByZero,
- modulo: modulo,
- moduloNegative: moduloNegative,
- moduloZero: moduloZero,
- moduloOverflow: moduloOverflow,
- unsignedModulo: unsignedModulo,
- unsignedModuloZero: unsignedModuloZero,
- bitNot: bitNot,
- bitOr: bitOr,
- bitAnd: bitAnd,
- bitXor: bitXor,
- leftShift: leftShift,
- arithmeticRightShift: arithmeticRightShift,
- logicalRightShift: logicalRightShift,
- countLeadingZeros: countLeadingZeros,
- countLeadingZerosOfZero: countLeadingZerosOfZero,
- logicalNotNonZero: logicalNotNonZero,
- logicalNotZero: logicalNotZero,
- absoluteNegative: absoluteNegative,
- absolutePositive: absolutePositive,
- };
-}
-*/
-
-var module = loadWebAssembly("wasm/arithmetic.wasm");
-
-shouldBe(module.negate(), -42);
-
-shouldBe(module.addSubtract(), 42);
-
-shouldBe(module.addOverflow(), -2147483648);
-
-shouldBe(module.multiply(), 42);
-
-shouldBe(module.multiplyOverflow(), -2147483648);
-
-shouldBe(module.divide(), 8);
-
-shouldThrow(() => {
- module.divideByZero();
-}, "Error: Division by zero or division overflow.");
-
-shouldThrow(() => {
- module.divideOverflow();
-}, "Error: Division by zero or division overflow.");
-
-shouldBe(module.unsignedDivide(), 2147483647);
-
-shouldThrow(() => {
- module.unsignedDivideByZero();
-}, "Error: Division by zero or division overflow.");
-
-shouldBe(module.modulo(), 2);
-
-shouldBe(module.moduloNegative(), -2);
-
-shouldThrow(() => {
- module.moduloZero();
-}, "Error: Division by zero or division overflow.");
-
-shouldThrow(() => {
- module.moduloOverflow();
-}, "Error: Division by zero or division overflow.");
-
-shouldBe(module.unsignedModulo(), 67295);
-
-shouldThrow(() => {
- module.unsignedModuloZero();
-}, "Error: Division by zero or division overflow.");
-
-shouldBe(module.bitNot(), -2);
-
-shouldBe(module.bitOr(), 7);
-
-shouldBe(module.bitAnd(), 1);
-
-shouldBe(module.bitXor(), 6);
-
-shouldBe(module.leftShift(), 65536);
-
-shouldBe(module.arithmeticRightShift(), -1);
-
-shouldBe(module.logicalRightShift(), 65535);
-
-shouldBe(module.countLeadingZeros(), 26);
-
-shouldBe(module.countLeadingZerosOfZero(), 32);
-
-shouldBe(module.logicalNotNonZero(), 0);
-
-shouldBe(module.logicalNotZero(), 1);
-
-shouldBe(module.absoluteNegative(), 42);
-
-shouldBe(module.absolutePositive(), 42);
</del></span></pre>
</div>
</div>
</body>
</html>