<!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>[192664] 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/192664">192664</a></dd>
<dt>Author</dt> <dd>mark.lam@apple.com</dd>
<dt>Date</dt> <dd>2015-11-19 15:32:09 -0800 (Thu, 19 Nov 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Create correctness tests for binary snippet operators.
https://bugs.webkit.org/show_bug.cgi?id=151465

Reviewed by Geoffrey Garen.

Implement a common infrastructure for generating and running tests on binary
operators.  Also re-implemented the op_add, op_sub, and op_mul tests to be based
on this new infrastructure.

* tests/stress/op_add.js:
* tests/stress/op_mul.js:
* tests/stress/op_sub.js:
- These were reimplemented using binary-op-test.js.

* tests/stress/op_div.js: Added.
* tests/stress/op_mod.js: Added.

* tests/stress/op_bitand.js: Added.
* tests/stress/op_bitor.js: Added.
* tests/stress/op_bitxor.js: Added.

* tests/stress/op_lshift.js: Added.
* tests/stress/op_rshift.js: Added.
* tests/stress/op_urshift.js: Added.

* tests/stress/resources/binary-op-test.js: Added.
- Common code for generating and running tests.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressop_addjs">trunk/Source/JavaScriptCore/tests/stress/op_add.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressop_muljs">trunk/Source/JavaScriptCore/tests/stress/op_mul.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressop_subjs">trunk/Source/JavaScriptCore/tests/stress/op_sub.js</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoretestsstressop_bitandjs">trunk/Source/JavaScriptCore/tests/stress/op_bitand.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressop_bitorjs">trunk/Source/JavaScriptCore/tests/stress/op_bitor.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressop_bitxorjs">trunk/Source/JavaScriptCore/tests/stress/op_bitxor.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressop_divjs">trunk/Source/JavaScriptCore/tests/stress/op_div.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressop_lshiftjs">trunk/Source/JavaScriptCore/tests/stress/op_lshift.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressop_modjs">trunk/Source/JavaScriptCore/tests/stress/op_mod.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressop_rshiftjs">trunk/Source/JavaScriptCore/tests/stress/op_rshift.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressop_urshiftjs">trunk/Source/JavaScriptCore/tests/stress/op_urshift.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressresourcesbinaryoptestjs">trunk/Source/JavaScriptCore/tests/stress/resources/binary-op-test.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (192663 => 192664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-11-19 23:14:55 UTC (rev 192663)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-11-19 23:32:09 UTC (rev 192664)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2015-11-19  Mark Lam  &lt;mark.lam@apple.com&gt;
+
+        Create correctness tests for binary snippet operators.
+        https://bugs.webkit.org/show_bug.cgi?id=151465
+
+        Reviewed by Geoffrey Garen.
+
+        Implement a common infrastructure for generating and running tests on binary
+        operators.  Also re-implemented the op_add, op_sub, and op_mul tests to be based
+        on this new infrastructure.
+
+        * tests/stress/op_add.js:
+        * tests/stress/op_mul.js:
+        * tests/stress/op_sub.js:
+        - These were reimplemented using binary-op-test.js.
+
+        * tests/stress/op_div.js: Added.
+        * tests/stress/op_mod.js: Added.
+
+        * tests/stress/op_bitand.js: Added.
+        * tests/stress/op_bitor.js: Added.
+        * tests/stress/op_bitxor.js: Added.
+
+        * tests/stress/op_lshift.js: Added.
+        * tests/stress/op_rshift.js: Added.
+        * tests/stress/op_urshift.js: Added.
+
+        * tests/stress/resources/binary-op-test.js: Added.
+        - Common code for generating and running tests.
+
</ins><span class="cx"> 2015-11-19  Caitlin Potter  &lt;caitp@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [JSC] Fix AssignmentElement parsing
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressop_addjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/tests/stress/op_add.js (192663 => 192664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/op_add.js        2015-11-19 23:14:55 UTC (rev 192663)
+++ trunk/Source/JavaScriptCore/tests/stress/op_add.js        2015-11-19 23:32:09 UTC (rev 192664)
</span><span class="lines">@@ -1,363 +1,63 @@
</span><span class="cx"> //@ runFTLNoCJIT
</span><span class="cx"> 
</span><del>-// This test module aims to test the addition operator by comparing its runtime
-// behavior (using the different tiers) with expected values computed at initialization
-// time using the LLINT / bytecode generator.
-//
-// It works by generating test scenarios from permutations of value pairs to exercise
-// the addition operator. It computes the expected results by evaluating an expression
-// to add the values in an initialization pass. The scenarios are later applied to
-// a set of test functions of the forms:
-//
-//     variable + variable
-//     constant + variable
-//     variable + constant
-//
-// See generateScenarios() and initializeTestCases() for details on how the test
-// cases are generated.
-//
</del><span class="cx"> // If all goes well, this test module will terminate silently. If not, it will print
</span><del>-// errors.
</del><ins>+// errors. See binary-op-test.js for debugging options if needed.
</ins><span class="cx"> 
</span><del>-var verbose = false;
-var abortOnFirstFail = false;
</del><ins>+load(&quot;./resources/binary-op-test.js&quot;);
</ins><span class="cx"> 
</span><ins>+//============================================================================
+// Test configuration data:
+
+var opName = &quot;add&quot;;
+var op = &quot;+&quot;;
+
</ins><span class="cx"> var o1 = {
</span><span class="cx">     valueOf: function() { return 10; }
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-var set1 = [
</del><ins>+var posInfinity = 1 / 0;
+var negInfinity = -1 / 0;
+
+var values = [
</ins><span class="cx">     'o1',
</span><span class="cx">     'null',
</span><span class="cx">     'undefined',
</span><del>-    'NaN',
-    '&quot;abc&quot;',
-];
-
-var set2 = [
-    '10',
-    '-10',
-    '2147483647',
-    '-2147483647',
-    '4294967296',
-    '-4294967296',
-    '100.2',
-    '-100.2',
</del><span class="cx">     'true',
</span><span class="cx">     'false',
</span><del>-];
</del><span class="cx"> 
</span><del>-// Assemble the values that we'll be testing with:
-var values = [];
-for (var i = 0; i &lt; set1.length; i++)
-    values.push(set1[i]);
-for (var i = 0; i &lt; set2.length; i++)
-    values.push(set2[i]);
-for (var i = 0; i &lt; set2.length; i++)
-    values.push('&quot;' + set2[i] + '&quot;');
</del><ins>+    'NaN',
+    'posInfinity',
+    'negInfinity',
+    '100.2', // Some random small double value.
+    '-100.2',
+    '54294967296.2923', // Some random large double value.
+    '-54294967296.2923',
</ins><span class="cx"> 
</span><del>-function generateScenarios(xvalues, yvalues) {
-    var scenarios = [];
-    for (var i = 0; i &lt; xvalues.length; i++) {
-        for (var j = 0; j &lt; yvalues.length; j++) {
-            var xStr = xvalues[i];
-            var yStr = yvalues[j];
-            var x = eval(xStr);
-            var y = eval(yStr);
-            var name = &quot;(&quot; + xStr + &quot; + &quot; + yStr + &quot;)&quot;;
-            var expected = eval(&quot;&quot; + xStr + &quot; + &quot; + yStr);
-            var scenario = { name: name, x: x, y: y, expected: expected };
</del><ins>+    '0',
+    '-0',
+    '1',
+    '-1',
+    '0x3fff',
+    '-0x3fff',
+    '0x7fff',
+    '-0x7fff',
+    '0x10000',
+    '-0x10000',
+    '0x7ffffff',
+    '-0x7ffffff',
+    '0x100000000',
+    '-0x100000000',
</ins><span class="cx"> 
</span><del>-            scenarios.push(scenario);
-        }
-    }
-    return scenarios;
-}
-
-function printScenarios(scenarios) {
-    for (var i = 0; i &lt; scenarios.length; i++) {
-        var scenario = scenarios[i];
-        print(&quot;scenario[&quot; + i + &quot;]: { name: &quot; + scenario.name + &quot;, x: &quot; + scenario.x, &quot;, y: &quot; + scenario.y + &quot;, expected: &quot; + scenario.expected + &quot; }&quot;);
-    }
-}
-
-var testCases = [
-    {
-        name: &quot;add&quot;,
-        func: function(x, y) { return x + y; },
-        xvalues: values,
-        yvalues: values
-    },
-    {
-        name: &quot;addI32V&quot;,
-        func: function(x, y) { return 10 + y; },
-        xvalues: [ '10' ],
-        yvalues: values
-    },
-    {
-        name: &quot;addVI32&quot;,
-        func: function(x, y) { return x + 10; },
-        xvalues: values,
-        yvalues: [ '10' ]
-    },
-    {
-        name: &quot;addI32oV&quot;,
-        func: function(x, y) { return 2147483647 + y; },
-        xvalues: [ '2147483647' ],
-        yvalues: values
-    },
-    {
-        name: &quot;addVI32o&quot;,
-        func: function(x, y) { return x + 2147483647; },
-        xvalues: values,
-        yvalues: [ '2147483647' ]
-    },
-    {
-        name: &quot;addI32onV&quot;,
-        func: function(x, y) { return -2147483647 + y; },
-        xvalues: [ '-2147483647' ],
-        yvalues: values
-    },
-    {
-        name: &quot;addVI32on&quot;,
-        func: function(x, y) { return x + (-2147483647); },
-        xvalues: values,
-        yvalues: [ '-2147483647' ]
-    },
-    {
-        name: &quot;addI52V&quot;,
-        func: function(x, y) { return 4294967296 + y; },
-        xvalues: [ '4294967296' ],
-        yvalues: values
-    },
-    {
-        name: &quot;addVI52&quot;,
-        func: function(x, y) { return x + 4294967296; },
-        xvalues: values,
-        yvalues: [ '4294967296' ]
-    },
-    {
-        name: &quot;addI52nV&quot;,
-        func: function(x, y) { return -4294967296 + y; },
-        xvalues: [ '-4294967296' ],
-        yvalues: values
-    },
-    {
-        name: &quot;addVI52n&quot;,
-        func: function(x, y) { return x + (-4294967296); },
-        xvalues: values,
-        yvalues: [ '-4294967296' ]
-    },
-    {
-        name: &quot;addDV&quot;,
-        func: function(x, y) { return 100.2 + y; },
-        xvalues: [ '100.2' ],
-        yvalues: values
-    },
-    {
-        name: &quot;addVD&quot;,
-        func: function(x, y) { return x + 100.2; },
-        xvalues: values,
-        yvalues: [ '100.2' ]
-    },
-    {
-        name: &quot;addBV&quot;,
-        func: function(x, y) { return true + y; },
-        xvalues: [ 'true' ],
-        yvalues: values
-    },
-    {
-        name: &quot;addVB&quot;,
-        func: function(x, y) { return x + true; },
-        xvalues: values,
-        yvalues: [ 'true' ]
-    },
-    {
-        name: &quot;addSi32V&quot;,
-        func: function(x, y) { return &quot;10&quot; + y; },
-        xvalues: [ '&quot;10&quot;' ],
-        yvalues: values
-    },
-    {
-        name: &quot;addVSi32&quot;,
-        func: function(x, y) { return x + &quot;10&quot;; },
-        xvalues: values,
-        yvalues: [ '&quot;10&quot;' ]
-    },
-
-    {
-        name: &quot;addSi32oV&quot;,
-        func: function(x, y) { return &quot;2147483647&quot; + y; },
-        xvalues: [ '&quot;2147483647&quot;' ],
-        yvalues: values
-    },
-    {
-        name: &quot;addVSi32o&quot;,
-        func: function(x, y) { return x + &quot;2147483647&quot;; },
-        xvalues: values,
-        yvalues: [ '&quot;2147483647&quot;' ]
-    },
-    {
-        name: &quot;addSi32onV&quot;,
-        func: function(x, y) { return &quot;-2147483647&quot; + y; },
-        xvalues: [ '&quot;-2147483647&quot;' ],
-        yvalues: values
-    },
-    {
-        name: &quot;addVSi32on&quot;,
-        func: function(x, y) { return x + &quot;-2147483647&quot;; },
-        xvalues: values,
-        yvalues: [ '&quot;-2147483647&quot;' ]
-    },
-    {
-        name: &quot;addSi52V&quot;,
-        func: function(x, y) { return &quot;4294967296&quot; + y; },
-        xvalues: [ '&quot;4294967296&quot;' ],
-        yvalues: values
-    },
-    {
-        name: &quot;addVSi52&quot;,
-        func: function(x, y) { return x + &quot;4294967296&quot;; },
-        xvalues: values,
-        yvalues: [ '&quot;4294967296&quot;' ]
-    },
-    {
-        name: &quot;addSi52nV&quot;,
-        func: function(x, y) { return &quot;-4294967296&quot; + y; },
-        xvalues: [ '&quot;-4294967296&quot;' ],
-        yvalues: values
-    },
-    {
-        name: &quot;addVSi52n&quot;,
-        func: function(x, y) { return x + &quot;-4294967296&quot;; },
-        xvalues: values,
-        yvalues: [ '&quot;-4294967296&quot;' ]
-    },
-    {
-        name: &quot;addSdV&quot;,
-        func: function(x, y) { return &quot;100.2&quot; + y; },
-        xvalues: [ '&quot;100.2&quot;' ],
-        yvalues: values
-    },
-    {
-        name: &quot;addVSd&quot;,
-        func: function(x, y) { return x + &quot;100.2&quot;; },
-        xvalues: values,
-        yvalues: [ '&quot;100.2&quot;' ]
-    },
-    {
-        name: &quot;addSbV&quot;,
-        func: function(x, y) { return &quot;true&quot; + y; },
-        xvalues: [ '&quot;true&quot;' ],
-        yvalues: values
-    },
-    {
-        name: &quot;addVSb&quot;,
-        func: function(x, y) { return x + &quot;true&quot;; },
-        xvalues: values,
-        yvalues: [ '&quot;true&quot;' ]
-    },
-
-    {
-        name: &quot;addSV&quot;,
-        func: function(x, y) { return &quot;abc&quot; + y; },
-        xvalues: [ '&quot;abc&quot;' ],
-        yvalues: values
-    },
-    {
-        name: &quot;addVS&quot;,
-        func: function(x, y) { return x + &quot;abc&quot;; },
-        xvalues: values,
-        yvalues: [ '&quot;abc&quot;' ]
-    },
-    {
-        name: &quot;addNV&quot;,
-        func: function(x, y) { return null + y; },
-        xvalues: [ 'null' ],
-        yvalues: values
-    },
-    {
-        name: &quot;addVN&quot;,
-        func: function(x, y) { return x + null; },
-        xvalues: values,
-        yvalues: [ 'null' ]
-    },
-    {
-        name: &quot;addOV&quot;,
-        func: function(x, y) { return o1 + y; },
-        xvalues: [ 'o1' ],
-        yvalues: values
-    },
-    {
-        name: &quot;addVO&quot;,
-        func: function(x, y) { return x + o1; },
-        xvalues: values,
-        yvalues: [ 'o1' ]
-    },
-    {
-        name: &quot;addNaNV&quot;,
-        func: function(x, y) { return NaN + y; },
-        xvalues: [ 'NaN' ],
-        yvalues: values
-    },
-    {
-        name: &quot;addVNaN&quot;,
-        func: function(x, y) { return x + NaN; },
-        xvalues: values,
-        yvalues: [ 'NaN' ]
-    },
</del><ins>+    '&quot;abc&quot;',
+    '&quot;0&quot;',
+    '&quot;-0&quot;',
+    '&quot;1&quot;',
+    '&quot;-1&quot;',
</ins><span class="cx"> ];
</span><span class="cx"> 
</span><del>-function initializeTestCases() {
-    for (var test of testCases) {
-        noInline(test.func);
-        test.scenarios = generateScenarios(test.xvalues, test.yvalues);
-    }
-}
-initializeTestCases();
</del><ins>+tests = [];
+generateBinaryTests(tests, opName, op, &quot;VarVar&quot;, values, values);
+generateBinaryTests(tests, opName, op, &quot;VarConst&quot;, values, values);
+generateBinaryTests(tests, opName, op, &quot;ConstVar&quot;, values, values);
</ins><span class="cx"> 
</span><del>-var errorReport = &quot;&quot;;
-
-function stringifyIfNeeded(x) {
-    if (typeof x == &quot;string&quot;)
-        return '&quot;' + x + '&quot;';
-    return x;
-}
-
-function runTest(test) {
-    var failedScenario = [];
-    var scenarios = test.scenarios;
-    var testFunc = test.func;
-    try {
-        for (var i = 0; i &lt; 10000; i++) {
-            for (var scenarioID = 0; scenarioID &lt; scenarios.length; scenarioID++) {
-                var scenario = scenarios[scenarioID];
-                if (verbose)
-                    print(&quot;Testing &quot; + test.name + &quot;:&quot; + scenario.name + &quot; on iteration &quot; + i + &quot;: expecting &quot; + stringifyIfNeeded(scenario.expected)); 
-
-                var result = testFunc(scenario.x, scenario.y);
-                if (result == scenario.expected)
-                    continue;
-                if (Number.isNaN(result) &amp;&amp; Number.isNaN(scenario.expected))
-                    continue;
-                if (!failedScenario[scenarioID]) {
-                    errorReport += &quot;FAIL: &quot; + test.name + &quot;:&quot; + scenario.name + &quot; started failing on iteration &quot; + i
-                        + &quot;: expected &quot; + stringifyIfNeeded(scenario.expected) + &quot;, actual &quot; + stringifyIfNeeded(result) + &quot;\n&quot;;
-                    if (abortOnFirstFail)
-                        throw errorReport;
-                    failedScenario[scenarioID] = scenario;
-                }
-            }
-        }
-    } catch(e) {
-        if (abortOnFirstFail)
-            throw e; // Negate the catch by re-throwing.
-        errorReport += &quot;Unexpected exception: &quot; + e + &quot;\n&quot;;
-    }
-}
-
-for (var test of testCases)
-    runTest(test);
-
-if (errorReport !== &quot;&quot;)
-    throw &quot;Error: bad result:\n&quot; + errorReport;
</del><ins>+run();
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressop_bitandjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/op_bitand.js (0 => 192664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/op_bitand.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/op_bitand.js        2015-11-19 23:32:09 UTC (rev 192664)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+//@ runFTLNoCJIT
+
+// If all goes well, this test module will terminate silently. If not, it will print
+// errors. See binary-op-test.js for debugging options if needed.
+
+load(&quot;./resources/binary-op-test.js&quot;);
+
+//============================================================================
+// Test configuration data:
+
+var opName = &quot;bitand&quot;;
+var op = &quot;&amp;&quot;;
+
+var o1 = {
+    valueOf: function() { return 10; }
+};
+
+var posInfinity = 1 / 0;
+var negInfinity = -1 / 0;
+
+var values = [
+    'o1',
+    'null',
+    'undefined',
+    'true',
+    'false',
+
+    'NaN',
+    'posInfinity',
+    'negInfinity',
+    '100.2', // Some random small double value.
+    '-100.2',
+    '54294967296.2923', // Some random large double value.
+    '-54294967296.2923',
+
+    '0',
+    '-0',
+    '1',
+    '-1',
+    '0x3fff',
+    '-0x3fff',
+    '0x7fff',
+    '-0x7fff',
+    '0x10000',
+    '-0x10000',
+    '0x7ffffff',
+    '-0x7ffffff',
+    '0xa5a5a5a5',
+    '0x100000000',
+    '-0x100000000',
+
+    '&quot;abc&quot;',
+    '&quot;0&quot;',
+    '&quot;-0&quot;',
+    '&quot;1&quot;',
+    '&quot;-1&quot;',
+    '&quot;0x7ffffff&quot;',
+    '&quot;-0x7ffffff&quot;',
+    '&quot;0xa5a5a5a5&quot;',
+    '&quot;0x100000000&quot;',
+    '&quot;-0x100000000&quot;',
+];
+
+tests = [];
+generateBinaryTests(tests, opName, op, &quot;VarVar&quot;, values, values);
+generateBinaryTests(tests, opName, op, &quot;VarConst&quot;, values, values);
+generateBinaryTests(tests, opName, op, &quot;ConstVar&quot;, values, values);
+
+run();
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressop_bitorjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/op_bitor.js (0 => 192664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/op_bitor.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/op_bitor.js        2015-11-19 23:32:09 UTC (rev 192664)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+//@ runFTLNoCJIT
+
+// If all goes well, this test module will terminate silently. If not, it will print
+// errors. See binary-op-test.js for debugging options if needed.
+
+load(&quot;./resources/binary-op-test.js&quot;);
+
+//============================================================================
+// Test configuration data:
+
+var opName = &quot;bitor&quot;;
+var op = &quot;|&quot;;
+
+var o1 = {
+    valueOf: function() { return 10; }
+};
+
+var posInfinity = 1 / 0;
+var negInfinity = -1 / 0;
+
+var values = [
+    'o1',
+    'null',
+    'undefined',
+    'true',
+    'false',
+
+    'NaN',
+    'posInfinity',
+    'negInfinity',
+    '100.2', // Some random small double value.
+    '-100.2',
+    '54294967296.2923', // Some random large double value.
+    '-54294967296.2923',
+
+    '0',
+    '-0',
+    '1',
+    '-1',
+    '0x3fff',
+    '-0x3fff',
+    '0x7fff',
+    '-0x7fff',
+    '0x10000',
+    '-0x10000',
+    '0x7ffffff',
+    '-0x7ffffff',
+    '0xa5a5a5a5',
+    '0x100000000',
+    '-0x100000000',
+
+    '&quot;abc&quot;',
+    '&quot;0&quot;',
+    '&quot;-0&quot;',
+    '&quot;1&quot;',
+    '&quot;-1&quot;',
+    '&quot;0x7ffffff&quot;',
+    '&quot;-0x7ffffff&quot;',
+    '&quot;0xa5a5a5a5&quot;',
+    '&quot;0x100000000&quot;',
+    '&quot;-0x100000000&quot;',
+];
+
+tests = [];
+generateBinaryTests(tests, opName, op, &quot;VarVar&quot;, values, values);
+generateBinaryTests(tests, opName, op, &quot;VarConst&quot;, values, values);
+generateBinaryTests(tests, opName, op, &quot;ConstVar&quot;, values, values);
+
+run();
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressop_bitxorjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/op_bitxor.js (0 => 192664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/op_bitxor.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/op_bitxor.js        2015-11-19 23:32:09 UTC (rev 192664)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+//@ runFTLNoCJIT
+
+// If all goes well, this test module will terminate silently. If not, it will print
+// errors. See binary-op-test.js for debugging options if needed.
+
+load(&quot;./resources/binary-op-test.js&quot;);
+
+//============================================================================
+// Test configuration data:
+
+var opName = &quot;bitxor&quot;;
+var op = &quot;^&quot;;
+
+var o1 = {
+    valueOf: function() { return 10; }
+};
+
+var posInfinity = 1 / 0;
+var negInfinity = -1 / 0;
+
+var values = [
+    'o1',
+    'null',
+    'undefined',
+    'true',
+    'false',
+
+    'NaN',
+    'posInfinity',
+    'negInfinity',
+    '100.2', // Some random small double value.
+    '-100.2',
+    '54294967296.2923', // Some random large double value.
+    '-54294967296.2923',
+
+    '0',
+    '-0',
+    '1',
+    '-1',
+    '0x3fff',
+    '-0x3fff',
+    '0x7fff',
+    '-0x7fff',
+    '0x10000',
+    '-0x10000',
+    '0x7ffffff',
+    '-0x7ffffff',
+    '0xa5a5a5a5',
+    '0x100000000',
+    '-0x100000000',
+
+    '&quot;abc&quot;',
+    '&quot;0&quot;',
+    '&quot;-0&quot;',
+    '&quot;1&quot;',
+    '&quot;-1&quot;',
+    '&quot;0x7ffffff&quot;',
+    '&quot;-0x7ffffff&quot;',
+    '&quot;0xa5a5a5a5&quot;',
+    '&quot;0x100000000&quot;',
+    '&quot;-0x100000000&quot;',
+];
+
+tests = [];
+generateBinaryTests(tests, opName, op, &quot;VarVar&quot;, values, values);
+generateBinaryTests(tests, opName, op, &quot;VarConst&quot;, values, values);
+generateBinaryTests(tests, opName, op, &quot;ConstVar&quot;, values, values);
+
+run();
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressop_divjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/op_div.js (0 => 192664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/op_div.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/op_div.js        2015-11-19 23:32:09 UTC (rev 192664)
</span><span class="lines">@@ -0,0 +1,73 @@
</span><ins>+//@ runFTLNoCJIT
+
+// If all goes well, this test module will terminate silently. If not, it will print
+// errors. See binary-op-test.js for debugging options if needed.
+
+load(&quot;./resources/binary-op-test.js&quot;);
+
+//============================================================================
+// Test configuration data:
+
+var opName = &quot;div&quot;;
+var op = &quot;/&quot;;
+
+var o1 = {
+    valueOf: function() { return 10; }
+};
+
+var posInfinity = 1 / 0;
+var negInfinity = -1 / 0;
+
+var values = [
+    'o1',
+    'null',
+    'undefined',
+    'true',
+    'false',
+
+    'NaN',
+    'posInfinity',
+    'negInfinity',
+    '100.2', // Some random small double value.
+    '-100.2',
+    '54294967296.2923', // Some random large double value.
+    '-54294967296.2923',
+
+    '0',
+    '-0',
+    '1',
+    '-1',
+    '0x3fff',
+    '-0x3fff',
+    '0x7fff',
+    '-0x7fff',
+    '0x10000',
+    '-0x10000',
+    '0x7ffffff',
+    '-0x7ffffff',
+    '0x100000000',
+    '-0x100000000',
+
+    '&quot;abc&quot;',
+    '&quot;0&quot;',
+    '&quot;-0&quot;',
+    '&quot;1&quot;',
+    '&quot;-1&quot;',
+    '&quot;0x3fff&quot;',
+    '&quot;-0x3fff&quot;',
+    '&quot;0x7fff&quot;',
+    '&quot;-0x7fff&quot;',
+    '&quot;0x10000&quot;',
+    '&quot;-0x10000&quot;',
+    '&quot;0x7ffffff&quot;',
+    '&quot;-0x7ffffff&quot;',
+    '&quot;0x100000000&quot;',
+    '&quot;-0x100000000&quot;',
+];
+
+tests = [];
+generateBinaryTests(tests, opName, op, &quot;VarVar&quot;, values, values);
+generateBinaryTests(tests, opName, op, &quot;VarConst&quot;, values, values);
+generateBinaryTests(tests, opName, op, &quot;ConstVar&quot;, values, values);
+
+run();
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressop_lshiftjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/op_lshift.js (0 => 192664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/op_lshift.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/op_lshift.js        2015-11-19 23:32:09 UTC (rev 192664)
</span><span class="lines">@@ -0,0 +1,77 @@
</span><ins>+//@ runFTLNoCJIT
+
+// If all goes well, this test module will terminate silently. If not, it will print
+// errors. See binary-op-test.js for debugging options if needed.
+
+load(&quot;./resources/binary-op-test.js&quot;);
+
+//============================================================================
+// Test configuration data:
+
+var opName = &quot;lshift&quot;;
+var op = &quot;&lt;&lt;&quot;;
+
+var o1 = {
+    valueOf: function() { return 10; }
+};
+
+var posInfinity = 1 / 0;
+var negInfinity = -1 / 0;
+
+var values = [
+    'o1',
+    'null',
+    'undefined',
+    'true',
+    'false',
+
+    'NaN',
+    'posInfinity',
+    'negInfinity',
+    '100.2', // Some random small double value.
+    '-100.2',
+    '54294967296.2923', // Some random large double value.
+    '-54294967296.2923',
+
+    '0',
+    '-0',
+    '1',
+    '-1',
+    '5',
+    '-5',
+    '31',
+    '-31',
+    '32',
+    '-32',
+    '0x3fff',
+    '-0x3fff',
+    '0x7fff',
+    '-0x7fff',
+    '0x10000',
+    '-0x10000',
+    '0x7ffffff',
+    '-0x7ffffff',
+    '0x100000000',
+    '-0x100000000',
+
+    '&quot;abc&quot;',
+    '&quot;0&quot;',
+    '&quot;-0&quot;',
+    '&quot;1&quot;',
+    '&quot;-1&quot;',
+    '&quot;5&quot;',
+    '&quot;-5&quot;',
+    '&quot;31&quot;',
+    '&quot;-31&quot;',
+    '&quot;32&quot;',
+    '&quot;-32&quot;',
+    '&quot;0x3fff&quot;',
+    '&quot;-0x3fff&quot;',
+];
+
+tests = [];
+generateBinaryTests(tests, opName, op, &quot;VarVar&quot;, values, values);
+generateBinaryTests(tests, opName, op, &quot;VarConst&quot;, values, values);
+generateBinaryTests(tests, opName, op, &quot;ConstVar&quot;, values, values);
+
+run();
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressop_modjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/op_mod.js (0 => 192664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/op_mod.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/op_mod.js        2015-11-19 23:32:09 UTC (rev 192664)
</span><span class="lines">@@ -0,0 +1,73 @@
</span><ins>+//@ runFTLNoCJIT
+
+// If all goes well, this test module will terminate silently. If not, it will print
+// errors. See binary-op-test.js for debugging options if needed.
+
+load(&quot;./resources/binary-op-test.js&quot;);
+
+//============================================================================
+// Test configuration data:
+
+var opName = &quot;mod&quot;;
+var op = &quot;%&quot;;
+
+var o1 = {
+    valueOf: function() { return 10; }
+};
+
+var posInfinity = 1 / 0;
+var negInfinity = -1 / 0;
+
+var values = [
+    'o1',
+    'null',
+    'undefined',
+    'true',
+    'false',
+
+    'NaN',
+    'posInfinity',
+    'negInfinity',
+    '100.2', // Some random small double value.
+    '-100.2',
+    '54294967296.2923', // Some random large double value.
+    '-54294967296.2923',
+
+    '0',
+    '-0',
+    '1',
+    '-1',
+    '0x3fff',
+    '-0x3fff',
+    '0x7fff',
+    '-0x7fff',
+    '0x10000',
+    '-0x10000',
+    '0x7ffffff',
+    '-0x7ffffff',
+    '0x100000000',
+    '-0x100000000',
+
+    '&quot;abc&quot;',
+    '&quot;0&quot;',
+    '&quot;-0&quot;',
+    '&quot;1&quot;',
+    '&quot;-1&quot;',
+    '&quot;0x3fff&quot;',
+    '&quot;-0x3fff&quot;',
+    '&quot;0x7fff&quot;',
+    '&quot;-0x7fff&quot;',
+    '&quot;0x10000&quot;',
+    '&quot;-0x10000&quot;',
+    '&quot;0x7ffffff&quot;',
+    '&quot;-0x7ffffff&quot;',
+    '&quot;0x100000000&quot;',
+    '&quot;-0x100000000&quot;',
+];
+
+tests = [];
+generateBinaryTests(tests, opName, op, &quot;VarVar&quot;, values, values);
+generateBinaryTests(tests, opName, op, &quot;VarConst&quot;, values, values);
+generateBinaryTests(tests, opName, op, &quot;ConstVar&quot;, values, values);
+
+run();
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressop_muljs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/tests/stress/op_mul.js (192663 => 192664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/op_mul.js        2015-11-19 23:14:55 UTC (rev 192663)
+++ trunk/Source/JavaScriptCore/tests/stress/op_mul.js        2015-11-19 23:32:09 UTC (rev 192664)
</span><span class="lines">@@ -1,27 +1,16 @@
</span><span class="cx"> //@ runFTLNoCJIT
</span><span class="cx"> 
</span><del>-// This test module aims to test the multiplication operator by comparing its runtime
-// behavior (using the different tiers) with expected values computed at initialization
-// time using the LLINT / bytecode generator.
-//
-// It works by generating test scenarios from permutations of value pairs to exercise
-// the multiplication operator. It computes the expected results by evaluating an
-// expression to multiply the values in an initialization pass. The scenarios are later
-// applied to a set of test functions of the forms:
-//
-//     variable * variable
-//     constant * variable
-//     variable * constant
-//
-// See generateScenarios() and initializeTestCases() for details on how the test
-// cases are generated.
-//
</del><span class="cx"> // If all goes well, this test module will terminate silently. If not, it will print
</span><del>-// errors.
</del><ins>+// errors. See binary-op-test.js for debugging options if needed.
</ins><span class="cx"> 
</span><del>-var verbose = false;
-var abortOnFirstFail = false;
</del><ins>+load(&quot;./resources/binary-op-test.js&quot;);
</ins><span class="cx"> 
</span><ins>+//============================================================================
+// Test configuration data:
+
+var opName = &quot;mul&quot;;
+var op = &quot;*&quot;;
+
</ins><span class="cx"> var o1 = {
</span><span class="cx">     valueOf: function() { return 10; }
</span><span class="cx"> };
</span><span class="lines">@@ -29,17 +18,21 @@
</span><span class="cx"> var posInfinity = 1 / 0;
</span><span class="cx"> var negInfinity = -1 / 0;
</span><span class="cx"> 
</span><del>-var set1 = [
</del><ins>+var values = [
</ins><span class="cx">     'o1',
</span><span class="cx">     'null',
</span><span class="cx">     'undefined',
</span><ins>+    'true',
+    'false',
+
</ins><span class="cx">     'NaN',
</span><span class="cx">     'posInfinity',
</span><span class="cx">     'negInfinity',
</span><del>-    '&quot;abc&quot;',
-];
</del><ins>+    '100.2', // Some random small double value.
+    '-100.2',
+    '54294967296.2923', // Some random large double value.
+    '-54294967296.2923',
</ins><span class="cx"> 
</span><del>-var set2 = [
</del><span class="cx">     '0',
</span><span class="cx">     '-0',
</span><span class="cx">     '1',
</span><span class="lines">@@ -50,337 +43,31 @@
</span><span class="cx">     '-0x7fff',
</span><span class="cx">     '0x10000',
</span><span class="cx">     '-0x10000',
</span><del>-    '2147483647',
-    '-2147483647',
-    '4294967296',
-    '-4294967296',
-    '100.2',
-    '-100.2',
-    'true',
-    'false',
-];
</del><ins>+    '0x7ffffff',
+    '-0x7ffffff',
+    '0x100000000',
+    '-0x100000000',
</ins><span class="cx"> 
</span><del>-// Assemble the values that we'll be testing with:
-var values = [];
-for (var i = 0; i &lt; set1.length; i++)
-    values.push(set1[i]);
-for (var i = 0; i &lt; set2.length; i++)
-    values.push(set2[i]);
-for (var i = 0; i &lt; set2.length; i++)
-    values.push('&quot;' + set2[i] + '&quot;');
-
-function generateScenarios(xvalues, yvalues) {
-    var scenarios = [];
-    for (var i = 0; i &lt; xvalues.length; i++) {
-        for (var j = 0; j &lt; yvalues.length; j++) {
-            var xStr = xvalues[i];
-            var yStr = yvalues[j];
-            var x = eval(xStr);
-            var y = eval(yStr);
-            var name = &quot;(&quot; + xStr + &quot; * &quot; + yStr + &quot;)&quot;;
-            var expected = eval(&quot;&quot; + xStr + &quot; * &quot; + yStr);
-            var scenario = { name: name, x: x, y: y, expected: expected };
-
-            scenarios.push(scenario);
-        }
-    }
-    return scenarios;
-}
-
-function printScenarios(scenarios) {
-    for (var i = 0; i &lt; scenarios.length; i++) {
-        var scenario = scenarios[i];
-        print(&quot;scenario[&quot; + i + &quot;]: { name: &quot; + scenario.name + &quot;, x: &quot; + scenario.x, &quot;, y: &quot; + scenario.y + &quot;, expected: &quot; + scenario.expected + &quot; }&quot;);
-    }
-}
-
-var testCases = [
-    {
-        name: &quot;mul&quot;,
-        func: function(x, y) { return x * y; },
-        xvalues: values,
-        yvalues: values
-    },
-    {
-        name: &quot;mulI32V&quot;,
-        func: function(x, y) { return 1 * y; },
-        xvalues: [ '1' ],
-        yvalues: values
-    },
-    {
-        name: &quot;mulVI32&quot;,
-        func: function(x, y) { return x * 1; },
-        xvalues: values,
-        yvalues: [ '1' ]
-    },
-    {
-        name: &quot;mulI32oV&quot;,
-        func: function(x, y) { return 2147483647 * y; },
-        xvalues: [ '2147483647' ],
-        yvalues: values
-    },
-    {
-        name: &quot;mulVI32o&quot;,
-        func: function(x, y) { return x * 2147483647; },
-        xvalues: values,
-        yvalues: [ '2147483647' ]
-    },
-    {
-        name: &quot;mulI32onV&quot;,
-        func: function(x, y) { return -2147483647 * y; },
-        xvalues: [ '-2147483647' ],
-        yvalues: values
-    },
-    {
-        name: &quot;mulVI32on&quot;,
-        func: function(x, y) { return x * (-2147483647); },
-        xvalues: values,
-        yvalues: [ '-2147483647' ]
-    },
-    {
-        name: &quot;mulI52V&quot;,
-        func: function(x, y) { return 4294967296 * y; },
-        xvalues: [ '4294967296' ],
-        yvalues: values
-    },
-    {
-        name: &quot;mulVI52&quot;,
-        func: function(x, y) { return x * 4294967296; },
-        xvalues: values,
-        yvalues: [ '4294967296' ]
-    },
-    {
-        name: &quot;mulI52nV&quot;,
-        func: function(x, y) { return -4294967296 * y; },
-        xvalues: [ '-4294967296' ],
-        yvalues: values
-    },
-    {
-        name: &quot;mulVI52n&quot;,
-        func: function(x, y) { return x * (-4294967296); },
-        xvalues: values,
-        yvalues: [ '-4294967296' ]
-    },
-    {
-        name: &quot;mulDV&quot;,
-        func: function(x, y) { return 100.2 * y; },
-        xvalues: [ '100.2' ],
-        yvalues: values
-    },
-    {
-        name: &quot;mulVD&quot;,
-        func: function(x, y) { return x * 100.2; },
-        xvalues: values,
-        yvalues: [ '100.2' ]
-    },
-    {
-        name: &quot;mulBV&quot;,
-        func: function(x, y) { return true * y; },
-        xvalues: [ 'true' ],
-        yvalues: values
-    },
-    {
-        name: &quot;mulVB&quot;,
-        func: function(x, y) { return x * true; },
-        xvalues: values,
-        yvalues: [ 'true' ]
-    },
-    {
-        name: &quot;mulSi32V&quot;,
-        func: function(x, y) { return &quot;10&quot; * y; },
-        xvalues: [ '&quot;10&quot;' ],
-        yvalues: values
-    },
-    {
-        name: &quot;mulVSi32&quot;,
-        func: function(x, y) { return x * &quot;10&quot;; },
-        xvalues: values,
-        yvalues: [ '&quot;10&quot;' ]
-    },
-
-    {
-        name: &quot;mulSi32oV&quot;,
-        func: function(x, y) { return &quot;2147483647&quot; * y; },
-        xvalues: [ '&quot;2147483647&quot;' ],
-        yvalues: values
-    },
-    {
-        name: &quot;mulVSi32o&quot;,
-        func: function(x, y) { return x * &quot;2147483647&quot;; },
-        xvalues: values,
-        yvalues: [ '&quot;2147483647&quot;' ]
-    },
-    {
-        name: &quot;mulSi32onV&quot;,
-        func: function(x, y) { return &quot;-2147483647&quot; * y; },
-        xvalues: [ '&quot;-2147483647&quot;' ],
-        yvalues: values
-    },
-    {
-        name: &quot;mulVSi32on&quot;,
-        func: function(x, y) { return x * &quot;-2147483647&quot;; },
-        xvalues: values,
-        yvalues: [ '&quot;-2147483647&quot;' ]
-    },
-    {
-        name: &quot;mulSi52V&quot;,
-        func: function(x, y) { return &quot;4294967296&quot; * y; },
-        xvalues: [ '&quot;4294967296&quot;' ],
-        yvalues: values
-    },
-    {
-        name: &quot;mulVSi52&quot;,
-        func: function(x, y) { return x * &quot;4294967296&quot;; },
-        xvalues: values,
-        yvalues: [ '&quot;4294967296&quot;' ]
-    },
-    {
-        name: &quot;mulSi52nV&quot;,
-        func: function(x, y) { return &quot;-4294967296&quot; * y; },
-        xvalues: [ '&quot;-4294967296&quot;' ],
-        yvalues: values
-    },
-    {
-        name: &quot;mulVSi52n&quot;,
-        func: function(x, y) { return x * &quot;-4294967296&quot;; },
-        xvalues: values,
-        yvalues: [ '&quot;-4294967296&quot;' ]
-    },
-    {
-        name: &quot;mulSdV&quot;,
-        func: function(x, y) { return &quot;100.2&quot; * y; },
-        xvalues: [ '&quot;100.2&quot;' ],
-        yvalues: values
-    },
-    {
-        name: &quot;mulVSd&quot;,
-        func: function(x, y) { return x * &quot;100.2&quot;; },
-        xvalues: values,
-        yvalues: [ '&quot;100.2&quot;' ]
-    },
-    {
-        name: &quot;mulSbV&quot;,
-        func: function(x, y) { return &quot;true&quot; * y; },
-        xvalues: [ '&quot;true&quot;' ],
-        yvalues: values
-    },
-    {
-        name: &quot;mulVSb&quot;,
-        func: function(x, y) { return x * &quot;true&quot;; },
-        xvalues: values,
-        yvalues: [ '&quot;true&quot;' ]
-    },
-
-    {
-        name: &quot;mulSV&quot;,
-        func: function(x, y) { return &quot;abc&quot; * y; },
-        xvalues: [ '&quot;abc&quot;' ],
-        yvalues: values
-    },
-    {
-        name: &quot;mulVS&quot;,
-        func: function(x, y) { return x * &quot;abc&quot;; },
-        xvalues: values,
-        yvalues: [ '&quot;abc&quot;' ]
-    },
-    {
-        name: &quot;mulNV&quot;,
-        func: function(x, y) { return null * y; },
-        xvalues: [ 'null' ],
-        yvalues: values
-    },
-    {
-        name: &quot;mulVN&quot;,
-        func: function(x, y) { return x * null; },
-        xvalues: values,
-        yvalues: [ 'null' ]
-    },
-    {
-        name: &quot;mulOV&quot;,
-        func: function(x, y) { return o1 * y; },
-        xvalues: [ 'o1' ],
-        yvalues: values
-    },
-    {
-        name: &quot;mulVO&quot;,
-        func: function(x, y) { return x * o1; },
-        xvalues: values,
-        yvalues: [ 'o1' ]
-    },
-    {
-        name: &quot;mulNaNV&quot;,
-        func: function(x, y) { return NaN * y; },
-        xvalues: [ 'NaN' ],
-        yvalues: values
-    },
-    {
-        name: &quot;mulVNaN&quot;,
-        func: function(x, y) { return x * NaN; },
-        xvalues: values,
-        yvalues: [ 'NaN' ]
-    },
</del><ins>+    '&quot;abc&quot;',
+    '&quot;0&quot;',
+    '&quot;-0&quot;',
+    '&quot;1&quot;',
+    '&quot;-1&quot;',
+    '&quot;0x3fff&quot;',
+    '&quot;-0x3fff&quot;',
+    '&quot;0x7fff&quot;',
+    '&quot;-0x7fff&quot;',
+    '&quot;0x10000&quot;',
+    '&quot;-0x10000&quot;',
+    '&quot;0x7ffffff&quot;',
+    '&quot;-0x7ffffff&quot;',
+    '&quot;0x100000000&quot;',
+    '&quot;-0x100000000&quot;',
</ins><span class="cx"> ];
</span><span class="cx"> 
</span><del>-function initializeTestCases() {
-    for (var test of testCases) {
-        noInline(test.func);
-        test.scenarios = generateScenarios(test.xvalues, test.yvalues);
-    }
-}
-initializeTestCases();
</del><ins>+tests = [];
+generateBinaryTests(tests, opName, op, &quot;VarVar&quot;, values, values);
+generateBinaryTests(tests, opName, op, &quot;VarConst&quot;, values, values);
+generateBinaryTests(tests, opName, op, &quot;ConstVar&quot;, values, values);
</ins><span class="cx"> 
</span><del>-var errorReport = &quot;&quot;;
-
-function stringifyIfNeeded(x) {
-    if (typeof x == &quot;string&quot;)
-        return '&quot;' + x + '&quot;';
-    return x;
-}
-
-function isIdentical(x, y) {
-    if (x == y) {
-        if (x)
-            return true;
-        // Distinguish between 0 and negative 0.
-        if (1 / x == 1 / y)
-            return true;
-    } else if (Number.isNaN(x) &amp;&amp; Number.isNaN(y))
-        return true;
-    return false;
-}
-
-function runTest(test) {
-    var failedScenario = [];
-    var scenarios = test.scenarios;
-    var testFunc = test.func;
-    try {
-        for (var i = 0; i &lt; 10000; i++) {
-            for (var scenarioID = 0; scenarioID &lt; scenarios.length; scenarioID++) {
-                var scenario = scenarios[scenarioID];
-                if (verbose)
-                    print(&quot;Testing &quot; + test.name + &quot;:&quot; + scenario.name + &quot; on iteration &quot; + i + &quot;: expecting &quot; + stringifyIfNeeded(scenario.expected)); 
-
-                var result = testFunc(scenario.x, scenario.y);
-                if (isIdentical(result, scenario.expected))
-                    continue;
-                if (!failedScenario[scenarioID]) {
-                    errorReport += &quot;FAIL: &quot; + test.name + &quot;:&quot; + scenario.name + &quot; started failing on iteration &quot; + i
-                        + &quot;: expected &quot; + stringifyIfNeeded(scenario.expected) + &quot;, actual &quot; + stringifyIfNeeded(result) + &quot;\n&quot;;
-                    if (abortOnFirstFail)
-                        throw errorReport;
-                    failedScenario[scenarioID] = scenario;
-                }
-            }
-        }
-    } catch(e) {
-        if (abortOnFirstFail)
-            throw e; // Negate the catch by re-throwing.
-        errorReport += &quot;Unexpected exception: &quot; + e + &quot;\n&quot;;
-    }
-}
-
-for (var test of testCases)
-    runTest(test);
-
-if (errorReport !== &quot;&quot;)
-    throw &quot;Error: bad result:\n&quot; + errorReport;
</del><ins>+run();
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressop_rshiftjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/op_rshift.js (0 => 192664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/op_rshift.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/op_rshift.js        2015-11-19 23:32:09 UTC (rev 192664)
</span><span class="lines">@@ -0,0 +1,77 @@
</span><ins>+//@ runFTLNoCJIT
+
+// If all goes well, this test module will terminate silently. If not, it will print
+// errors. See binary-op-test.js for debugging options if needed.
+
+load(&quot;./resources/binary-op-test.js&quot;);
+
+//============================================================================
+// Test configuration data:
+
+var opName = &quot;rshift&quot;;
+var op = &quot;&gt;&gt;&quot;;
+
+var o1 = {
+    valueOf: function() { return 10; }
+};
+
+var posInfinity = 1 / 0;
+var negInfinity = -1 / 0;
+
+var values = [
+    'o1',
+    'null',
+    'undefined',
+    'true',
+    'false',
+
+    'NaN',
+    'posInfinity',
+    'negInfinity',
+    '100.2', // Some random small double value.
+    '-100.2',
+    '54294967296.2923', // Some random large double value.
+    '-54294967296.2923',
+
+    '0',
+    '-0',
+    '1',
+    '-1',
+    '5',
+    '-5',
+    '31',
+    '-31',
+    '32',
+    '-32',
+    '0x3fff',
+    '-0x3fff',
+    '0x7fff',
+    '-0x7fff',
+    '0x10000',
+    '-0x10000',
+    '0x7ffffff',
+    '-0x7ffffff',
+    '0x100000000',
+    '-0x100000000',
+
+    '&quot;abc&quot;',
+    '&quot;0&quot;',
+    '&quot;-0&quot;',
+    '&quot;1&quot;',
+    '&quot;-1&quot;',
+    '&quot;5&quot;',
+    '&quot;-5&quot;',
+    '&quot;31&quot;',
+    '&quot;-31&quot;',
+    '&quot;32&quot;',
+    '&quot;-32&quot;',
+    '&quot;0x3fff&quot;',
+    '&quot;-0x3fff&quot;',
+];
+
+tests = [];
+generateBinaryTests(tests, opName, op, &quot;VarVar&quot;, values, values);
+generateBinaryTests(tests, opName, op, &quot;VarConst&quot;, values, values);
+generateBinaryTests(tests, opName, op, &quot;ConstVar&quot;, values, values);
+
+run();
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressop_subjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/tests/stress/op_sub.js (192663 => 192664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/op_sub.js        2015-11-19 23:14:55 UTC (rev 192663)
+++ trunk/Source/JavaScriptCore/tests/stress/op_sub.js        2015-11-19 23:32:09 UTC (rev 192664)
</span><span class="lines">@@ -1,308 +1,73 @@
</span><span class="cx"> //@ runFTLNoCJIT
</span><span class="cx"> 
</span><del>-// This test module aims to test the subtraction operator by comparing its runtime
-// behavior (using the different tiers) with expected values computed at initialization
-// time using the LLINT / bytecode generator.
-//
-// It works by generating test scenarios from permutations of value pairs to exercise
-// the subtraction operator. It computes the expected results by evaluating an expression
-// to subtract the values in an initialization pass. The scenarios are later applied to
-// a set of test functions of the forms:
-//
-//     variable - variable
-//     constant - variable
-//     variable - constant
-//
-// See generateScenarios() and initializeTestCases() for details on how the test
-// cases are generated.
-//
</del><span class="cx"> // If all goes well, this test module will terminate silently. If not, it will print
</span><del>-// errors.
</del><ins>+// errors. See binary-op-test.js for debugging options if needed.
</ins><span class="cx"> 
</span><del>-var verbose = false;
-var abortOnFirstFail = false;
</del><ins>+load(&quot;./resources/binary-op-test.js&quot;);
</ins><span class="cx"> 
</span><ins>+//============================================================================
+// Test configuration data:
+
+var opName = &quot;sub&quot;;
+var op = &quot;-&quot;;
+
</ins><span class="cx"> var o1 = {
</span><span class="cx">     valueOf: function() { return 10; }
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-var set1 = [
</del><ins>+var posInfinity = 1 / 0;
+var negInfinity = -1 / 0;
+
+var values = [
</ins><span class="cx">     'o1',
</span><span class="cx">     'null',
</span><span class="cx">     'undefined',
</span><del>-    'NaN',
-    '&quot;abc&quot;',
-];
-
-var set2 = [
-    '10',
-    '-10',
-    '2147483647',
-    '-2147483647',
-    '4294967296',
-    '-4294967296',
-    '100.2',
-    '-100.2',
</del><span class="cx">     'true',
</span><span class="cx">     'false',
</span><del>-];
</del><span class="cx"> 
</span><del>-// Assemble the values that we'll be testing with:
-var values = [];
-for (var i = 0; i &lt; set1.length; i++)
-    values.push(set1[i]);
-for (var i = 0; i &lt; set2.length; i++)
-    values.push(set2[i]);
-for (var i = 0; i &lt; set2.length; i++)
-    values.push('&quot;' + set2[i] + '&quot;');
</del><ins>+    'NaN',
+    'posInfinity',
+    'negInfinity',
+    '100.2', // Some random small double value.
+    '-100.2',
+    '54294967296.2923', // Some random large double value.
+    '-54294967296.2923',
</ins><span class="cx"> 
</span><del>-function generateScenarios(xvalues, yvalues) {
-    var scenarios = [];
-    for (var i = 0; i &lt; xvalues.length; i++) {
-        for (var j = 0; j &lt; yvalues.length; j++) {
-            var xStr = xvalues[i];
-            var yStr = yvalues[j];
-            var x = eval(xStr);
-            var y = eval(yStr);
-            var name = &quot;(&quot; + xStr + &quot; - &quot; + yStr + &quot;)&quot;;
-            var expected = eval(&quot;&quot; + xStr + &quot; - &quot; + yStr);
-            var scenario = { name: name, x: x, y: y, expected: expected };
</del><ins>+    '0',
+    '-0',
+    '1',
+    '-1',
+    '0x3fff',
+    '-0x3fff',
+    '0x7fff',
+    '-0x7fff',
+    '0x10000',
+    '-0x10000',
+    '0x7ffffff',
+    '-0x7ffffff',
+    '0x100000000',
+    '-0x100000000',
</ins><span class="cx"> 
</span><del>-            scenarios.push(scenario);
-        }
-    }
-    return scenarios;
-}
-
-function printScenarios(scenarios) {
-    for (var i = 0; i &lt; scenarios.length; i++) {
-        var scenario = scenarios[i];
-        print(&quot;scenario[&quot; + i + &quot;]: { name: &quot; + scenario.name + &quot;, x: &quot; + scenario.x, &quot;, y: &quot; + scenario.y + &quot;, expected: &quot; + scenario.expected + &quot; }&quot;);
-    }
-}
-
-var testCases = [
-    {
-        name: &quot;sub&quot;,
-        func: function(x, y) { return x - y; },
-        xvalues: values,
-        yvalues: values
-    },
-    {
-        name: &quot;subI32V&quot;,
-        func: function(x, y) { return 10 - y; },
-        xvalues: [ '10' ],
-        yvalues: values
-    },
-    {
-        name: &quot;subVI32&quot;,
-        func: function(x, y) { return x - 10; },
-        xvalues: values,
-        yvalues: [ '10' ]
-    },
-    {
-        name: &quot;subI32oV&quot;,
-        func: function(x, y) { return -2147483647 - y; },
-        xvalues: [ '-2147483647' ],
-        yvalues: values
-    },
-    {
-        name: &quot;subVI32o&quot;,
-        func: function(x, y) { return x - 2147483647; },
-        xvalues: values,
-        yvalues: [ '2147483647' ]
-    },
-    {
-        name: &quot;subI52V&quot;,
-        func: function(x, y) { return 4294967296 - y; },
-        xvalues: [ '4294967296' ],
-        yvalues: values
-    },
-    {
-        name: &quot;subVI52&quot;,
-        func: function(x, y) { return x - 4294967296; },
-        xvalues: values,
-        yvalues: [ '4294967296' ]
-    },
-    {
-        name: &quot;subDV&quot;,
-        func: function(x, y) { return 100.2 - y; },
-        xvalues: [ '100.2' ],
-        yvalues: values
-    },
-    {
-        name: &quot;subVD&quot;,
-        func: function(x, y) { return x - 100.2; },
-        xvalues: values,
-        yvalues: [ '100.2' ]
-    },
-    {
-        name: &quot;subBV&quot;,
-        func: function(x, y) { return true - y; },
-        xvalues: [ 'true' ],
-        yvalues: values
-    },
-    {
-        name: &quot;subVB&quot;,
-        func: function(x, y) { return x - true; },
-        xvalues: values,
-        yvalues: [ 'true' ]
-    },
-    {
-        name: &quot;subSi32V&quot;,
-        func: function(x, y) { return &quot;10&quot; - y; },
-        xvalues: [ '&quot;10&quot;' ],
-        yvalues: values
-    },
-    {
-        name: &quot;subVSi32&quot;,
-        func: function(x, y) { return x - &quot;10&quot;; },
-        xvalues: values,
-        yvalues: [ '&quot;10&quot;' ]
-    },
-
-    {
-        name: &quot;subSi32oV&quot;,
-        func: function(x, y) { return &quot;-2147483647&quot; - y; },
-        xvalues: [ '&quot;-2147483647&quot;' ],
-        yvalues: values
-    },
-    {
-        name: &quot;subVSi32o&quot;,
-        func: function(x, y) { return x - &quot;2147483647&quot;; },
-        xvalues: values,
-        yvalues: [ '&quot;2147483647&quot;' ]
-    },
-    {
-        name: &quot;subSi52V&quot;,
-        func: function(x, y) { return &quot;4294967296&quot; - y; },
-        xvalues: [ '&quot;4294967296&quot;' ],
-        yvalues: values
-    },
-    {
-        name: &quot;subVSi52&quot;,
-        func: function(x, y) { return x - &quot;4294967296&quot;; },
-        xvalues: values,
-        yvalues: [ '&quot;4294967296&quot;' ]
-    },
-    {
-        name: &quot;subSdV&quot;,
-        func: function(x, y) { return &quot;100.2&quot; - y; },
-        xvalues: [ '&quot;100.2&quot;' ],
-        yvalues: values
-    },
-    {
-        name: &quot;subVSd&quot;,
-        func: function(x, y) { return x - &quot;100.2&quot;; },
-        xvalues: values,
-        yvalues: [ '&quot;100.2&quot;' ]
-    },
-    {
-        name: &quot;subSbV&quot;,
-        func: function(x, y) { return &quot;true&quot; - y; },
-        xvalues: [ '&quot;true&quot;' ],
-        yvalues: values
-    },
-    {
-        name: &quot;subVSb&quot;,
-        func: function(x, y) { return x - &quot;true&quot;; },
-        xvalues: values,
-        yvalues: [ '&quot;true&quot;' ]
-    },
-
-    {
-        name: &quot;subSV&quot;,
-        func: function(x, y) { return &quot;abc&quot; - y; },
-        xvalues: [ '&quot;abc&quot;' ],
-        yvalues: values
-    },
-    {
-        name: &quot;subVS&quot;,
-        func: function(x, y) { return x - &quot;abc&quot;; },
-        xvalues: values,
-        yvalues: [ '&quot;abc&quot;' ]
-    },
-    {
-        name: &quot;subNV&quot;,
-        func: function(x, y) { return null - y; },
-        xvalues: [ 'null' ],
-        yvalues: values
-    },
-    {
-        name: &quot;subVN&quot;,
-        func: function(x, y) { return x - null; },
-        xvalues: values,
-        yvalues: [ 'null' ]
-    },
-    {
-        name: &quot;subOV&quot;,
-        func: function(x, y) { return o1 - y; },
-        xvalues: [ 'o1' ],
-        yvalues: values
-    },
-    {
-        name: &quot;subVO&quot;,
-        func: function(x, y) { return x - o1; },
-        xvalues: values,
-        yvalues: [ 'o1' ]
-    },
-    {
-        name: &quot;subNaNV&quot;,
-        func: function(x, y) { return NaN - y; },
-        xvalues: [ 'NaN' ],
-        yvalues: values
-    },
-    {
-        name: &quot;subVNaN&quot;,
-        func: function(x, y) { return x - NaN; },
-        xvalues: values,
-        yvalues: [ 'NaN' ]
-    },
</del><ins>+    '&quot;abc&quot;',
+    '&quot;0&quot;',
+    '&quot;-0&quot;',
+    '&quot;1&quot;',
+    '&quot;-1&quot;',
+    '&quot;0x3fff&quot;',
+    '&quot;-0x3fff&quot;',
+    '&quot;0x7fff&quot;',
+    '&quot;-0x7fff&quot;',
+    '&quot;0x10000&quot;',
+    '&quot;-0x10000&quot;',
+    '&quot;0x7ffffff&quot;',
+    '&quot;-0x7ffffff&quot;',
+    '&quot;0x100000000&quot;',
+    '&quot;-0x100000000&quot;',
</ins><span class="cx"> ];
</span><span class="cx"> 
</span><del>-function initializeTestCases() {
-    for (var test of testCases) {
-        noInline(test.func);
-        test.scenarios = generateScenarios(test.xvalues, test.yvalues);
-    }
-}
-initializeTestCases();
</del><ins>+tests = [];
+generateBinaryTests(tests, opName, op, &quot;VarVar&quot;, values, values);
+generateBinaryTests(tests, opName, op, &quot;VarConst&quot;, values, values);
+generateBinaryTests(tests, opName, op, &quot;ConstVar&quot;, values, values);
</ins><span class="cx"> 
</span><del>-var errorReport = &quot;&quot;;
-
-function runTest(test) {
-    var failedScenario = [];
-    var scenarios = test.scenarios;
-    var testFunc = test.func;
-    try {
-        for (var i = 0; i &lt; 10000; i++) {
-            for (var scenarioID = 0; scenarioID &lt; scenarios.length; scenarioID++) {
-                var scenario = scenarios[scenarioID];
-                if (verbose)
-                    print(&quot;Testing &quot; + test.name + &quot;:&quot; + scenario.name + &quot; on iteration &quot; + i + &quot;: expecting &quot; + scenario.expected); 
-
-                var result = testFunc(scenario.x, scenario.y);
-                if (result == scenario.expected)
-                    continue;
-                if (Number.isNaN(result) &amp;&amp; Number.isNaN(scenario.expected))
-                    continue;
-                if (!failedScenario[scenarioID]) {
-                    errorReport += &quot;FAIL: &quot; + test.name + &quot;:&quot; + scenario.name + &quot; started failing on iteration &quot; + i + &quot;: expected &quot; + scenario.expected + &quot;, actual &quot; + result + &quot;\n&quot;;
-                    if (abortOnFirstFail)
-                        throw errorReport;
-                    failedScenario[scenarioID] = scenario;
-                }
-            }
-        }
-    } catch(e) {
-        if (abortOnFirstFail)
-            throw e; // Negate the catch by re-throwing.
-        errorReport += &quot;Unexpected exception: &quot; + e + &quot;\n&quot;;
-    }
-}
-
-for (var test of testCases)
-    runTest(test);
-
-if (errorReport !== &quot;&quot;)
-    throw &quot;Error: bad result:\n&quot; + errorReport;
</del><ins>+run();
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressop_urshiftjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/op_urshift.js (0 => 192664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/op_urshift.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/op_urshift.js        2015-11-19 23:32:09 UTC (rev 192664)
</span><span class="lines">@@ -0,0 +1,77 @@
</span><ins>+//@ runFTLNoCJIT
+
+// If all goes well, this test module will terminate silently. If not, it will print
+// errors. See binary-op-test.js for debugging options if needed.
+
+load(&quot;./resources/binary-op-test.js&quot;);
+
+//============================================================================
+// Test configuration data:
+
+var opName = &quot;urshift&quot;;
+var op = &quot;&gt;&gt;&gt;&quot;;
+
+var o1 = {
+    valueOf: function() { return 10; }
+};
+
+var posInfinity = 1 / 0;
+var negInfinity = -1 / 0;
+
+var values = [
+    'o1',
+    'null',
+    'undefined',
+    'true',
+    'false',
+
+    'NaN',
+    'posInfinity',
+    'negInfinity',
+    '100.2', // Some random small double value.
+    '-100.2',
+    '54294967296.2923', // Some random large double value.
+    '-54294967296.2923',
+
+    '0',
+    '-0',
+    '1',
+    '-1',
+    '5',
+    '-5',
+    '31',
+    '-31',
+    '32',
+    '-32',
+    '0x3fff',
+    '-0x3fff',
+    '0x7fff',
+    '-0x7fff',
+    '0x10000',
+    '-0x10000',
+    '0x7ffffff',
+    '-0x7ffffff',
+    '0x100000000',
+    '-0x100000000',
+
+    '&quot;abc&quot;',
+    '&quot;0&quot;',
+    '&quot;-0&quot;',
+    '&quot;1&quot;',
+    '&quot;-1&quot;',
+    '&quot;5&quot;',
+    '&quot;-5&quot;',
+    '&quot;31&quot;',
+    '&quot;-31&quot;',
+    '&quot;32&quot;',
+    '&quot;-32&quot;',
+    '&quot;0x3fff&quot;',
+    '&quot;-0x3fff&quot;',
+];
+
+tests = [];
+generateBinaryTests(tests, opName, op, &quot;VarVar&quot;, values, values);
+generateBinaryTests(tests, opName, op, &quot;VarConst&quot;, values, values);
+generateBinaryTests(tests, opName, op, &quot;ConstVar&quot;, values, values);
+
+run();
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressresourcesbinaryoptestjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/resources/binary-op-test.js (0 => 192664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/resources/binary-op-test.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/resources/binary-op-test.js        2015-11-19 23:32:09 UTC (rev 192664)
</span><span class="lines">@@ -0,0 +1,131 @@
</span><ins>+// This test module provides infrastructure for generating and running tests on a binary
+// operator.
+//
+// It works by generating test functions to exercise the specified operator using
+// from permutations of operand value pairs. For each test, it computes the expected
+// result by exercising the test function once (using the LLINT) at test generation time.
+// The test runner later compares the result produced by the function (as it tiers up)
+// against the expected result.
+//
+// The generated tests can exercise the operator using the following operand types.
+//     variable * variable
+//     constant * variable
+//     variable * constant
+//
+// If all goes well, this test module will terminate silently. If not, it will print
+// errors.
+
+//============================================================================
+// Debugging options:
+
+var verbose = false;
+var abortOnFirstFail = false;
+var testFilterStr = undefined; // Define a filter string to filter tests to run.
+
+var verboseTestGeneration = false;
+
+//============================================================================
+// Test generation:
+
+function stringifyIfNeeded(x) {
+    if (typeof x == &quot;string&quot;)
+        return '&quot;' + x + '&quot;';
+    return x;
+}
+
+// operandTypes are &quot;VarVar&quot;, &quot;VarConst&quot;, and &quot;ConstVar&quot;.
+function generateBinaryTests(tests, opName, op, operandTypes, leftValues, rightValues) {
+    var funcName = opName + operandTypes;
+    for (var i = 0; i &lt; leftValues.length; i++) {
+        for (var j = 0; j &lt; rightValues.length; j++) {
+            var test = { };
+            xStr = leftValues[i];
+            yStr = rightValues[j];
+            test.x = eval(xStr);
+            test.y = eval(yStr);
+
+            if (operandTypes == &quot;VarVar&quot;) {
+                test.signature = funcName + &quot;(x, y) { return x &quot; + op + &quot; y }&quot;;
+                test.name = test.signature + &quot; with x:&quot; + xStr + &quot;, y:&quot; + yStr;
+            } else if (operandTypes == &quot;VarConst&quot;) {
+                test.signature = funcName + &quot;(x, _) { return x &quot; + op + &quot; &quot; + yStr + &quot; }&quot;;
+                test.name = test.signature + &quot; with x:&quot; + xStr;
+            } else if (operandTypes == &quot;ConstVar&quot;) {
+                test.signature = funcName + &quot;(_, y) { return &quot; + xStr + &quot; &quot; + op + &quot; y }&quot;;
+                test.name = test.signature + &quot; with y:&quot; + yStr;
+            }
+
+            test.func = eval(&quot;(function &quot; + test.signature + &quot;)&quot;);
+            noInline(test.func);
+
+            test.expectedResult = test.func(test.x, test.y);
+            test.name += &quot;, expected:&quot; + stringifyIfNeeded(test.expectedResult);
+
+            tests.push(test);
+            if (verboseTestGeneration)
+                print(&quot;Generated &quot; + test.name);
+        }
+    }
+}
+
+//============================================================================
+// Test running and reporting:
+
+var errorReport = &quot;&quot;;
+
+function isIdentical(x, y) {
+    if (typeof x != typeof y)
+        return false;
+    if (x == y) {
+        if (x)
+            return true;
+        // Distinguish between 0 and negative 0.
+        if (1 / x == 1 / y)
+            return true;
+    } else if (Number.isNaN(x) &amp;&amp; Number.isNaN(y))
+        return true;
+    return false;
+}
+
+function runTest(test) {
+    if (testFilterStr &amp;&amp; !test.name.includes(testFilterStr))
+        return;
+
+    var firstFailed = -1;
+    try {
+        if (verbose)
+            print(test.name);
+        for (var i = 0; i &lt; 10000; i++) {
+            var result = test.func(test.x, test.y);
+            if (isIdentical(result, test.expectedResult))
+                continue;
+            if (firstFailed &lt; 0) {
+                errorReport += &quot;FAILED: &quot; + test.name + &quot; started failing on iteration &quot; + i
+                    + &quot;: actual &quot; + stringifyIfNeeded(result) + &quot;\n&quot;;
+                if (abortOnFirstFail)
+                    throw errorReport;
+                firstFailed = i;
+            }
+        }
+    } catch(e) {
+        if (abortOnFirstFail)
+            throw e; // Negate the catch by re-throwing.
+        errorReport += &quot;FAILED: Unexpected exception: &quot; + e + &quot;\n&quot;;
+    }
+}
+
+function run() {
+    if (verbose)
+        print(&quot;Start testing&quot;);
+
+    for (var test of tests)
+        runTest(test);
+    // for (var i = 0; i &lt; tests.length; i++)
+    //     runTest(tests[i]);
+
+    if (errorReport !== &quot;&quot;)
+        throw &quot;Found failures:\n&quot; + errorReport;
+
+    if (verbose)
+        print(&quot;Done testing&quot;);
+}
</ins></span></pre>
</div>
</div>

</body>
</html>