<!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>[189458] 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/189458">189458</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-09-06 23:17:53 -0700 (Sun, 06 Sep 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Implement the relational instructions in WebAssembly
https://bugs.webkit.org/show_bug.cgi?id=148838

Patch by Sukolsak Sakshuwong &lt;sukolsak@gmail.com&gt; on 2015-09-06
Reviewed by Saam Barati.

This patch implements the relational instructions for 32-bit integers in
WebAssembly.

* tests/stress/wasm-arithmetic.js:
* tests/stress/wasm-locals.js:
* tests/stress/wasm-relational.js: Added.
(shouldBe):
* tests/stress/wasm/arithmetic.wasm: Renamed from Source/JavaScriptCore/tests/stress/wasm-arithmetic.wasm.
* tests/stress/wasm/locals.wasm: Renamed from Source/JavaScriptCore/tests/stress/wasm-locals.wasm.
* tests/stress/wasm/relational.wasm: Added.
* wasm/WASMFunctionCompiler.h:
(JSC::WASMFunctionCompiler::buildRelationalI32):
* wasm/WASMFunctionParser.cpp:
(JSC::WASMFunctionParser::parseExpressionI32):
(JSC::WASMFunctionParser::parseRelationalI32ExpressionI32):
* wasm/WASMFunctionParser.h:
* wasm/WASMFunctionSyntaxChecker.h:
(JSC::WASMFunctionSyntaxChecker::buildRelationalI32):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstresswasmarithmeticjs">trunk/Source/JavaScriptCore/tests/stress/wasm-arithmetic.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstresswasmlocalsjs">trunk/Source/JavaScriptCore/tests/stress/wasm-locals.js</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWASMFunctionCompilerh">trunk/Source/JavaScriptCore/wasm/WASMFunctionCompiler.h</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWASMFunctionParsercpp">trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWASMFunctionParserh">trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.h</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWASMFunctionSyntaxCheckerh">trunk/Source/JavaScriptCore/wasm/WASMFunctionSyntaxChecker.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/Source/JavaScriptCore/tests/stress/wasm/</li>
<li><a href="#trunkSourceJavaScriptCoretestsstresswasmarithmeticwasm">trunk/Source/JavaScriptCore/tests/stress/wasm/arithmetic.wasm</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstresswasmlocalswasm">trunk/Source/JavaScriptCore/tests/stress/wasm/locals.wasm</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstresswasmrelationalwasm">trunk/Source/JavaScriptCore/tests/stress/wasm/relational.wasm</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstresswasmrelationaljs">trunk/Source/JavaScriptCore/tests/stress/wasm-relational.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="#trunkSourceJavaScriptCoretestsstresswasmlocalswasm">trunk/Source/JavaScriptCore/tests/stress/wasm-locals.wasm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (189457 => 189458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-09-07 06:14:38 UTC (rev 189457)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-09-07 06:17:53 UTC (rev 189458)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2015-09-06  Sukolsak Sakshuwong  &lt;sukolsak@gmail.com&gt;
+
+        Implement the relational instructions in WebAssembly
+        https://bugs.webkit.org/show_bug.cgi?id=148838
+
+        Reviewed by Saam Barati.
+
+        This patch implements the relational instructions for 32-bit integers in
+        WebAssembly.
+
+        * tests/stress/wasm-arithmetic.js:
+        * tests/stress/wasm-locals.js:
+        * tests/stress/wasm-relational.js: Added.
+        (shouldBe):
+        * tests/stress/wasm/arithmetic.wasm: Renamed from Source/JavaScriptCore/tests/stress/wasm-arithmetic.wasm.
+        * tests/stress/wasm/locals.wasm: Renamed from Source/JavaScriptCore/tests/stress/wasm-locals.wasm.
+        * tests/stress/wasm/relational.wasm: Added.
+        * wasm/WASMFunctionCompiler.h:
+        (JSC::WASMFunctionCompiler::buildRelationalI32):
+        * wasm/WASMFunctionParser.cpp:
+        (JSC::WASMFunctionParser::parseExpressionI32):
+        (JSC::WASMFunctionParser::parseRelationalI32ExpressionI32):
+        * wasm/WASMFunctionParser.h:
+        * wasm/WASMFunctionSyntaxChecker.h:
+        (JSC::WASMFunctionSyntaxChecker::buildRelationalI32):
+
</ins><span class="cx"> 2015-09-06  Mark Lam  &lt;mark.lam@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         StackOverflow stack unwinding should stop at native frames.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstresswasmarithmeticwasmfromrev189457trunkSourceJavaScriptCoretestsstresswasmarithmeticwasm"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/tests/stress/wasm/arithmetic.wasm (from rev 189457, trunk/Source/JavaScriptCore/tests/stress/wasm-arithmetic.wasm) (0 => 189458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/wasm/arithmetic.wasm                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/wasm/arithmetic.wasm        2015-09-07 06:17:53 UTC (rev 189458)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+wasm\x9E\xFF\xFF\xFF\xFF\x80\x80\x80\x80*+\x80\xAA(\xA8\x80\xFF\xFF\xFF\xFF\xA1\x80!\x82\xA5\x80!\xA1\xA0\x80!\x81\x80\x80&quot;\x80\xA2\x80&quot;\x80\xA0\x80#\x82\xA5\x80#\xD6\xFF\xFF\xFF\xA5\x80#\xA1\xA0\x80#\x81\x80\x80$\x80\xA0\x8D\x80$\x80\xA0+addSubtractaddOverflowdividedivideByZerodivideOverflowunsignedDivideunsignedDivideByZeromodulomoduloNegativemoduloZero        moduloOverflow
+unsignedModulo unsignedModuloZero
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstresswasmlocalswasmfromrev189457trunkSourceJavaScriptCoretestsstresswasmlocalswasm"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/tests/stress/wasm/locals.wasm (from rev 189457, trunk/Source/JavaScriptCore/tests/stress/wasm-locals.wasm) (0 => 189458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/wasm/locals.wasm                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/wasm/locals.wasm        2015-09-07 06:17:53 UTC (rev 189458)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+wasmB\x81\x82\xC0\xC1€\xC0\xA1sumadd1
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstresswasmrelationalwasm"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/wasm/relational.wasm (0 => 189458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/wasm/relational.wasm                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/wasm/relational.wasm        2015-09-07 06:17:53 UTC (rev 189458)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+wasmc\xFF\xFF\xFF\xFF\x80.\xA1\xA1\x80.\xA1\xA2\x801\xA1\xA2\x801\xA1\xA1\x804\x80\xA2\x804\xA1\xA1\x808\xA1\xA1\x808\xA2\xA1\x80&lt;\xA2\x80\x80&lt;\xA1\xA1\x80@\xA1\xA1\x80@\xA1\xA2\x805\xA2\x80\x805\x80\xA2\x809\xA2\x80\x809\x80\xA2\x80=\x80\xA2\x80=\xA2\x80\x80A\x80\xA2\x80A\xA2\x80equalTrueequalFalsenotEqualTruenotEqualFalselessThanTruelessThanFalselessThanOrEqualTruelessThanOrEqualFalsegreaterThanTruegreaterThanFalse        greaterThanOrEqualTrue
+greaterThanOrEqualFalse unsignedLessThanTrue unsignedLessThanFalse+unsignedLessThanOrEqualTrueunsignedLessThanOrEqualFalseunsignedGreaterThanTrueunsignedGreaterThanFalseunsignedGreaterThanOrEqualTrueunsignedGreaterThanOrEqualFalse
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstresswasmarithmeticjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/tests/stress/wasm-arithmetic.js (189457 => 189458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/wasm-arithmetic.js        2015-09-07 06:14:38 UTC (rev 189457)
+++ trunk/Source/JavaScriptCore/tests/stress/wasm-arithmetic.js        2015-09-07 06:17:53 UTC (rev 189458)
</span><span class="lines">@@ -19,7 +19,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /*
</span><del>-wasm-arithmetic.wasm is generated by pack-asmjs &lt;https://github.com/WebAssembly/polyfill-prototype-1&gt; from the following script:
</del><ins>+wasm/arithmetic.wasm is generated by pack-asmjs &lt;https://github.com/WebAssembly/polyfill-prototype-1&gt; from the following script:
</ins><span class="cx"> 
</span><span class="cx"> function asmModule(global, env, buffer) {
</span><span class="cx">     &quot;use asm&quot;;
</span><span class="lines">@@ -94,7 +94,7 @@
</span><span class="cx"> }
</span><span class="cx"> */
</span><span class="cx"> 
</span><del>-var module = loadWebAssembly(&quot;wasm-arithmetic.wasm&quot;);
</del><ins>+var module = loadWebAssembly(&quot;wasm/arithmetic.wasm&quot;);
</ins><span class="cx"> 
</span><span class="cx"> shouldBe(module.addSubtract(), 42);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstresswasmarithmeticwasm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/tests/stress/wasm-arithmetic.wasm (189457 => 189458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/wasm-arithmetic.wasm        2015-09-07 06:14:38 UTC (rev 189457)
+++ trunk/Source/JavaScriptCore/tests/stress/wasm-arithmetic.wasm        2015-09-07 06:17:53 UTC (rev 189458)
</span><span class="lines">@@ -1,4 +0,0 @@
</span><del>-wasm\x9E\xFF\xFF\xFF\xFF\x80\x80\x80\x80*-\x80\xAA(\xA8\x80\xFF\xFF\xFF\xFF\xA1\x80!\x82\xA5\x80!\xA1\xA0\x80!\x81\x80\x80&quot;\x80\xA2\x80&quot;\x80\xA0\x80#\x82\xA5\x80#\xD6\xFF\xFF\xFF\xA5\x80#\xA1\xA0\x80#\x81\x80\x80$\x80\xA0\x8D\x80$\x80\xA0-addSubtractaddOverflowdividedivideByZerodivideOverflowunsignedDivideunsignedDivideByZeromodulomoduloNegativemoduloZero        moduloOverflow
-unsignedModulo unsignedModuloZero
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstresswasmlocalsjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/tests/stress/wasm-locals.js (189457 => 189458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/wasm-locals.js        2015-09-07 06:14:38 UTC (rev 189457)
+++ trunk/Source/JavaScriptCore/tests/stress/wasm-locals.js        2015-09-07 06:17:53 UTC (rev 189458)
</span><span class="lines">@@ -6,7 +6,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /*
</span><del>-wasm-locals.wasm is generated by pack-asmjs &lt;https://github.com/WebAssembly/polyfill-prototype-1&gt; from the following script:
</del><ins>+wasm/locals.wasm is generated by pack-asmjs &lt;https://github.com/WebAssembly/polyfill-prototype-1&gt; from the following script:
</ins><span class="cx"> 
</span><span class="cx"> function asmModule(global, env, buffer) {
</span><span class="cx">     &quot;use asm&quot;;
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx"> }
</span><span class="cx"> */
</span><span class="cx"> 
</span><del>-var module = loadWebAssembly(&quot;wasm-locals.wasm&quot;);
</del><ins>+var module = loadWebAssembly(&quot;wasm/locals.wasm&quot;);
</ins><span class="cx"> 
</span><span class="cx"> shouldBe(module.sum(12, 30), 42);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstresswasmlocalswasm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/tests/stress/wasm-locals.wasm (189457 => 189458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/wasm-locals.wasm        2015-09-07 06:14:38 UTC (rev 189457)
+++ trunk/Source/JavaScriptCore/tests/stress/wasm-locals.wasm        2015-09-07 06:17:53 UTC (rev 189458)
</span><span class="lines">@@ -1 +0,0 @@
</span><del>-wasmB\x81\x82\xC0\xC1€\xC0\xA1sumadd1
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstresswasmrelationaljs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/wasm-relational.js (0 => 189458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/wasm-relational.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/wasm-relational.js        2015-09-07 06:17:53 UTC (rev 189458)
</span><span class="lines">@@ -0,0 +1,140 @@
</span><ins>+//@ skip
+
+function shouldBe(actual, expected) {
+    if (actual !== expected)
+        throw new Error('bad value: ' + actual);
+}
+
+/*
+wasm/relational.wasm is generated by pack-asmjs &lt;https://github.com/WebAssembly/polyfill-prototype-1&gt; from the following script:
+
+function asmModule(global, env, buffer) {
+    &quot;use asm&quot;;
+
+    function equalTrue() {
+        return 1 == 1;
+    }
+
+    function equalFalse() {
+        return 1 == 2;
+    }
+
+    function notEqualTrue() {
+        return 1 != 2;
+    }
+
+    function notEqualFalse() {
+        return 1 != 1;
+    }
+
+    function lessThanTrue() {
+        return -1 &lt; 2;
+    }
+
+    function lessThanFalse() {
+        return 1 &lt; 1;
+    }
+
+    function lessThanOrEqualTrue() {
+        return 1 &lt;= 1;
+    }
+
+    function lessThanOrEqualFalse() {
+        return 2 &lt;= 1;
+    }
+
+    function greaterThanTrue() {
+        return 2 &gt; -1;
+    }
+
+    function greaterThanFalse() {
+        return 1 &gt; 1;
+    }
+
+    function greaterThanOrEqualTrue() {
+        return 1 &gt;= 1;
+    }
+
+    function greaterThanOrEqualFalse() {
+        return 1 &gt;= 2;
+    }
+
+    function unsignedLessThanTrue() {
+        return (2 &gt;&gt;&gt; 0) &lt; (-1 &gt;&gt;&gt; 0);
+    }
+
+    function unsignedLessThanFalse() {
+        return (-1 &gt;&gt;&gt; 0) &lt; (2 &gt;&gt;&gt; 0);
+    }
+
+    function unsignedLessThanOrEqualTrue() {
+        return (2 &gt;&gt;&gt; 0) &lt;= (-1 &gt;&gt;&gt; 0);
+    }
+
+    function unsignedLessThanOrEqualFalse() {
+        return (-1 &gt;&gt;&gt; 0) &lt;= (2 &gt;&gt;&gt; 0);
+    }
+
+    function unsignedGreaterThanTrue() {
+        return (-1 &gt;&gt;&gt; 0) &gt; (2 &gt;&gt;&gt; 0);
+    }
+
+    function unsignedGreaterThanFalse() {
+        return (2 &gt;&gt;&gt; 0) &gt; (-1 &gt;&gt;&gt; 0);
+    }
+
+    function unsignedGreaterThanOrEqualTrue() {
+        return (-1 &gt;&gt;&gt; 0) &gt;= (2 &gt;&gt;&gt; 0);
+    }
+
+    function unsignedGreaterThanOrEqualFalse() {
+        return (2 &gt;&gt;&gt; 0) &gt;= (-1 &gt;&gt;&gt; 0);
+    }
+
+    return {
+        equalTrue: equalTrue,
+        equalFalse: equalFalse,
+        notEqualTrue: notEqualTrue,
+        notEqualFalse: notEqualFalse,
+        lessThanTrue: lessThanTrue,
+        lessThanFalse: lessThanFalse,
+        lessThanOrEqualTrue: lessThanOrEqualTrue,
+        lessThanOrEqualFalse: lessThanOrEqualFalse,
+        greaterThanTrue: greaterThanTrue,
+        greaterThanFalse: greaterThanFalse,
+        greaterThanOrEqualTrue: greaterThanOrEqualTrue,
+        greaterThanOrEqualFalse: greaterThanOrEqualFalse,
+        unsignedLessThanTrue: unsignedLessThanTrue,
+        unsignedLessThanFalse: unsignedLessThanFalse,
+        unsignedLessThanOrEqualTrue: unsignedLessThanOrEqualTrue,
+        unsignedLessThanOrEqualFalse: unsignedLessThanOrEqualFalse,
+        unsignedGreaterThanTrue: unsignedGreaterThanTrue,
+        unsignedGreaterThanFalse: unsignedGreaterThanFalse,
+        unsignedGreaterThanOrEqualTrue: unsignedGreaterThanOrEqualTrue,
+        unsignedGreaterThanOrEqualFalse: unsignedGreaterThanOrEqualFalse,
+    };
+}
+*/
+
+var module = loadWebAssembly(&quot;wasm/relational.wasm&quot;);
+
+shouldBe(module.equalTrue(), 1);
+shouldBe(module.equalFalse(), 0);
+shouldBe(module.notEqualTrue(), 1);
+shouldBe(module.notEqualFalse(), 0);
+shouldBe(module.lessThanTrue(), 1);
+shouldBe(module.lessThanFalse(), 0);
+shouldBe(module.lessThanOrEqualTrue(), 1);
+shouldBe(module.lessThanOrEqualFalse(), 0);
+shouldBe(module.greaterThanTrue(), 1);
+shouldBe(module.greaterThanFalse(), 0);
+shouldBe(module.greaterThanOrEqualTrue(), 1);
+shouldBe(module.greaterThanOrEqualFalse(), 0);
+shouldBe(module.unsignedLessThanTrue(), 1);
+shouldBe(module.unsignedLessThanFalse(), 0);
+shouldBe(module.unsignedLessThanOrEqualTrue(), 1);
+shouldBe(module.unsignedLessThanOrEqualFalse(), 0);
+shouldBe(module.unsignedGreaterThanTrue(), 1);
+shouldBe(module.unsignedGreaterThanFalse(), 0);
+shouldBe(module.unsignedGreaterThanOrEqualTrue(), 1);
+shouldBe(module.unsignedGreaterThanOrEqualFalse(), 0);
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWASMFunctionCompilerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WASMFunctionCompiler.h (189457 => 189458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WASMFunctionCompiler.h        2015-09-07 06:14:38 UTC (rev 189457)
+++ trunk/Source/JavaScriptCore/wasm/WASMFunctionCompiler.h        2015-09-07 06:17:53 UTC (rev 189458)
</span><span class="lines">@@ -293,6 +293,51 @@
</span><span class="cx">         return UNUSED;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    int buildRelationalI32(int, int, WASMOpExpressionI32 op)
+    {
+        load32(temporaryAddress(m_tempStackTop - 2), GPRInfo::regT0);
+        load32(temporaryAddress(m_tempStackTop - 1), GPRInfo::regT1);
+        RelationalCondition condition;
+        switch (op) {
+        case WASMOpExpressionI32::EqualI32:
+            condition = Equal;
+            break;
+        case WASMOpExpressionI32::NotEqualI32:
+            condition = NotEqual;
+            break;
+        case WASMOpExpressionI32::SLessThanI32:
+            condition = LessThan;
+            break;
+        case WASMOpExpressionI32::ULessThanI32:
+            condition = Below;
+            break;
+        case WASMOpExpressionI32::SLessThanOrEqualI32:
+            condition = LessThanOrEqual;
+            break;
+        case WASMOpExpressionI32::ULessThanOrEqualI32:
+            condition = BelowOrEqual;
+            break;
+        case WASMOpExpressionI32::SGreaterThanI32:
+            condition = GreaterThan;
+            break;
+        case WASMOpExpressionI32::UGreaterThanI32:
+            condition = Above;
+            break;
+        case WASMOpExpressionI32::SGreaterThanOrEqualI32:
+            condition = GreaterThanOrEqual;
+            break;
+        case WASMOpExpressionI32::UGreaterThanOrEqualI32:
+            condition = AboveOrEqual;
+            break;
+        default:
+            RELEASE_ASSERT_NOT_REACHED();
+        }
+        compare32(condition, GPRInfo::regT0, GPRInfo::regT1, GPRInfo::regT0);
+        m_tempStackTop--;
+        store32(GPRInfo::regT0, temporaryAddress(m_tempStackTop - 1));
+        return UNUSED;
+    }
+
</ins><span class="cx"> private:
</span><span class="cx">     union StackSlot {
</span><span class="cx">         int32_t intValue;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWASMFunctionParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.cpp (189457 => 189458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.cpp        2015-09-07 06:14:38 UTC (rev 189457)
+++ trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.cpp        2015-09-07 06:17:53 UTC (rev 189458)
</span><span class="lines">@@ -437,6 +437,17 @@
</span><span class="cx">         case WASMOpExpressionI32::SMod:
</span><span class="cx">         case WASMOpExpressionI32::UMod:
</span><span class="cx">             return parseBinaryExpressionI32(context, op);
</span><ins>+        case WASMOpExpressionI32::EqualI32:
+        case WASMOpExpressionI32::NotEqualI32:
+        case WASMOpExpressionI32::SLessThanI32:
+        case WASMOpExpressionI32::ULessThanI32:
+        case WASMOpExpressionI32::SLessThanOrEqualI32:
+        case WASMOpExpressionI32::ULessThanOrEqualI32:
+        case WASMOpExpressionI32::SGreaterThanI32:
+        case WASMOpExpressionI32::UGreaterThanI32:
+        case WASMOpExpressionI32::SGreaterThanOrEqualI32:
+        case WASMOpExpressionI32::UGreaterThanOrEqualI32:
+            return parseRelationalI32ExpressionI32(context, op);
</ins><span class="cx">         case WASMOpExpressionI32::GetGlobal:
</span><span class="cx">         case WASMOpExpressionI32::SetLocal:
</span><span class="cx">         case WASMOpExpressionI32::SetGlobal:
</span><span class="lines">@@ -474,26 +485,16 @@
</span><span class="cx">         case WASMOpExpressionI32::LogicalRightShift:
</span><span class="cx">         case WASMOpExpressionI32::CountLeadingZeros:
</span><span class="cx">         case WASMOpExpressionI32::LogicalNot:
</span><del>-        case WASMOpExpressionI32::EqualI32:
</del><span class="cx">         case WASMOpExpressionI32::EqualF32:
</span><span class="cx">         case WASMOpExpressionI32::EqualF64:
</span><del>-        case WASMOpExpressionI32::NotEqualI32:
</del><span class="cx">         case WASMOpExpressionI32::NotEqualF32:
</span><span class="cx">         case WASMOpExpressionI32::NotEqualF64:
</span><del>-        case WASMOpExpressionI32::SLessThanI32:
-        case WASMOpExpressionI32::ULessThanI32:
</del><span class="cx">         case WASMOpExpressionI32::LessThanF32:
</span><span class="cx">         case WASMOpExpressionI32::LessThanF64:
</span><del>-        case WASMOpExpressionI32::SLessThanOrEqualI32:
-        case WASMOpExpressionI32::ULessThanOrEqualI32:
</del><span class="cx">         case WASMOpExpressionI32::LessThanOrEqualF32:
</span><span class="cx">         case WASMOpExpressionI32::LessThanOrEqualF64:
</span><del>-        case WASMOpExpressionI32::SGreaterThanI32:
-        case WASMOpExpressionI32::UGreaterThanI32:
</del><span class="cx">         case WASMOpExpressionI32::GreaterThanF32:
</span><span class="cx">         case WASMOpExpressionI32::GreaterThanF64:
</span><del>-        case WASMOpExpressionI32::SGreaterThanOrEqualI32:
-        case WASMOpExpressionI32::UGreaterThanOrEqualI32:
</del><span class="cx">         case WASMOpExpressionI32::GreaterThanOrEqualF32:
</span><span class="cx">         case WASMOpExpressionI32::GreaterThanOrEqualF64:
</span><span class="cx">         case WASMOpExpressionI32::SMin:
</span><span class="lines">@@ -576,6 +577,16 @@
</span><span class="cx">     return context.buildBinaryI32(left, right, op);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+template &lt;class Context&gt;
+ContextExpression WASMFunctionParser::parseRelationalI32ExpressionI32(Context&amp; context, WASMOpExpressionI32 op)
+{
+    ContextExpression left = parseExpressionI32(context);
+    PROPAGATE_ERROR();
+    ContextExpression right = parseExpressionI32(context);
+    PROPAGATE_ERROR();
+    return context.buildRelationalI32(left, right, op);
+}
+
</ins><span class="cx"> } // namespace JSC
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(WEBASSEMBLY)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWASMFunctionParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.h (189457 => 189458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.h        2015-09-07 06:14:38 UTC (rev 189457)
+++ trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.h        2015-09-07 06:17:53 UTC (rev 189458)
</span><span class="lines">@@ -85,6 +85,7 @@
</span><span class="cx">     template &lt;class Context&gt; ContextExpression parseGetLocalExpressionI32(Context&amp;, uint32_t localIndex);
</span><span class="cx">     template &lt;class Context&gt; ContextExpression parseGetLocalExpressionI32(Context&amp;);
</span><span class="cx">     template &lt;class Context&gt; ContextExpression parseBinaryExpressionI32(Context&amp;, WASMOpExpressionI32);
</span><ins>+    template &lt;class Context&gt; ContextExpression parseRelationalI32ExpressionI32(Context&amp;, WASMOpExpressionI32);
</ins><span class="cx"> 
</span><span class="cx">     JSWASMModule* m_module;
</span><span class="cx">     WASMReader m_reader;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWASMFunctionSyntaxCheckerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WASMFunctionSyntaxChecker.h (189457 => 189458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WASMFunctionSyntaxChecker.h        2015-09-07 06:14:38 UTC (rev 189457)
+++ trunk/Source/JavaScriptCore/wasm/WASMFunctionSyntaxChecker.h        2015-09-07 06:17:53 UTC (rev 189458)
</span><span class="lines">@@ -78,6 +78,12 @@
</span><span class="cx">         return UNUSED;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    int buildRelationalI32(int, int, WASMOpExpressionI32)
+    {
+        m_tempStackTop--;
+        return UNUSED;
+    }
+
</ins><span class="cx">     unsigned stackHeight()
</span><span class="cx">     {
</span><span class="cx">         return m_numberOfLocals + m_tempStackHeight;
</span></span></pre>
</div>
</div>

</body>
</html>