<!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>[205330] 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/205330">205330</a></dd>
<dt>Author</dt> <dd>keith_miller@apple.com</dd>
<dt>Date</dt> <dd>2016-09-01 18:19:42 -0700 (Thu, 01 Sep 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>jsc: provide printErr()
https://bugs.webkit.org/show_bug.cgi?id=161513

Patch by JF Bastien &lt;jfbastien@apple.com&gt; on 2016-09-01
Reviewed by Mark Lam.

* jsc.cpp:
(GlobalObject::finishCreation):
(printInternal): renamed from functionPrint, add error checking
(functionPrintStdOut): punt to printInternal
(functionPrintStdErr): punt to printInternal
(functionPrint): Deleted.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj">trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceJavaScriptCoreinterpreterProtoCallFrameh">trunk/Source/JavaScriptCore/interpreter/ProtoCallFrame.h</a></li>
<li><a href="#trunkSourceJavaScriptCorellintLLIntThunkscpp">trunk/Source/JavaScriptCore/llint/LLIntThunks.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorellintLLIntThunksh">trunk/Source/JavaScriptCore/llint/LLIntThunks.h</a></li>
<li><a href="#trunkSourceJavaScriptCoretestWASMcpp">trunk/Source/JavaScriptCore/testWASM.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWASMB3IRGeneratorcpp">trunk/Source/JavaScriptCore/wasm/WASMB3IRGenerator.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWASMFormath">trunk/Source/JavaScriptCore/wasm/WASMFormat.h</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWASMFunctionParserh">trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.h</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWASMModuleParsercpp">trunk/Source/JavaScriptCore/wasm/WASMModuleParser.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWASMModuleParserh">trunk/Source/JavaScriptCore/wasm/WASMModuleParser.h</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWASMOpsh">trunk/Source/JavaScriptCore/wasm/WASMOps.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreB3CallingConventionscpp">trunk/Source/JavaScriptCore/B3CallingConventions.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreB3CallingConventionsh">trunk/Source/JavaScriptCore/B3CallingConventions.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreB3CallingConventionscppfromrev205329trunkSourceJavaScriptCorellintLLIntThunksh"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/B3CallingConventions.cpp (from rev 205329, trunk/Source/JavaScriptCore/llint/LLIntThunks.h) (0 => 205330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/B3CallingConventions.cpp                                (rev 0)
+++ trunk/Source/JavaScriptCore/B3CallingConventions.cpp        2016-09-02 01:19:42 UTC (rev 205330)
</span><span class="lines">@@ -0,0 +1,52 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;B3CallingConventions.h&quot;
+
+#include &lt;wtf/NeverDestroyed.h&gt;
+
+#if ENABLE(B3_JIT)
+
+namespace JSC {
+
+namespace B3 {
+
+JSCCallingConvention&amp; jscCallingConvention()
+{
+    static LazyNeverDestroyed&lt;JSCCallingConvention&gt; staticJSCCallingConvention;
+    static std::once_flag staticJSCCallingConventionFlag;
+    std::call_once(staticJSCCallingConventionFlag, [] () {
+        staticJSCCallingConvention.construct(Vector&lt;GPRReg&gt;(), RegisterSet::calleeSaveRegisters());
+    });
+
+    return staticJSCCallingConvention;
+}
+
+} // namespace B3
+
+} // namespace JSC
+
+#endif // ENABLE(B3_JIT)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreB3CallingConventionsh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/B3CallingConventions.h (0 => 205330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/B3CallingConventions.h                                (rev 0)
+++ trunk/Source/JavaScriptCore/B3CallingConventions.h        2016-09-02 01:19:42 UTC (rev 205330)
</span><span class="lines">@@ -0,0 +1,94 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(B3_JIT)
+
+#include &quot;B3ArgumentRegValue.h&quot;
+#include &quot;B3BasicBlock.h&quot;
+#include &quot;B3Const64Value.h&quot;
+#include &quot;B3MemoryValue.h&quot;
+#include &quot;B3Type.h&quot;
+#include &quot;CallFrame.h&quot;
+#include &quot;RegisterSet.h&quot;
+
+namespace JSC {
+
+namespace B3 {
+
+typedef unsigned (*NextOffset)(unsigned currentOffset, Type type);
+
+template&lt;unsigned offset, NextOffset updateOffset&gt;
+class CallingConvention {
+public:
+    static const unsigned headerSize = offset;
+
+    CallingConvention(Vector&lt;GPRReg&gt;&amp;&amp; registerArguments, RegisterSet&amp;&amp; calleeSaveRegisters)
+        : m_registerArguments(registerArguments)
+        , m_calleeSaveRegisters(calleeSaveRegisters)
+    {
+    }
+
+    template&lt;typename Functor&gt;
+    void iterate(const Vector&lt;Type&gt;&amp; argumentTypes, Procedure&amp; proc, BasicBlock* block, Origin origin, const Functor&amp; functor) const
+    {
+        unsigned currentOffset = headerSize;
+        Value* framePointer = block-&gt;appendNew&lt;Value&gt;(proc, FramePointer, origin);
+
+        for (unsigned i = 0; i &lt; argumentTypes.size(); ++i) {
+            Value* argument;
+            if (i &lt; m_registerArguments.size())
+                argument = block-&gt;appendNew&lt;ArgumentRegValue&gt;(proc, origin, m_registerArguments[i]);
+            else {
+                Value* address = block-&gt;appendNew&lt;Value&gt;(proc, Add, origin, framePointer,
+                    block-&gt;appendNew&lt;Const64Value&gt;(proc, origin, currentOffset));
+                argument = block-&gt;appendNew&lt;MemoryValue&gt;(proc, Load, argumentTypes[i], origin, address);
+                currentOffset = updateOffset(currentOffset, argumentTypes[i]);
+            }
+            functor(argument, i);
+        }
+    }
+
+    const Vector&lt;GPRReg&gt; m_registerArguments;
+    const RegisterSet m_calleeSaveRegisters;
+    const RegisterSet m_callerSaveRegisters;
+};
+
+inline unsigned nextJSCOffset(unsigned currentOffset, Type)
+{
+    return currentOffset + sizeof(Register);
+}
+
+constexpr unsigned jscHeaderSize = ExecState::headerSizeInRegisters * sizeof(Register);
+typedef CallingConvention&lt;jscHeaderSize, nextJSCOffset&gt; JSCCallingConvention;
+
+JSCCallingConvention&amp; jscCallingConvention();
+
+} // namespace B3
+
+} // namespace JSC
+
+#endif // ENABLE(B3_JIT)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (205329 => 205330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-09-02 01:16:56 UTC (rev 205329)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-09-02 01:19:42 UTC (rev 205330)
</span><span class="lines">@@ -81,6 +81,50 @@
</span><span class="cx"> 
</span><span class="cx"> 2016-09-01  Keith Miller  &lt;keith_miller@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        WASM functions should be able to use arguments
+        https://bugs.webkit.org/show_bug.cgi?id=161471
+
+        Reviewed by Benjamin Poulain.
+
+        This patch does a couple of changes:
+
+        1) Adds a new Calling Convention class for B3. This class is used to make it easy to specify the calling convention of a function. In particular it knows which arguments are in registers and which ones should be on the stack. For now, nothing uses the argument registers, in the future we will use these for WASM and/or JS. Additonally, it knows the callee save registers for any given function. The main advantage of this class is that it makes it easy to iterate over the arguments of your function without having to worry about the details of the calling convention you are using.
+
+        2) Makes the WASM calling convention the same as the JS one. Currently, the CodeBlock, CodeOrigin, and Callee are all 0. Since they have no value. Additionally, since we call into WASM from C++ through vmEntryToJavaScript, if there are no arguments to the callee we insert a null pointer as the first argument.
+
+        3) Since WASM expects the arguments to be mapped to function locals we map the argument stack slots to variables immediately after the function prologue.
+
+        * B3CallingConventions.cpp: Copied from Source/JavaScriptCore/llint/LLIntThunks.h.
+        (JSC::B3::jscCallingConvention):
+        * B3CallingConventions.h: Added.
+        (JSC::B3::CallingConvention::CallingConvention):
+        (JSC::B3::CallingConvention::iterate):
+        (JSC::B3::nextJSCOffset):
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * interpreter/ProtoCallFrame.h:
+        * llint/LLIntThunks.cpp:
+        (JSC::vmEntryToWASM):
+        * llint/LLIntThunks.h:
+        * testWASM.cpp:
+        (invoke):
+        (box):
+        (runWASMTests):
+        * wasm/WASMB3IRGenerator.cpp:
+        (JSC::WASM::B3IRGenerator::addLocal):
+        (JSC::WASM::B3IRGenerator::addArguments):
+        (JSC::WASM::B3IRGenerator::getLocal):
+        * wasm/WASMFormat.h:
+        * wasm/WASMFunctionParser.h:
+        (JSC::WASM::FunctionParser&lt;Context&gt;::FunctionParser):
+        (JSC::WASM::FunctionParser&lt;Context&gt;::parseExpression):
+        * wasm/WASMModuleParser.cpp:
+        (JSC::WASM::ModuleParser::parseFunctionTypes):
+        (JSC::WASM::ModuleParser::parseFunctionSignatures):
+        * wasm/WASMModuleParser.h:
+        * wasm/WASMOps.h:
+
+2016-09-01  Keith Miller  &lt;keith_miller@apple.com&gt;
+
</ins><span class="cx">         Rename WASM classes dropping the WASM prefix
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=161500
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (205329 => 205330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2016-09-02 01:16:56 UTC (rev 205329)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2016-09-02 01:19:42 UTC (rev 205330)
</span><span class="lines">@@ -1179,6 +1179,7 @@
</span><span class="cx">                 52C952B919A28A1C0069B386 /* TypeProfiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 52C952B819A28A1C0069B386 /* TypeProfiler.cpp */; };
</span><span class="cx">                 531374BD1D5CE67600AF7A0B /* WASMPlan.h in Headers */ = {isa = PBXBuildFile; fileRef = 531374BC1D5CE67600AF7A0B /* WASMPlan.h */; };
</span><span class="cx">                 531374BF1D5CE95000AF7A0B /* WASMPlan.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 531374BE1D5CE95000AF7A0B /* WASMPlan.cpp */; };
</span><ins>+                531B3C871D74C603005B3236 /* B3CallingConventions.h in Headers */ = {isa = PBXBuildFile; fileRef = 531B3C861D74C603005B3236 /* B3CallingConventions.h */; };
</ins><span class="cx">                 53486BB71C1795C300F6F3AF /* JSTypedArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 53486BB61C1795C300F6F3AF /* JSTypedArray.h */; settings = {ATTRIBUTES = (Public, ); }; };
</span><span class="cx">                 53486BBB1C18E84500F6F3AF /* JSTypedArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53486BBA1C18E84500F6F3AF /* JSTypedArray.cpp */; };
</span><span class="cx">                 534902851C7276B70012BCB8 /* TypedArrayCTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 534902821C7242C80012BCB8 /* TypedArrayCTest.cpp */; };
</span><span class="lines">@@ -1187,6 +1188,7 @@
</span><span class="cx">                 53529A4C1C457B75000B49C6 /* APIUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 53529A4B1C457B75000B49C6 /* APIUtils.h */; };
</span><span class="cx">                 5370B4F51BF26202005C40FC /* AdaptiveInferredPropertyValueWatchpointBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5370B4F31BF25EA2005C40FC /* AdaptiveInferredPropertyValueWatchpointBase.cpp */; };
</span><span class="cx">                 5370B4F61BF26205005C40FC /* AdaptiveInferredPropertyValueWatchpointBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 5370B4F41BF25EA2005C40FC /* AdaptiveInferredPropertyValueWatchpointBase.h */; };
</span><ins>+                5388B4041D76640B00D3D852 /* B3CallingConventions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5388B4031D76640B00D3D852 /* B3CallingConventions.cpp */; };
</ins><span class="cx">                 53917E7B1B7906FA000EBD33 /* JSGenericTypedArrayViewPrototypeFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = 53917E7A1B7906E4000EBD33 /* JSGenericTypedArrayViewPrototypeFunctions.h */; };
</span><span class="cx">                 539EB0791D55607000C82EF7 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 51F0EB6105C86C6B00E6DF1B /* Foundation.framework */; };
</span><span class="cx">                 539EB07A1D55607000C82EF7 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 932F5BD90822A1C700736975 /* JavaScriptCore.framework */; };
</span><span class="lines">@@ -3371,6 +3373,7 @@
</span><span class="cx">                 52C952B819A28A1C0069B386 /* TypeProfiler.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TypeProfiler.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 531374BC1D5CE67600AF7A0B /* WASMPlan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WASMPlan.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 531374BE1D5CE95000AF7A0B /* WASMPlan.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WASMPlan.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                531B3C861D74C603005B3236 /* B3CallingConventions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = B3CallingConventions.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 53486BB61C1795C300F6F3AF /* JSTypedArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTypedArray.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 53486BBA1C18E84500F6F3AF /* JSTypedArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTypedArray.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 534902821C7242C80012BCB8 /* TypedArrayCTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TypedArrayCTest.cpp; path = API/tests/TypedArrayCTest.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -3381,6 +3384,7 @@
</span><span class="cx">                 53529A4B1C457B75000B49C6 /* APIUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIUtils.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5370B4F31BF25EA2005C40FC /* AdaptiveInferredPropertyValueWatchpointBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AdaptiveInferredPropertyValueWatchpointBase.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5370B4F41BF25EA2005C40FC /* AdaptiveInferredPropertyValueWatchpointBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AdaptiveInferredPropertyValueWatchpointBase.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                5388B4031D76640B00D3D852 /* B3CallingConventions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = B3CallingConventions.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 53917E7A1B7906E4000EBD33 /* JSGenericTypedArrayViewPrototypeFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGenericTypedArrayViewPrototypeFunctions.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 53917E7C1B791106000EBD33 /* JSTypedArrayViewPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTypedArrayViewPrototype.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 53917E831B791CB8000EBD33 /* TypedArrayPrototype.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = TypedArrayPrototype.js; path = builtins/TypedArrayPrototype.js; sourceTree = SOURCE_ROOT; };
</span><span class="lines">@@ -4775,6 +4779,8 @@
</span><span class="cx">                                 DCFDFBD71D1F5D9800FE3D72 /* B3BottomProvider.h */,
</span><span class="cx">                                 0F6B8ADE1C4EFE1700969052 /* B3BreakCriticalEdges.cpp */,
</span><span class="cx">                                 0F6B8ADF1C4EFE1700969052 /* B3BreakCriticalEdges.h */,
</span><ins>+                                5388B4031D76640B00D3D852 /* B3CallingConventions.cpp */,
+                                531B3C861D74C603005B3236 /* B3CallingConventions.h */,
</ins><span class="cx">                                 DC9A0C1C1D2D94EF0085124E /* B3CaseCollection.cpp */,
</span><span class="cx">                                 DC9A0C1D1D2D94EF0085124E /* B3CaseCollection.h */,
</span><span class="cx">                                 DC9A0C1E1D2D94EF0085124E /* B3CaseCollectionInlines.h */,
</span><span class="lines">@@ -4889,9 +4895,9 @@
</span><span class="cx">                                 0FEC84EF1BDACDAC0080FF74 /* B3SwitchValue.cpp */,
</span><span class="cx">                                 0FEC84F01BDACDAC0080FF74 /* B3SwitchValue.h */,
</span><span class="cx">                                 0F45703E1BE584CA0062A629 /* B3TimingScope.cpp */,
</span><ins>+                                0FEC84F21BDACDAC0080FF74 /* B3Type.h */,
</ins><span class="cx">                                 0F45703F1BE584CA0062A629 /* B3TimingScope.h */,
</span><span class="cx">                                 0FEC84F11BDACDAC0080FF74 /* B3Type.cpp */,
</span><del>-                                0FEC84F21BDACDAC0080FF74 /* B3Type.h */,
</del><span class="cx">                                 DCFDFBD81D1F5D9800FE3D72 /* B3TypeMap.h */,
</span><span class="cx">                                 0FEC84F31BDACDAC0080FF74 /* B3UpsilonValue.cpp */,
</span><span class="cx">                                 0FEC84F41BDACDAC0080FF74 /* B3UpsilonValue.h */,
</span><span class="lines">@@ -8265,6 +8271,7 @@
</span><span class="cx">                                 99DA00B11BD5994E00F4575C /* UpdateContents.py in Headers */,
</span><span class="cx">                                 0F963B3813FC6FE90002D9B2 /* ValueProfile.h in Headers */,
</span><span class="cx">                                 0F426A481460CBB300131F8F /* ValueRecovery.h in Headers */,
</span><ins>+                                531B3C871D74C603005B3236 /* B3CallingConventions.h in Headers */,
</ins><span class="cx">                                 79EE0C001B4AFB85000385C9 /* VariableEnvironment.h in Headers */,
</span><span class="cx">                                 0F6C73511AC9F99F00BE1682 /* VariableWriteFireDetail.h in Headers */,
</span><span class="cx">                                 0FE0502D1AA9095600D33B33 /* VarOffset.h in Headers */,
</span><span class="lines">@@ -8916,6 +8923,7 @@
</span><span class="cx">                                 7094C4DE1AE439530041A2EE /* BytecodeIntrinsicRegistry.cpp in Sources */,
</span><span class="cx">                                 C2FCAE1217A9C24E0034C735 /* BytecodeLivenessAnalysis.cpp in Sources */,
</span><span class="cx">                                 0F338E0D1BF0276C0013C88F /* B3DataSection.cpp in Sources */,
</span><ins>+                                5388B4041D76640B00D3D852 /* B3CallingConventions.cpp in Sources */,
</ins><span class="cx">                                 65B8392F1BACAD6A0044E824 /* CachedRecovery.cpp in Sources */,
</span><span class="cx">                                 1428082D107EC0570013E7B2 /* CallData.cpp in Sources */,
</span><span class="cx">                                 0F64B2791A7957B2006E4E66 /* CallEdge.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinterpreterProtoCallFrameh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/interpreter/ProtoCallFrame.h (205329 => 205330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/interpreter/ProtoCallFrame.h        2016-09-02 01:16:56 UTC (rev 205329)
+++ trunk/Source/JavaScriptCore/interpreter/ProtoCallFrame.h        2016-09-02 01:19:42 UTC (rev 205330)
</span><span class="lines">@@ -30,7 +30,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><del>-struct ProtoCallFrame {
</del><ins>+struct JS_EXPORT_PRIVATE ProtoCallFrame {
</ins><span class="cx">     Register codeBlockValue;
</span><span class="cx">     Register calleeValue;
</span><span class="cx">     Register argCountAndCodeOriginValue;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorellintLLIntThunkscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/llint/LLIntThunks.cpp (205329 => 205330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/llint/LLIntThunks.cpp        2016-09-02 01:16:56 UTC (rev 205329)
+++ trunk/Source/JavaScriptCore/llint/LLIntThunks.cpp        2016-09-02 01:19:42 UTC (rev 205330)
</span><span class="lines">@@ -41,6 +41,11 @@
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><ins>+EncodedJSValue JS_EXPORT_PRIVATE vmEntryToWASM(void* code, VM* vm, ProtoCallFrame* frame)
+{
+    return vmEntryToJavaScript(code, vm, frame);
+}
+    
</ins><span class="cx"> #if ENABLE(JIT)
</span><span class="cx"> 
</span><span class="cx"> namespace LLInt {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorellintLLIntThunksh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/llint/LLIntThunks.h (205329 => 205330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/llint/LLIntThunks.h        2016-09-02 01:16:56 UTC (rev 205329)
+++ trunk/Source/JavaScriptCore/llint/LLIntThunks.h        2016-09-02 01:19:42 UTC (rev 205330)
</span><span class="lines">@@ -38,6 +38,8 @@
</span><span class="cx">     EncodedJSValue vmEntryToNative(void*, VM*, ProtoCallFrame*);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+EncodedJSValue JS_EXPORT_PRIVATE vmEntryToWASM(void*, VM*, ProtoCallFrame*);
+
</ins><span class="cx"> namespace LLInt {
</span><span class="cx"> 
</span><span class="cx"> MacroAssemblerCodeRef functionForCallEntryThunkGenerator(VM*);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestWASMcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/testWASM.cpp (205329 => 205330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/testWASM.cpp        2016-09-02 01:16:56 UTC (rev 205329)
+++ trunk/Source/JavaScriptCore/testWASM.cpp        2016-09-02 01:19:42 UTC (rev 205330)
</span><span class="lines">@@ -27,7 +27,10 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;B3Compilation.h&quot;
</span><span class="cx"> #include &quot;InitializeThreading.h&quot;
</span><ins>+#include &quot;JSCJSValueInlines.h&quot;
</ins><span class="cx"> #include &quot;JSString.h&quot;
</span><ins>+#include &quot;LLIntThunks.h&quot;
+#include &quot;ProtoCallFrame.h&quot;
</ins><span class="cx"> #include &quot;VM.h&quot;
</span><span class="cx"> #include &quot;WASMPlan.h&quot;
</span><span class="cx"> #include &lt;wtf/DataLog.h&gt;
</span><span class="lines">@@ -190,19 +193,38 @@
</span><span class="cx"> using namespace WASM;
</span><span class="cx"> using namespace B3;
</span><span class="cx"> 
</span><del>-template&lt;typename T, typename... Arguments&gt;
-T invoke(MacroAssemblerCodePtr ptr, Arguments... arguments)
</del><ins>+template&lt;typename T&gt;
+T invoke(MacroAssemblerCodePtr ptr, std::initializer_list&lt;JSValue&gt; args)
</ins><span class="cx"> {
</span><del>-    T (*function)(Arguments...) = bitwise_cast&lt;T(*)(Arguments...)&gt;(ptr.executableAddress());
-    return function(arguments...);
</del><ins>+    JSValue firstArgument;
+    // Since vmEntryToJavaScript expects a this value we claim there is one... there isn't.
+    int argCount = 1;
+    JSValue* remainingArguments = nullptr;
+    if (args.size()) {
+        remainingArguments = const_cast&lt;JSValue*&gt;(args.begin());
+        firstArgument = *remainingArguments;
+        remainingArguments++;
+        argCount = args.size();
+    }
+
+    ProtoCallFrame protoCallFrame;
+    protoCallFrame.init(nullptr, nullptr, firstArgument, argCount, remainingArguments);
+
+    // This won't work for floating point values but we don't have those yet.
+    return static_cast&lt;T&gt;(vmEntryToWASM(ptr.executableAddress(), vm, &amp;protoCallFrame));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-template&lt;typename T, typename... Arguments&gt;
-T invoke(const Compilation&amp; code, Arguments... arguments)
</del><ins>+template&lt;typename T&gt;
+T invoke(const Compilation&amp; code, std::initializer_list&lt;JSValue&gt; args)
</ins><span class="cx"> {
</span><del>-    return invoke&lt;T&gt;(code.code(), arguments...);
</del><ins>+    return invoke&lt;T&gt;(code.code(), args);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+inline JSValue box(uint64_t value)
+{
+    return JSValue::decode(value);
+}
+
</ins><span class="cx"> // For now we inline the test files.
</span><span class="cx"> static void runWASMTests()
</span><span class="cx"> {
</span><span class="lines">@@ -224,7 +246,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // Test this doesn't crash.
</span><del>-        RELEASE_ASSERT(invoke&lt;int&gt;(*plan.result[0]) == 5);
</del><ins>+        RELEASE_ASSERT(invoke&lt;int&gt;(*plan.result[0], { }) == 5);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -246,7 +268,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // Test this doesn't crash.
</span><del>-        RELEASE_ASSERT(invoke&lt;int&gt;(*plan.result[0]) == 11);
</del><ins>+        RELEASE_ASSERT(invoke&lt;int&gt;(*plan.result[0], { }) == 11);
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     {
</span><span class="lines">@@ -267,7 +289,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // Test this doesn't crash.
</span><del>-        RELEASE_ASSERT(invoke&lt;int&gt;(*plan.result[0]) == 11);
</del><ins>+        RELEASE_ASSERT(invoke&lt;int&gt;(*plan.result[0], { }) == 11);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     {
</span><span class="lines">@@ -288,8 +310,30 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // Test this doesn't crash.
</span><del>-        RELEASE_ASSERT(invoke&lt;int&gt;(*plan.result[0]) == 11);
</del><ins>+        RELEASE_ASSERT(invoke&lt;int&gt;(*plan.result[0], { }) == 11);
</ins><span class="cx">     }
</span><ins>+
+    {
+        // Generated from: (module (func $add (param $x i32) (param $y i32) (result i32) (return (i32.add (get_local $x) (get_local $y)))) )
+        Vector&lt;uint8_t&gt; vector = {
+            0x00, 0x61, 0x73, 0x6d, 0x0c, 0x00, 0x00, 0x00, 0x04, 0x74, 0x79, 0x70, 0x65, 0x87, 0x80, 0x80,
+            0x00, 0x01, 0x40, 0x02, 0x01, 0x01, 0x01, 0x01, 0x08, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f,
+            0x6e, 0x82, 0x80, 0x80, 0x00, 0x01, 0x00, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x8e, 0x80, 0x80, 0x00,
+            0x01, 0x89, 0x80, 0x80, 0x00, 0x00, 0x14, 0x00, 0x14, 0x01, 0x40, 0x09, 0x01, 0x0f
+        };
+
+        Plan plan(*vm, vector);
+        if (plan.result.size() != 1 || !plan.result[0]) {
+            dataLogLn(&quot;Module failed to compile correctly.&quot;);
+            CRASH();
+        }
+
+        // Test this doesn't crash.
+        RELEASE_ASSERT(invoke&lt;int&gt;(*plan.result[0], {box(0), box(1)}) == 1);
+        RELEASE_ASSERT(invoke&lt;int&gt;(*plan.result[0], {box(100), box(1)}) == 101);
+        RELEASE_ASSERT(invoke&lt;int&gt;(*plan.result[0], {box(-1), box(1)}) == 0);
+        RELEASE_ASSERT(invoke&lt;int&gt;(*plan.result[0], {box(std::numeric_limits&lt;int&gt;::max()), box(1)}) == std::numeric_limits&lt;int&gt;::min());
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(WEBASSEMBLY)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWASMB3IRGeneratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WASMB3IRGenerator.cpp (205329 => 205330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WASMB3IRGenerator.cpp        2016-09-02 01:16:56 UTC (rev 205329)
+++ trunk/Source/JavaScriptCore/wasm/WASMB3IRGenerator.cpp        2016-09-02 01:19:42 UTC (rev 205330)
</span><span class="lines">@@ -29,9 +29,11 @@
</span><span class="cx"> #if ENABLE(WEBASSEMBLY)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;B3BasicBlockInlines.h&quot;
</span><ins>+#include &quot;B3CallingConventions.h&quot;
</ins><span class="cx"> #include &quot;B3ValueInlines.h&quot;
</span><span class="cx"> #include &quot;B3Variable.h&quot;
</span><span class="cx"> #include &quot;B3VariableValue.h&quot;
</span><ins>+#include &quot;VirtualRegister.h&quot;
</ins><span class="cx"> #include &quot;WASMFunctionParser.h&quot;
</span><span class="cx"> #include &lt;wtf/Optional.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -67,9 +69,12 @@
</span><span class="cx"> 
</span><span class="cx">     B3IRGenerator(Procedure&amp;);
</span><span class="cx"> 
</span><ins>+    void addArguments(const Vector&lt;Type&gt;&amp;);
</ins><span class="cx">     void addLocal(Type, uint32_t);
</span><span class="cx">     ExpressionType addConstant(Type, uint64_t);
</span><span class="cx"> 
</span><ins>+    bool WARN_UNUSED_RETURN getLocal(uint32_t index, ExpressionType&amp; result);
+
</ins><span class="cx">     bool WARN_UNUSED_RETURN binaryOp(BinaryOpType, ExpressionType left, ExpressionType right, ExpressionType&amp; result);
</span><span class="cx">     bool WARN_UNUSED_RETURN unaryOp(UnaryOpType, ExpressionType arg, ExpressionType&amp; result);
</span><span class="cx"> 
</span><span class="lines">@@ -88,6 +93,7 @@
</span><span class="cx">     BasicBlock* m_currentBlock;
</span><span class="cx">     // This is a pair of the continuation and the types expected on the stack for that continuation.
</span><span class="cx">     Vector&lt;std::pair&lt;BasicBlock*, Optional&lt;Vector&lt;Variable*&gt;&gt;&gt;&gt; m_controlStack;
</span><ins>+    Vector&lt;Variable*&gt; m_locals;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> B3IRGenerator::B3IRGenerator(Procedure&amp; procedure)
</span><span class="lines">@@ -96,11 +102,33 @@
</span><span class="cx">     m_currentBlock = m_proc.addBlock();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void B3IRGenerator::addLocal(Type, uint32_t)
</del><ins>+void B3IRGenerator::addLocal(Type type, uint32_t count)
</ins><span class="cx"> {
</span><ins>+    m_locals.reserveCapacity(m_locals.size() + count);
+    for (uint32_t i = 0; i &lt; count; ++i)
+        m_locals.append(m_proc.addVariable(type));
+}
+
+void B3IRGenerator::addArguments(const Vector&lt;Type&gt;&amp; types)
+{
</ins><span class="cx">     // TODO: Add locals.
</span><ins>+    ASSERT(!m_locals.size());
+    m_locals.grow(types.size());
+    jscCallingConvention().iterate(types, m_proc, m_currentBlock, Origin(),
+        [&amp;] (ExpressionType argument, unsigned i) {
+            Variable* argumentVariable = m_proc.addVariable(argument-&gt;type());
+            m_locals[i] = argumentVariable;
+            m_currentBlock-&gt;appendNew&lt;VariableValue&gt;(m_proc, Set, Origin(), argumentVariable, argument);
+        });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool WARN_UNUSED_RETURN B3IRGenerator::getLocal(uint32_t index, ExpressionType&amp; result)
+{
+    ASSERT(m_locals[index]);
+    result = m_currentBlock-&gt;appendNew&lt;VariableValue&gt;(m_proc, B3::Get, Origin(), m_locals[index]);
+    return true;
+}
+
</ins><span class="cx"> bool B3IRGenerator::unaryOp(UnaryOpType op, ExpressionType arg, ExpressionType&amp; result)
</span><span class="cx"> {
</span><span class="cx">     result = m_currentBlock-&gt;appendNew&lt;Value&gt;(m_proc, toB3Op(op), Origin(), arg);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWASMFormath"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WASMFormat.h (205329 => 205330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WASMFormat.h        2016-09-02 01:16:56 UTC (rev 205329)
+++ trunk/Source/JavaScriptCore/wasm/WASMFormat.h        2016-09-02 01:19:42 UTC (rev 205330)
</span><span class="lines">@@ -90,6 +90,7 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> struct FunctionInformation {
</span><ins>+    Signature* signature;
</ins><span class="cx">     size_t start;
</span><span class="cx">     size_t end;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWASMFunctionParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.h (205329 => 205330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.h        2016-09-02 01:16:56 UTC (rev 205329)
+++ trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.h        2016-09-02 01:19:42 UTC (rev 205330)
</span><span class="lines">@@ -61,6 +61,7 @@
</span><span class="cx">     : Parser(sourceBuffer, info.start, info.end)
</span><span class="cx">     , m_context(context)
</span><span class="cx"> {
</span><ins>+    m_context.addArguments(info.signature-&gt;arguments);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template&lt;typename Context&gt;
</span><span class="lines">@@ -138,6 +139,18 @@
</span><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    case OpType::GetLocal: {
+        uint32_t index;
+        if (!parseVarUInt32(index))
+            return false;
+        ExpressionType result;
+        if (!m_context.getLocal(index, result))
+            return false;
+
+        m_expressionStack.append(result);
+        return true;
+    }
+
</ins><span class="cx">     case OpType::Block: {
</span><span class="cx">         if (!m_context.addBlock())
</span><span class="cx">             return false;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWASMModuleParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WASMModuleParser.cpp (205329 => 205330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WASMModuleParser.cpp        2016-09-02 01:16:56 UTC (rev 205329)
+++ trunk/Source/JavaScriptCore/wasm/WASMModuleParser.cpp        2016-09-02 01:19:42 UTC (rev 205330)
</span><span class="lines">@@ -140,6 +140,8 @@
</span><span class="cx">     if (verbose)
</span><span class="cx">         dataLogLn(&quot;count: &quot;, count);
</span><span class="cx"> 
</span><ins>+    m_signatures.resize(count);
+
</ins><span class="cx">     for (uint32_t i = 0; i &lt; count; ++i) {
</span><span class="cx">         uint8_t type;
</span><span class="cx">         if (!parseUInt7(type))
</span><span class="lines">@@ -181,8 +183,7 @@
</span><span class="cx">         } else
</span><span class="cx">             returnType = Type::Void;
</span><span class="cx"> 
</span><del>-        // TODO: Actually do something with this data...
-        UNUSED_PARAM(returnType);
</del><ins>+        m_signatures[i] = { returnType, WTFMove(argumentTypes) };
</ins><span class="cx">     }
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -199,6 +200,11 @@
</span><span class="cx">         uint32_t typeNumber;
</span><span class="cx">         if (!parseVarUInt32(typeNumber))
</span><span class="cx">             return false;
</span><ins>+
+        if (typeNumber &gt;= m_signatures.size())
+            return false;
+
+        m_functions[i].signature = &amp;m_signatures[typeNumber];
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return true;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWASMModuleParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WASMModuleParser.h (205329 => 205330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WASMModuleParser.h        2016-09-02 01:16:56 UTC (rev 205329)
+++ trunk/Source/JavaScriptCore/wasm/WASMModuleParser.h        2016-09-02 01:19:42 UTC (rev 205330)
</span><span class="lines">@@ -58,6 +58,7 @@
</span><span class="cx">     bool WARN_UNUSED_RETURN parseExpression(OpType);
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;FunctionInformation&gt; m_functions;
</span><ins>+    Vector&lt;Signature&gt; m_signatures;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WASM
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWASMOpsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WASMOps.h (205329 => 205330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WASMOps.h        2016-09-02 01:16:56 UTC (rev 205329)
+++ trunk/Source/JavaScriptCore/wasm/WASMOps.h        2016-09-02 01:19:42 UTC (rev 205330)
</span><span class="lines">@@ -32,7 +32,8 @@
</span><span class="cx"> namespace WASM {
</span><span class="cx"> 
</span><span class="cx"> #define FOR_EACH_WASM_SPECIAL_OP(macro) \
</span><del>-    macro(I32Const, 0x10, NA)
</del><ins>+    macro(I32Const, 0x10, NA) \
+    macro(GetLocal, 0x14, NA)
</ins><span class="cx"> 
</span><span class="cx"> #define FOR_EACH_WASM_CONTROL_FLOW_OP(macro) \
</span><span class="cx">     macro(Block, 0x01, NA) \
</span></span></pre>
</div>
</div>

</body>
</html>