<!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>[209312] 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/209312">209312</a></dd>
<dt>Author</dt> <dd>sbarati@apple.com</dd>
<dt>Date</dt> <dd>2016-12-04 13:23:56 -0800 (Sun, 04 Dec 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>We should have a Wasm callee
https://bugs.webkit.org/show_bug.cgi?id=165163

Reviewed by Keith Miller.

This patch adds JSWebAssemblyCallee and stores it into the
callee slot in the call frame as part of the prologue of a
wasm function. This is the first step in implementing
unwinding from/through wasm frames. We will use the callee
to identify that a machine frame belongs to wasm code.

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* jsc.cpp:
(callWasmFunction):
(functionTestWasmModuleFunctions):
* llint/LowLevelInterpreter64.asm:
* runtime/JSGlobalObject.cpp:
* runtime/VM.cpp:
(JSC::VM::VM):
* runtime/VM.h:
* wasm/JSWebAssembly.h:
* wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::B3IRGenerator):
(JSC::Wasm::parseAndCompile):
* wasm/WasmCallingConvention.h:
(JSC::Wasm::CallingConvention::setupFrameInPrologue):
* wasm/WasmFormat.h:
* wasm/WasmPlan.cpp:
(JSC::Wasm::Plan::initializeCallees):
* wasm/WasmPlan.h:
(JSC::Wasm::Plan::compiledFunction):
(JSC::Wasm::Plan::getCompiledFunctions): Deleted.
* wasm/js/JSWebAssemblyCallee.cpp: Added.
(JSC::JSWebAssemblyCallee::JSWebAssemblyCallee):
(JSC::JSWebAssemblyCallee::finishCreation):
(JSC::JSWebAssemblyCallee::destroy):
* wasm/js/JSWebAssemblyCallee.h: Added.
(JSC::JSWebAssemblyCallee::create):
(JSC::JSWebAssemblyCallee::createStructure):
(JSC::JSWebAssemblyCallee::jsEntryPoint):
* wasm/js/JSWebAssemblyModule.cpp:
(JSC::JSWebAssemblyModule::create):
(JSC::JSWebAssemblyModule::JSWebAssemblyModule):
(JSC::JSWebAssemblyModule::visitChildren):
* wasm/js/JSWebAssemblyModule.h:
(JSC::JSWebAssemblyModule::moduleInformation):
(JSC::JSWebAssemblyModule::callee):
(JSC::JSWebAssemblyModule::callees):
(JSC::JSWebAssemblyModule::offsetOfCallees):
(JSC::JSWebAssemblyModule::allocationSize):
(JSC::JSWebAssemblyModule::compiledFunctions): Deleted.
* wasm/js/WebAssemblyFunction.cpp:
(JSC::callWebAssemblyFunction):
(JSC::WebAssemblyFunction::create):
(JSC::WebAssemblyFunction::visitChildren):
(JSC::WebAssemblyFunction::finishCreation):
* wasm/js/WebAssemblyFunction.h:
(JSC::WebAssemblyFunction::webAssemblyCallee):
(JSC::WebAssemblyFunction::instance):
(JSC::WebAssemblyFunction::signature):
(JSC::CallableWebAssemblyFunction::CallableWebAssemblyFunction): Deleted.
(JSC::WebAssemblyFunction::webAssemblyFunctionCell): Deleted.
* wasm/js/WebAssemblyFunctionCell.cpp:
(JSC::WebAssemblyFunctionCell::create): Deleted.
(JSC::WebAssemblyFunctionCell::WebAssemblyFunctionCell): Deleted.
(JSC::WebAssemblyFunctionCell::destroy): Deleted.
(JSC::WebAssemblyFunctionCell::createStructure): Deleted.
* wasm/js/WebAssemblyFunctionCell.h:
(JSC::WebAssemblyFunctionCell::function): Deleted.
* wasm/js/WebAssemblyModuleConstructor.cpp:
(JSC::constructJSWebAssemblyModule):
* wasm/js/WebAssemblyModuleRecord.cpp:
(JSC::WebAssemblyModuleRecord::link):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreCMakeListstxt">trunk/Source/JavaScriptCore/CMakeLists.txt</a></li>
<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="#trunkSourceJavaScriptCorejsccpp">trunk/Source/JavaScriptCore/jsc.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorellintLowLevelInterpreter64asm">trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp">trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeVMcpp">trunk/Source/JavaScriptCore/runtime/VM.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeVMh">trunk/Source/JavaScriptCore/runtime/VM.h</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmJSWebAssemblyh">trunk/Source/JavaScriptCore/wasm/JSWebAssembly.h</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWasmB3IRGeneratorcpp">trunk/Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWasmCallingConventionh">trunk/Source/JavaScriptCore/wasm/WasmCallingConvention.h</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWasmFormath">trunk/Source/JavaScriptCore/wasm/WasmFormat.h</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWasmPlancpp">trunk/Source/JavaScriptCore/wasm/WasmPlan.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWasmPlanh">trunk/Source/JavaScriptCore/wasm/WasmPlan.h</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsJSWebAssemblyModulecpp">trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyModule.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsJSWebAssemblyModuleh">trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyModule.h</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyFunctioncpp">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyFunctionh">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunction.h</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyFunctionCellcpp">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunctionCell.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyFunctionCellh">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunctionCell.h</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyModuleConstructorcpp">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleConstructor.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyModuleRecordcpp">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCorewasmjsJSWebAssemblyCalleecpp">trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyCallee.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsJSWebAssemblyCalleeh">trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyCallee.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/CMakeLists.txt (209311 => 209312)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/CMakeLists.txt        2016-12-04 20:22:58 UTC (rev 209311)
+++ trunk/Source/JavaScriptCore/CMakeLists.txt        2016-12-04 21:23:56 UTC (rev 209312)
</span><span class="lines">@@ -905,6 +905,7 @@
</span><span class="cx">     wasm/WasmPlan.cpp
</span><span class="cx">     wasm/WasmValidate.cpp
</span><span class="cx"> 
</span><ins>+    wasm/js/JSWebAssemblyCallee.cpp
</ins><span class="cx">     wasm/js/JSWebAssemblyCompileError.cpp
</span><span class="cx">     wasm/js/JSWebAssemblyInstance.cpp
</span><span class="cx">     wasm/js/JSWebAssemblyMemory.cpp
</span><span class="lines">@@ -914,7 +915,6 @@
</span><span class="cx">     wasm/js/WebAssemblyCompileErrorConstructor.cpp
</span><span class="cx">     wasm/js/WebAssemblyCompileErrorPrototype.cpp
</span><span class="cx">     wasm/js/WebAssemblyFunction.cpp
</span><del>-    wasm/js/WebAssemblyFunctionCell.cpp
</del><span class="cx">     wasm/js/WebAssemblyInstanceConstructor.cpp
</span><span class="cx">     wasm/js/WebAssemblyInstancePrototype.cpp
</span><span class="cx">     wasm/js/WebAssemblyMemoryConstructor.cpp
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (209311 => 209312)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-12-04 20:22:58 UTC (rev 209311)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-12-04 21:23:56 UTC (rev 209312)
</span><span class="lines">@@ -1,3 +1,80 @@
</span><ins>+2016-12-04  Saam Barati  &lt;sbarati@apple.com&gt;
+
+        We should have a Wasm callee
+        https://bugs.webkit.org/show_bug.cgi?id=165163
+
+        Reviewed by Keith Miller.
+
+        This patch adds JSWebAssemblyCallee and stores it into the
+        callee slot in the call frame as part of the prologue of a
+        wasm function. This is the first step in implementing
+        unwinding from/through wasm frames. We will use the callee
+        to identify that a machine frame belongs to wasm code.
+
+        * CMakeLists.txt:
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * jsc.cpp:
+        (callWasmFunction):
+        (functionTestWasmModuleFunctions):
+        * llint/LowLevelInterpreter64.asm:
+        * runtime/JSGlobalObject.cpp:
+        * runtime/VM.cpp:
+        (JSC::VM::VM):
+        * runtime/VM.h:
+        * wasm/JSWebAssembly.h:
+        * wasm/WasmB3IRGenerator.cpp:
+        (JSC::Wasm::B3IRGenerator::B3IRGenerator):
+        (JSC::Wasm::parseAndCompile):
+        * wasm/WasmCallingConvention.h:
+        (JSC::Wasm::CallingConvention::setupFrameInPrologue):
+        * wasm/WasmFormat.h:
+        * wasm/WasmPlan.cpp:
+        (JSC::Wasm::Plan::initializeCallees):
+        * wasm/WasmPlan.h:
+        (JSC::Wasm::Plan::compiledFunction):
+        (JSC::Wasm::Plan::getCompiledFunctions): Deleted.
+        * wasm/js/JSWebAssemblyCallee.cpp: Added.
+        (JSC::JSWebAssemblyCallee::JSWebAssemblyCallee):
+        (JSC::JSWebAssemblyCallee::finishCreation):
+        (JSC::JSWebAssemblyCallee::destroy):
+        * wasm/js/JSWebAssemblyCallee.h: Added.
+        (JSC::JSWebAssemblyCallee::create):
+        (JSC::JSWebAssemblyCallee::createStructure):
+        (JSC::JSWebAssemblyCallee::jsEntryPoint):
+        * wasm/js/JSWebAssemblyModule.cpp:
+        (JSC::JSWebAssemblyModule::create):
+        (JSC::JSWebAssemblyModule::JSWebAssemblyModule):
+        (JSC::JSWebAssemblyModule::visitChildren):
+        * wasm/js/JSWebAssemblyModule.h:
+        (JSC::JSWebAssemblyModule::moduleInformation):
+        (JSC::JSWebAssemblyModule::callee):
+        (JSC::JSWebAssemblyModule::callees):
+        (JSC::JSWebAssemblyModule::offsetOfCallees):
+        (JSC::JSWebAssemblyModule::allocationSize):
+        (JSC::JSWebAssemblyModule::compiledFunctions): Deleted.
+        * wasm/js/WebAssemblyFunction.cpp:
+        (JSC::callWebAssemblyFunction):
+        (JSC::WebAssemblyFunction::create):
+        (JSC::WebAssemblyFunction::visitChildren):
+        (JSC::WebAssemblyFunction::finishCreation):
+        * wasm/js/WebAssemblyFunction.h:
+        (JSC::WebAssemblyFunction::webAssemblyCallee):
+        (JSC::WebAssemblyFunction::instance):
+        (JSC::WebAssemblyFunction::signature):
+        (JSC::CallableWebAssemblyFunction::CallableWebAssemblyFunction): Deleted.
+        (JSC::WebAssemblyFunction::webAssemblyFunctionCell): Deleted.
+        * wasm/js/WebAssemblyFunctionCell.cpp:
+        (JSC::WebAssemblyFunctionCell::create): Deleted.
+        (JSC::WebAssemblyFunctionCell::WebAssemblyFunctionCell): Deleted.
+        (JSC::WebAssemblyFunctionCell::destroy): Deleted.
+        (JSC::WebAssemblyFunctionCell::createStructure): Deleted.
+        * wasm/js/WebAssemblyFunctionCell.h:
+        (JSC::WebAssemblyFunctionCell::function): Deleted.
+        * wasm/js/WebAssemblyModuleConstructor.cpp:
+        (JSC::constructJSWebAssemblyModule):
+        * wasm/js/WebAssemblyModuleRecord.cpp:
+        (JSC::WebAssemblyModuleRecord::link):
+
</ins><span class="cx"> 2016-12-04  Matt Baker  &lt;mattbaker@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Assertion Failures breakpoint should respect global Breakpoints enabled setting
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (209311 => 209312)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2016-12-04 20:22:58 UTC (rev 209311)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2016-12-04 21:23:56 UTC (rev 209312)
</span><span class="lines">@@ -1433,6 +1433,8 @@
</span><span class="cx">                 79D5CD5A1C1106A900CECA07 /* SamplingProfiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 79D5CD581C1106A900CECA07 /* SamplingProfiler.cpp */; };
</span><span class="cx">                 79D5CD5B1C1106A900CECA07 /* SamplingProfiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 79D5CD591C1106A900CECA07 /* SamplingProfiler.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 79DFCBDB1D88C59600527D03 /* HasOwnPropertyCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 79DFCBDA1D88C59600527D03 /* HasOwnPropertyCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                79E423E21DEE65320078D355 /* JSWebAssemblyCallee.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 79E423E01DEE65320078D355 /* JSWebAssemblyCallee.cpp */; };
+                79E423E31DEE65320078D355 /* JSWebAssemblyCallee.h in Headers */ = {isa = PBXBuildFile; fileRef = 79E423E11DEE65320078D355 /* JSWebAssemblyCallee.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 79EE0BFF1B4AFB85000385C9 /* VariableEnvironment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 79EE0BFD1B4AFB85000385C9 /* VariableEnvironment.cpp */; };
</span><span class="cx">                 79EE0C001B4AFB85000385C9 /* VariableEnvironment.h in Headers */ = {isa = PBXBuildFile; fileRef = 79EE0BFE1B4AFB85000385C9 /* VariableEnvironment.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 79F8FC1E1B9FED0F00CA66AB /* DFGMaximalFlushInsertionPhase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 79F8FC1C1B9FED0F00CA66AB /* DFGMaximalFlushInsertionPhase.cpp */; };
</span><span class="lines">@@ -2008,8 +2010,6 @@
</span><span class="cx">                 AD4937C41DDBE6140077C807 /* AbstractModuleRecord.h in Headers */ = {isa = PBXBuildFile; fileRef = AD4937C21DDBE60A0077C807 /* AbstractModuleRecord.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 AD4937C71DDD0AAE0077C807 /* WebAssemblyModuleRecord.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD4937C51DDCDCF00077C807 /* WebAssemblyModuleRecord.cpp */; };
</span><span class="cx">                 AD4937C81DDD0AAE0077C807 /* WebAssemblyModuleRecord.h in Headers */ = {isa = PBXBuildFile; fileRef = AD4937C61DDCDCF00077C807 /* WebAssemblyModuleRecord.h */; };
</span><del>-                AD4937D11DDD27DE0077C807 /* WebAssemblyFunctionCell.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD4937CD1DDD27D90077C807 /* WebAssemblyFunctionCell.cpp */; };
-                AD4937D21DDD27DE0077C807 /* WebAssemblyFunctionCell.h in Headers */ = {isa = PBXBuildFile; fileRef = AD4937CE1DDD27D90077C807 /* WebAssemblyFunctionCell.h */; };
</del><span class="cx">                 AD4937D31DDD27DE0077C807 /* WebAssemblyFunction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD4937C91DDD27340077C807 /* WebAssemblyFunction.cpp */; };
</span><span class="cx">                 AD4937D41DDD27DE0077C807 /* WebAssemblyFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = AD4937CA1DDD27340077C807 /* WebAssemblyFunction.h */; };
</span><span class="cx">                 AD86A93E1AA4D88D002FE77F /* WeakGCMapInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = AD86A93D1AA4D87C002FE77F /* WeakGCMapInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -3858,6 +3858,8 @@
</span><span class="cx">                 79D5CD581C1106A900CECA07 /* SamplingProfiler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SamplingProfiler.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 79D5CD591C1106A900CECA07 /* SamplingProfiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SamplingProfiler.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 79DFCBDA1D88C59600527D03 /* HasOwnPropertyCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HasOwnPropertyCache.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                79E423E01DEE65320078D355 /* JSWebAssemblyCallee.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSWebAssemblyCallee.cpp; path = js/JSWebAssemblyCallee.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                79E423E11DEE65320078D355 /* JSWebAssemblyCallee.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSWebAssemblyCallee.h; path = js/JSWebAssemblyCallee.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 79EE0BFD1B4AFB85000385C9 /* VariableEnvironment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VariableEnvironment.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 79EE0BFE1B4AFB85000385C9 /* VariableEnvironment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VariableEnvironment.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 79F8FC1C1B9FED0F00CA66AB /* DFGMaximalFlushInsertionPhase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGMaximalFlushInsertionPhase.cpp; path = dfg/DFGMaximalFlushInsertionPhase.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -4479,8 +4481,6 @@
</span><span class="cx">                 AD4937C61DDCDCF00077C807 /* WebAssemblyModuleRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebAssemblyModuleRecord.h; path = js/WebAssemblyModuleRecord.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 AD4937C91DDD27340077C807 /* WebAssemblyFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebAssemblyFunction.cpp; path = js/WebAssemblyFunction.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 AD4937CA1DDD27340077C807 /* WebAssemblyFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebAssemblyFunction.h; path = js/WebAssemblyFunction.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                AD4937CD1DDD27D90077C807 /* WebAssemblyFunctionCell.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebAssemblyFunctionCell.cpp; path = js/WebAssemblyFunctionCell.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                AD4937CE1DDD27D90077C807 /* WebAssemblyFunctionCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebAssemblyFunctionCell.h; path = js/WebAssemblyFunctionCell.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 AD86A93D1AA4D87C002FE77F /* WeakGCMapInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakGCMapInlines.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 ADDB1F6218D77DB7009B58A8 /* OpaqueRootSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpaqueRootSet.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 B59F89371891AD3300D5CCDC /* UnlinkedInstructionStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnlinkedInstructionStream.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -7569,8 +7569,6 @@
</span><span class="cx">                 AD2FCB8A1DB5840000B3E736 /* js */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><del>-                                AD4937CD1DDD27D90077C807 /* WebAssemblyFunctionCell.cpp */,
-                                AD4937CE1DDD27D90077C807 /* WebAssemblyFunctionCell.h */,
</del><span class="cx">                                 AD4937C91DDD27340077C807 /* WebAssemblyFunction.cpp */,
</span><span class="cx">                                 AD4937CA1DDD27340077C807 /* WebAssemblyFunction.h */,
</span><span class="cx">                                 AD4937C51DDCDCF00077C807 /* WebAssemblyModuleRecord.cpp */,
</span><span class="lines">@@ -7577,6 +7575,8 @@
</span><span class="cx">                                 AD4937C61DDCDCF00077C807 /* WebAssemblyModuleRecord.h */,
</span><span class="cx">                                 AD2FCC261DB838C400B3E736 /* WebAssemblyPrototype.cpp */,
</span><span class="cx">                                 AD2FCC271DB838C400B3E736 /* WebAssemblyPrototype.h */,
</span><ins>+                                79E423E01DEE65320078D355 /* JSWebAssemblyCallee.cpp */,
+                                79E423E11DEE65320078D355 /* JSWebAssemblyCallee.h */,
</ins><span class="cx">                                 AD2FCBA61DB58DA400B3E736 /* JSWebAssemblyCompileError.cpp */,
</span><span class="cx">                                 AD2FCBA71DB58DA400B3E736 /* JSWebAssemblyCompileError.h */,
</span><span class="cx">                                 AD2FCBA81DB58DA400B3E736 /* JSWebAssemblyInstance.cpp */,
</span><span class="lines">@@ -7869,6 +7869,7 @@
</span><span class="cx">                                 6514F21918B3E1670098FF8B /* Bytecodes.h in Headers */,
</span><span class="cx">                                 0F885E111849A3BE00F1E3FA /* BytecodeUseDef.h in Headers */,
</span><span class="cx">                                 0F8023EA1613832B00A0BA45 /* ByValInfo.h in Headers */,
</span><ins>+                                79E423E31DEE65320078D355 /* JSWebAssemblyCallee.h in Headers */,
</ins><span class="cx">                                 65B8392E1BACAD360044E824 /* CachedRecovery.h in Headers */,
</span><span class="cx">                                 BC18C3ED0E16F5CD00B34460 /* CallData.h in Headers */,
</span><span class="cx">                                 0F64B27A1A7957B2006E4E66 /* CallEdge.h in Headers */,
</span><span class="lines">@@ -8009,7 +8010,6 @@
</span><span class="cx">                                 0F7B294D14C3CD4C007C3DB1 /* DFGCommon.h in Headers */,
</span><span class="cx">                                 53529A4C1C457B75000B49C6 /* APIUtils.h in Headers */,
</span><span class="cx">                                 0FEA0A32170D40BF00BB722C /* DFGCommonData.h in Headers */,
</span><del>-                                AD4937D21DDD27DE0077C807 /* WebAssemblyFunctionCell.h in Headers */,
</del><span class="cx">                                 0F725CB01C506D3B00AD943A /* B3FoldPathConstants.h in Headers */,
</span><span class="cx">                                 0F38B01817CFE75500B144D3 /* DFGCompilationKey.h in Headers */,
</span><span class="cx">                                 0F9D4C111C3E2C74006CD984 /* FTLPatchpointExceptionHandle.h in Headers */,
</span><span class="lines">@@ -10135,7 +10135,6 @@
</span><span class="cx">                                 1482B74E0A43032800517CFC /* JSStringRef.cpp in Sources */,
</span><span class="cx">                                 146AAB380B66A94400E55F16 /* JSStringRefCF.cpp in Sources */,
</span><span class="cx">                                 0F919D0C157EE09F004A4E7D /* JSSymbolTableObject.cpp in Sources */,
</span><del>-                                AD4937D11DDD27DE0077C807 /* WebAssemblyFunctionCell.cpp in Sources */,
</del><span class="cx">                                 70ECA6051AFDBEA200449739 /* JSTemplateRegistryKey.cpp in Sources */,
</span><span class="cx">                                 0F2B66FA17B6B5AB00A7AE3F /* JSTypedArrayConstructors.cpp in Sources */,
</span><span class="cx">                                 0F9630391D4192C6005609D9 /* AllocatorAttributes.cpp in Sources */,
</span><span class="lines">@@ -10156,6 +10155,7 @@
</span><span class="cx">                                 BCFD8C920EEB2EE700283848 /* JumpTable.cpp in Sources */,
</span><span class="cx">                                 0FB5467914F5C46B002C2989 /* LazyOperandValueProfile.cpp in Sources */,
</span><span class="cx">                                 148F21B0107EC5410042EC2C /* Lexer.cpp in Sources */,
</span><ins>+                                79E423E21DEE65320078D355 /* JSWebAssemblyCallee.cpp in Sources */,
</ins><span class="cx">                                 0FF4275715914A20004CB9FF /* LinkBuffer.cpp in Sources */,
</span><span class="cx">                                 A7E2EA6C0FB460CF00601F06 /* LiteralParser.cpp in Sources */,
</span><span class="cx">                                 A5A1A0951D8CB341004C2EB8 /* DebuggerParseData.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejsccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jsc.cpp (209311 => 209312)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jsc.cpp        2016-12-04 20:22:58 UTC (rev 209311)
+++ trunk/Source/JavaScriptCore/jsc.cpp        2016-12-04 21:23:56 UTC (rev 209312)
</span><span class="lines">@@ -53,6 +53,7 @@
</span><span class="cx"> #include &quot;JSProxy.h&quot;
</span><span class="cx"> #include &quot;JSString.h&quot;
</span><span class="cx"> #include &quot;JSTypedArrays.h&quot;
</span><ins>+#include &quot;JSWebAssemblyCallee.h&quot;
</ins><span class="cx"> #include &quot;LLIntData.h&quot;
</span><span class="cx"> #include &quot;LLIntThunks.h&quot;
</span><span class="cx"> #include &quot;ObjectConstructor.h&quot;
</span><span class="lines">@@ -2566,7 +2567,7 @@
</span><span class="cx">     return JSValue::decode(bitwise_cast&lt;uint64_t&gt;(result));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static JSValue callWasmFunction(VM* vm, const B3::Compilation&amp; code, Vector&lt;JSValue&gt;&amp; boxedArgs)
</del><ins>+static JSValue callWasmFunction(VM* vm, JSGlobalObject* globalObject, JSWebAssemblyCallee* wasmCallee, Vector&lt;JSValue&gt;&amp; boxedArgs)
</ins><span class="cx"> {
</span><span class="cx">     JSValue firstArgument;
</span><span class="cx">     int argCount = 1;
</span><span class="lines">@@ -2579,9 +2580,9 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     ProtoCallFrame protoCallFrame;
</span><del>-    protoCallFrame.init(nullptr, nullptr, firstArgument, argCount, remainingArgs);
</del><ins>+    protoCallFrame.init(nullptr, globalObject-&gt;globalExec()-&gt;jsCallee(), firstArgument, argCount, remainingArgs);
</ins><span class="cx"> 
</span><del>-    return JSValue::decode(vmEntryToWasm(code.code().executableAddress(), vm, &amp;protoCallFrame));
</del><ins>+    return JSValue::decode(vmEntryToWasm(wasmCallee-&gt;jsEntryPoint(), vm, &amp;protoCallFrame));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // testWasmModule(JSArrayBufferView source, number functionCount, ...[[WasmValue, [WasmValue]]]) where the ith copy of [[result, [args]]] is a list
</span><span class="lines">@@ -2610,10 +2611,18 @@
</span><span class="cx">     if (plan.compiledFunctionCount() != functionCount)
</span><span class="cx">         CRASH();
</span><span class="cx"> 
</span><ins>+    MarkedArgumentBuffer callees;
+    {
+        unsigned lastIndex = UINT_MAX;
+        plan.initializeCallees(exec-&gt;lexicalGlobalObject(),
+            [&amp;] (unsigned calleeIndex, JSWebAssemblyCallee* callee) {
+                RELEASE_ASSERT(!calleeIndex || (calleeIndex - 1 == lastIndex));
+                callees.append(callee);
+                lastIndex = calleeIndex;
+            });
+    }
+
</ins><span class="cx">     for (uint32_t i = 0; i &lt; functionCount; ++i) {
</span><del>-        if (!plan.compiledFunction(i))
-            dataLogLn(&quot;failed to compile function at index&quot;, i);
-
</del><span class="cx">         JSArray* testCases = jsCast&lt;JSArray*&gt;(exec-&gt;argument(i + 2));
</span><span class="cx">         for (unsigned testIndex = 0; testIndex &lt; testCases-&gt;length(); ++testIndex) {
</span><span class="cx">             JSArray* test = jsCast&lt;JSArray*&gt;(testCases-&gt;getIndexQuickly(testIndex));
</span><span class="lines">@@ -2624,7 +2633,7 @@
</span><span class="cx">             for (unsigned argIndex = 0; argIndex &lt; arguments-&gt;length(); ++argIndex)
</span><span class="cx">                 boxedArgs.append(box(exec, vm, arguments-&gt;getIndexQuickly(argIndex)));
</span><span class="cx"> 
</span><del>-            JSValue callResult = callWasmFunction(&amp;vm, *plan.compiledFunction(i)-&gt;jsEntryPoint, boxedArgs);
</del><ins>+            JSValue callResult = callWasmFunction(&amp;vm, exec-&gt;lexicalGlobalObject(), jsCast&lt;JSWebAssemblyCallee*&gt;(callees.at(i)), boxedArgs);
</ins><span class="cx">             JSValue expected = box(exec, vm, result);
</span><span class="cx">             if (callResult != expected) {
</span><span class="cx">                 dataLog(&quot;Arguments: &quot;);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorellintLowLevelInterpreter64asm"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm (209311 => 209312)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm        2016-12-04 20:22:58 UTC (rev 209311)
+++ trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm        2016-12-04 21:23:56 UTC (rev 209312)
</span><span class="lines">@@ -183,6 +183,7 @@
</span><span class="cx">     move 4, t3
</span><span class="cx"> 
</span><span class="cx"> .copyHeaderLoop:
</span><ins>+    # Copy the CodeBlock/Callee/ArgumentCount/|this| from protoCallFrame into the callee frame.
</ins><span class="cx">     subi 1, t3
</span><span class="cx">     loadq [protoCallFrame, t3, 8], extraTempReg
</span><span class="cx">     storeq extraTempReg, CodeBlock[sp, t3, 8]
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp (209311 => 209312)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2016-12-04 20:22:58 UTC (rev 209311)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2016-12-04 21:23:56 UTC (rev 209312)
</span><span class="lines">@@ -117,6 +117,7 @@
</span><span class="cx"> #include &quot;JSWeakMap.h&quot;
</span><span class="cx"> #include &quot;JSWeakSet.h&quot;
</span><span class="cx"> #include &quot;JSWebAssembly.h&quot;
</span><ins>+#include &quot;JSWebAssemblyCallee.h&quot;
</ins><span class="cx"> #include &quot;JSWithScope.h&quot;
</span><span class="cx"> #include &quot;LazyClassStructureInlines.h&quot;
</span><span class="cx"> #include &quot;LazyPropertyInlines.h&quot;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeVMcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/VM.cpp (209311 => 209312)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/VM.cpp        2016-12-04 20:22:58 UTC (rev 209311)
+++ trunk/Source/JavaScriptCore/runtime/VM.cpp        2016-12-04 21:23:56 UTC (rev 209312)
</span><span class="lines">@@ -230,6 +230,7 @@
</span><span class="cx">     functionExecutableStructure.set(*this, FunctionExecutable::createStructure(*this, 0, jsNull()));
</span><span class="cx"> #if ENABLE(WEBASSEMBLY)
</span><span class="cx">     webAssemblyExecutableStructure.set(*this, WebAssemblyExecutable::createStructure(*this, 0, jsNull()));
</span><ins>+    webAssemblyCalleeStructure.set(*this, JSWebAssemblyCallee::createStructure(*this, 0, jsNull()));
</ins><span class="cx"> #endif
</span><span class="cx">     moduleProgramExecutableStructure.set(*this, ModuleProgramExecutable::createStructure(*this, 0, jsNull()));
</span><span class="cx">     regExpStructure.set(*this, RegExp::createStructure(*this, 0, jsNull()));
</span><span class="lines">@@ -260,7 +261,6 @@
</span><span class="cx">     functionCodeBlockStructure.set(*this, FunctionCodeBlock::createStructure(*this, 0, jsNull()));
</span><span class="cx"> #if ENABLE(WEBASSEMBLY)
</span><span class="cx">     webAssemblyCodeBlockStructure.set(*this, WebAssemblyCodeBlock::createStructure(*this, 0, jsNull()));
</span><del>-    webAssemblyFunctionCellStructure.set(*this, WebAssemblyFunctionCell::createStructure(*this, 0, jsNull()));
</del><span class="cx"> #endif
</span><span class="cx">     hashMapBucketSetStructure.set(*this, HashMapBucket&lt;HashMapBucketDataKey&gt;::createStructure(*this, 0, jsNull()));
</span><span class="cx">     hashMapBucketMapStructure.set(*this, HashMapBucket&lt;HashMapBucketDataKeyValue&gt;::createStructure(*this, 0, jsNull()));
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeVMh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/VM.h (209311 => 209312)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/VM.h        2016-12-04 20:22:58 UTC (rev 209311)
+++ trunk/Source/JavaScriptCore/runtime/VM.h        2016-12-04 21:23:56 UTC (rev 209312)
</span><span class="lines">@@ -310,7 +310,7 @@
</span><span class="cx">     Strong&lt;Structure&gt; functionExecutableStructure;
</span><span class="cx"> #if ENABLE(WEBASSEMBLY)
</span><span class="cx">     Strong&lt;Structure&gt; webAssemblyExecutableStructure;
</span><del>-    Strong&lt;Structure&gt; webAssemblyFunctionCellStructure;
</del><ins>+    Strong&lt;Structure&gt; webAssemblyCalleeStructure;
</ins><span class="cx"> #endif
</span><span class="cx">     Strong&lt;Structure&gt; moduleProgramExecutableStructure;
</span><span class="cx">     Strong&lt;Structure&gt; regExpStructure;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmJSWebAssemblyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/JSWebAssembly.h (209311 => 209312)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/JSWebAssembly.h        2016-12-04 20:22:58 UTC (rev 209311)
+++ trunk/Source/JavaScriptCore/wasm/JSWebAssembly.h        2016-12-04 21:23:56 UTC (rev 209312)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> #if ENABLE(WEBASSEMBLY)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;JSObject.h&quot;
</span><ins>+#include &quot;js/JSWebAssemblyCallee.h&quot;
</ins><span class="cx"> #include &quot;js/JSWebAssemblyCompileError.h&quot;
</span><span class="cx"> #include &quot;js/JSWebAssemblyInstance.h&quot;
</span><span class="cx"> #include &quot;js/JSWebAssemblyMemory.h&quot;
</span><span class="lines">@@ -37,7 +38,6 @@
</span><span class="cx"> #include &quot;js/WebAssemblyCompileErrorConstructor.h&quot;
</span><span class="cx"> #include &quot;js/WebAssemblyCompileErrorPrototype.h&quot;
</span><span class="cx"> #include &quot;js/WebAssemblyFunction.h&quot;
</span><del>-#include &quot;js/WebAssemblyFunctionCell.h&quot;
</del><span class="cx"> #include &quot;js/WebAssemblyInstanceConstructor.h&quot;
</span><span class="cx"> #include &quot;js/WebAssemblyInstancePrototype.h&quot;
</span><span class="cx"> #include &quot;js/WebAssemblyMemoryConstructor.h&quot;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWasmB3IRGeneratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp (209311 => 209312)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp        2016-12-04 20:22:58 UTC (rev 209311)
+++ trunk/Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp        2016-12-04 21:23:56 UTC (rev 209312)
</span><span class="lines">@@ -129,7 +129,7 @@
</span><span class="cx"> 
</span><span class="cx">     static constexpr ExpressionType emptyExpression = nullptr;
</span><span class="cx"> 
</span><del>-    B3IRGenerator(Memory*, Procedure&amp;, Vector&lt;UnlinkedCall&gt;&amp; unlinkedCalls);
</del><ins>+    B3IRGenerator(Memory*, Procedure&amp;, FunctionCompilation*);
</ins><span class="cx"> 
</span><span class="cx">     bool WARN_UNUSED_RETURN addArguments(const Vector&lt;Type&gt;&amp;);
</span><span class="cx">     bool WARN_UNUSED_RETURN addLocal(Type, uint32_t);
</span><span class="lines">@@ -189,10 +189,10 @@
</span><span class="cx">     Value* m_zeroValues[numTypes];
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-B3IRGenerator::B3IRGenerator(Memory* memory, Procedure&amp; procedure, Vector&lt;UnlinkedCall&gt;&amp; unlinkedCalls)
</del><ins>+B3IRGenerator::B3IRGenerator(Memory* memory, Procedure&amp; procedure, FunctionCompilation* compilation)
</ins><span class="cx">     : m_memory(memory)
</span><span class="cx">     , m_proc(procedure)
</span><del>-    , m_unlinkedCalls(unlinkedCalls)
</del><ins>+    , m_unlinkedCalls(compilation-&gt;unlinkedCalls)
</ins><span class="cx"> {
</span><span class="cx">     m_currentBlock = m_proc.addBlock();
</span><span class="cx"> 
</span><span class="lines">@@ -224,6 +224,8 @@
</span><span class="cx">             jit.breakpoint();
</span><span class="cx">         });
</span><span class="cx">     }
</span><ins>+
+    wasmCallingConvention().setupFrameInPrologue(compilation, m_proc, Origin(), m_currentBlock);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Value* B3IRGenerator::zeroForType(Type type)
</span><span class="lines">@@ -741,7 +743,7 @@
</span><span class="cx">     auto result = std::make_unique&lt;FunctionCompilation&gt;();
</span><span class="cx"> 
</span><span class="cx">     Procedure procedure;
</span><del>-    B3IRGenerator context(memory, procedure, result-&gt;unlinkedCalls);
</del><ins>+    B3IRGenerator context(memory, procedure, result.get());
</ins><span class="cx">     FunctionParser&lt;B3IRGenerator&gt; parser(context, functionStart, functionLength, signature, functions);
</span><span class="cx">     if (!parser.parse())
</span><span class="cx">         RELEASE_ASSERT_NOT_REACHED();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWasmCallingConventionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WasmCallingConvention.h (209311 => 209312)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WasmCallingConvention.h        2016-12-04 20:22:58 UTC (rev 209311)
+++ trunk/Source/JavaScriptCore/wasm/WasmCallingConvention.h        2016-12-04 21:23:56 UTC (rev 209312)
</span><span class="lines">@@ -83,6 +83,40 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> public:
</span><ins>+    void setupFrameInPrologue(FunctionCompilation* compilation, B3::Procedure&amp; proc, B3::Origin origin, B3::BasicBlock* block) const
+    {
+        static_assert(CallFrameSlot::callee * sizeof(Register) &lt; headerSize, &quot;We rely on this here for now.&quot;);
+        static_assert(CallFrameSlot::codeBlock * sizeof(Register) &lt; headerSize, &quot;We rely on this here for now.&quot;);
+
+        B3::PatchpointValue* getCalleePatchpoint = block-&gt;appendNew&lt;B3::PatchpointValue&gt;(proc, B3::Int64, origin);
+        getCalleePatchpoint-&gt;resultConstraint = B3::ValueRep::SomeRegister;
+        getCalleePatchpoint-&gt;effects = B3::Effects::none();
+        getCalleePatchpoint-&gt;setGenerator(
+            [=] (CCallHelpers&amp; jit, const B3::StackmapGenerationParams&amp; params) {
+                GPRReg result = params[0].gpr();
+                MacroAssembler::DataLabelPtr moveLocation = jit.moveWithPatch(MacroAssembler::TrustedImmPtr(nullptr), result);
+                jit.addLinkTask([=] (LinkBuffer&amp; linkBuffer) {
+                    compilation-&gt;calleeMoveLocation = linkBuffer.locationOf(moveLocation);
+                });
+            });
+
+        B3::Value* framePointer = block-&gt;appendNew&lt;B3::Value&gt;(proc, B3::FramePointer, origin);
+        B3::Value* offsetOfCallee = block-&gt;appendNew&lt;B3::Const64Value&gt;(proc, origin, CallFrameSlot::callee * sizeof(Register));
+        block-&gt;appendNew&lt;B3::MemoryValue&gt;(proc, B3::Store, origin,
+            getCalleePatchpoint,
+            block-&gt;appendNew&lt;B3::Value&gt;(proc, B3::Add, origin, framePointer, offsetOfCallee));
+
+        // FIXME: We shouldn't have to store zero into the CodeBlock* spot in the call frame,
+        // but there are places that interpret non-null CodeBlock slot to mean a valid CodeBlock.
+        // When doing unwinding, we'll need to verify that the entire runtime is OK with a non-null
+        // CodeBlock not implying that the CodeBlock is valid.
+        // https://bugs.webkit.org/show_bug.cgi?id=165321
+        B3::Value* offsetOfCodeBlock = block-&gt;appendNew&lt;B3::Const64Value&gt;(proc, origin, CallFrameSlot::codeBlock * sizeof(Register));
+        block-&gt;appendNew&lt;B3::MemoryValue&gt;(proc, B3::Store, origin,
+            block-&gt;appendNew&lt;B3::Const64Value&gt;(proc, origin, 0),
+            block-&gt;appendNew&lt;B3::Value&gt;(proc, B3::Add, origin, framePointer, offsetOfCodeBlock));
+    }
+
</ins><span class="cx">     template&lt;typename Functor&gt;
</span><span class="cx">     void loadArguments(const Vector&lt;Type&gt;&amp; argumentTypes, B3::Procedure&amp; proc, B3::BasicBlock* block, B3::Origin origin, const Functor&amp; functor) const
</span><span class="cx">     {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWasmFormath"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WasmFormat.h (209311 => 209312)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WasmFormat.h        2016-12-04 20:22:58 UTC (rev 209311)
+++ trunk/Source/JavaScriptCore/wasm/WasmFormat.h        2016-12-04 21:23:56 UTC (rev 209312)
</span><span class="lines">@@ -135,6 +135,7 @@
</span><span class="cx"> 
</span><span class="cx"> struct FunctionCompilation {
</span><span class="cx">     Vector&lt;UnlinkedCall&gt; unlinkedCalls;
</span><ins>+    CodeLocationDataLabelPtr calleeMoveLocation;
</ins><span class="cx">     std::unique_ptr&lt;B3::Compilation&gt; code;
</span><span class="cx">     std::unique_ptr&lt;B3::Compilation&gt; jsEntryPoint;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWasmPlancpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WasmPlan.cpp (209311 => 209312)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WasmPlan.cpp        2016-12-04 20:22:58 UTC (rev 209311)
+++ trunk/Source/JavaScriptCore/wasm/WasmPlan.cpp        2016-12-04 21:23:56 UTC (rev 209312)
</span><span class="lines">@@ -29,6 +29,9 @@
</span><span class="cx"> #if ENABLE(WEBASSEMBLY)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;B3Compilation.h&quot;
</span><ins>+#include &quot;JSCInlines.h&quot;
+#include &quot;JSGlobalObject.h&quot;
+#include &quot;JSWebAssemblyCallee.h&quot;
</ins><span class="cx"> #include &quot;WasmB3IRGenerator.h&quot;
</span><span class="cx"> #include &quot;WasmCallingConvention.h&quot;
</span><span class="cx"> #include &quot;WasmMemory.h&quot;
</span><span class="lines">@@ -110,6 +113,23 @@
</span><span class="cx">     m_failed = false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Plan::initializeCallees(JSGlobalObject* globalObject, std::function&lt;void(unsigned, JSWebAssemblyCallee*)&gt; callback)
+{
+    ASSERT(!failed());
+    for (unsigned i = 0; i &lt; m_compiledFunctions.size(); i++) {
+        std::unique_ptr&lt;FunctionCompilation&gt;&amp; compilation = m_compiledFunctions[i];
+        CodeLocationDataLabelPtr calleeMoveLocation = compilation-&gt;calleeMoveLocation;
+        JSWebAssemblyCallee* callee = JSWebAssemblyCallee::create(globalObject-&gt;vm(), WTFMove(compilation));
+
+        MacroAssembler::repatchPointer(calleeMoveLocation, callee);
+
+        if (verbose)
+            dataLogLn(&quot;Made Wasm callee: &quot;, RawPointer(callee));
+
+        callback(i, callee);
+    }
+}
+
</ins><span class="cx"> Plan::~Plan() { }
</span><span class="cx"> 
</span><span class="cx"> } } // namespace JSC::Wasm
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWasmPlanh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WasmPlan.h (209311 => 209312)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WasmPlan.h        2016-12-04 20:22:58 UTC (rev 209311)
+++ trunk/Source/JavaScriptCore/wasm/WasmPlan.h        2016-12-04 21:23:56 UTC (rev 209312)
</span><span class="lines">@@ -33,7 +33,13 @@
</span><span class="cx"> #include &lt;wtf/ThreadSafeRefCounted.h&gt;
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="cx"> 
</span><del>-namespace JSC { namespace Wasm {
</del><ins>+namespace JSC {
+
+class JSGlobalObject;
+class JSWebAssemblyCallee;
+
+namespace Wasm {
+
</ins><span class="cx"> class Memory;
</span><span class="cx"> 
</span><span class="cx"> class Plan {
</span><span class="lines">@@ -44,6 +50,8 @@
</span><span class="cx"> 
</span><span class="cx">     JS_EXPORT_PRIVATE void run();
</span><span class="cx"> 
</span><ins>+    JS_EXPORT_PRIVATE void initializeCallees(JSGlobalObject*, std::function&lt;void(unsigned, JSWebAssemblyCallee*)&gt;);
+
</ins><span class="cx">     bool WARN_UNUSED_RETURN failed() const { return m_failed; }
</span><span class="cx">     const String&amp; errorMessage() const
</span><span class="cx">     {
</span><span class="lines">@@ -71,11 +79,6 @@
</span><span class="cx">         RELEASE_ASSERT(!failed());
</span><span class="cx">         return m_compiledFunctions.at(i).get();
</span><span class="cx">     }
</span><del>-    CompiledFunctions&amp; getCompiledFunctions()
-    {
-        RELEASE_ASSERT(!failed());
-        return m_compiledFunctions;
-    }
</del><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     std::unique_ptr&lt;ModuleInformation&gt; m_moduleInformation;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsJSWebAssemblyCalleecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyCallee.cpp (0 => 209312)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyCallee.cpp                                (rev 0)
+++ trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyCallee.cpp        2016-12-04 21:23:56 UTC (rev 209312)
</span><span class="lines">@@ -0,0 +1,57 @@
</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;JSWebAssemblyCallee.h&quot;
+
+#if ENABLE(WEBASSEMBLY)
+
+#include &quot;JSCInlines.h&quot;
+
+namespace JSC {
+
+const ClassInfo JSWebAssemblyCallee::s_info = { &quot;WebAssemblyCallee&quot;, nullptr, 0, CREATE_METHOD_TABLE(JSWebAssemblyCallee) };
+
+JSWebAssemblyCallee::JSWebAssemblyCallee(VM&amp; vm)
+    : Base(vm, vm.webAssemblyCalleeStructure.get())
+{ }
+
+void JSWebAssemblyCallee::finishCreation(VM&amp; vm, std::unique_ptr&lt;Wasm::FunctionCompilation&gt;&amp;&amp; compilation)
+{
+    Base::finishCreation(vm);
+
+    m_code = WTFMove(compilation-&gt;code);
+    m_jsEntryPoint = WTFMove(compilation-&gt;jsEntryPoint);
+}
+
+void JSWebAssemblyCallee::destroy(JSCell* cell)
+{
+    JSWebAssemblyCallee* thisObject = jsCast&lt;JSWebAssemblyCallee*&gt;(cell);
+    thisObject-&gt;JSWebAssemblyCallee::~JSWebAssemblyCallee();
+}
+
+} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsJSWebAssemblyCalleeh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyCallee.h (0 => 209312)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyCallee.h                                (rev 0)
+++ trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyCallee.h        2016-12-04 21:23:56 UTC (rev 209312)
</span><span class="lines">@@ -0,0 +1,68 @@
</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(WEBASSEMBLY)
+
+#include &quot;JSCallee.h&quot;
+#include &quot;WasmFormat.h&quot;
+
+namespace JSC {
+
+class JSWebAssemblyCallee : public JSCell {
+public:
+    typedef JSCell Base;
+    static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal;
+
+    static JSWebAssemblyCallee* create(VM&amp; vm, std::unique_ptr&lt;Wasm::FunctionCompilation&gt;&amp;&amp; compilation)
+    {
+        JSWebAssemblyCallee* callee = new (NotNull, allocateCell&lt;JSWebAssemblyCallee&gt;(vm.heap)) JSWebAssemblyCallee(vm);
+        callee-&gt;finishCreation(vm, WTFMove(compilation));
+        return callee;
+    }
+
+    static Structure* createStructure(VM&amp; vm, JSGlobalObject* globalObject, JSValue prototype) 
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(CellType, StructureFlags), info());
+    }
+
+    DECLARE_EXPORT_INFO;
+    static const bool needsDestruction = true;
+    static void destroy(JSCell*);
+
+    void* jsEntryPoint() { return m_jsEntryPoint-&gt;code().executableAddress(); }
+
+private:
+    void finishCreation(VM&amp;, std::unique_ptr&lt;Wasm::FunctionCompilation&gt;&amp;&amp;);
+    JSWebAssemblyCallee(VM&amp;);
+
+    std::unique_ptr&lt;B3::Compilation&gt; m_code;
+    std::unique_ptr&lt;B3::Compilation&gt; m_jsEntryPoint;
+};
+
+} // namespace JSC
+
+#endif // ENABLE(WEBASSEMBLY)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsJSWebAssemblyModulecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyModule.cpp (209311 => 209312)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyModule.cpp        2016-12-04 20:22:58 UTC (rev 209311)
+++ trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyModule.cpp        2016-12-04 21:23:56 UTC (rev 209312)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #if ENABLE(WEBASSEMBLY)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;JSCInlines.h&quot;
</span><ins>+#include &quot;JSWebAssemblyCallee.h&quot;
</ins><span class="cx"> #include &quot;WasmFormat.h&quot;
</span><span class="cx"> #include &quot;WasmMemory.h&quot;
</span><span class="cx"> #include &lt;wtf/StdLibExtras.h&gt;
</span><span class="lines">@@ -35,9 +36,12 @@
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><del>-JSWebAssemblyModule* JSWebAssemblyModule::create(VM&amp; vm, Structure* structure, std::unique_ptr&lt;Wasm::ModuleInformation&gt;&amp; moduleInformation, Wasm::CompiledFunctions&amp; compiledFunctions, SymbolTable* exportSymbolTable)
</del><ins>+const ClassInfo JSWebAssemblyModule::s_info = { &quot;WebAssembly.Module&quot;, &amp;Base::s_info, nullptr, CREATE_METHOD_TABLE(JSWebAssemblyModule) };
+
+JSWebAssemblyModule* JSWebAssemblyModule::create(VM&amp; vm, Structure* structure, std::unique_ptr&lt;Wasm::ModuleInformation&gt;&amp; moduleInformation,
+    SymbolTable* exportSymbolTable, unsigned calleeCount)
</ins><span class="cx"> {
</span><del>-    auto* instance = new (NotNull, allocateCell&lt;JSWebAssemblyModule&gt;(vm.heap)) JSWebAssemblyModule(vm, structure, moduleInformation, compiledFunctions);
</del><ins>+    auto* instance = new (NotNull, allocateCell&lt;JSWebAssemblyModule&gt;(vm.heap, allocationSize(calleeCount))) JSWebAssemblyModule(vm, structure, moduleInformation, calleeCount);
</ins><span class="cx">     instance-&gt;finishCreation(vm, exportSymbolTable);
</span><span class="cx">     return instance;
</span><span class="cx"> }
</span><span class="lines">@@ -47,11 +51,12 @@
</span><span class="cx">     return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-JSWebAssemblyModule::JSWebAssemblyModule(VM&amp; vm, Structure* structure, std::unique_ptr&lt;Wasm::ModuleInformation&gt;&amp; moduleInformation, Wasm::CompiledFunctions&amp; compiledFunctions)
</del><ins>+JSWebAssemblyModule::JSWebAssemblyModule(VM&amp; vm, Structure* structure, std::unique_ptr&lt;Wasm::ModuleInformation&gt;&amp; moduleInformation, unsigned calleeCount)
</ins><span class="cx">     : Base(vm, structure)
</span><span class="cx">     , m_moduleInformation(WTFMove(moduleInformation))
</span><del>-    , m_compiledFunctions(WTFMove(compiledFunctions))
</del><ins>+    , m_calleeCount(calleeCount)
</ins><span class="cx"> {
</span><ins>+    memset(callees(), 0, m_calleeCount * sizeof(WriteBarrier&lt;JSWebAssemblyCallee&gt;));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void JSWebAssemblyModule::finishCreation(VM&amp; vm, SymbolTable* exportSymbolTable)
</span><span class="lines">@@ -73,10 +78,12 @@
</span><span class="cx"> 
</span><span class="cx">     Base::visitChildren(thisObject, visitor);
</span><span class="cx">     visitor.append(&amp;thisObject-&gt;m_exportSymbolTable);
</span><ins>+    for (unsigned i = 0; i &lt; thisObject-&gt;m_calleeCount; i++) {
+        WriteBarrier&lt;JSWebAssemblyCallee&gt;* callee = &amp;thisObject-&gt;callees()[i];
+        visitor.append(callee);
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-const ClassInfo JSWebAssemblyModule::s_info = { &quot;WebAssembly.Module&quot;, &amp;Base::s_info, 0, CREATE_METHOD_TABLE(JSWebAssemblyModule) };
-
</del><span class="cx"> } // namespace JSC
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(WEBASSEMBLY)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsJSWebAssemblyModuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyModule.h (209311 => 209312)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyModule.h        2016-12-04 20:22:58 UTC (rev 209311)
+++ trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyModule.h        2016-12-04 21:23:56 UTC (rev 209312)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><ins>+class JSWebAssemblyCallee;
</ins><span class="cx"> class SymbolTable;
</span><span class="cx"> 
</span><span class="cx"> class JSWebAssemblyModule : public JSDestructibleObject {
</span><span class="lines">@@ -39,24 +40,45 @@
</span><span class="cx"> public:
</span><span class="cx">     typedef JSDestructibleObject Base;
</span><span class="cx"> 
</span><del>-    static JSWebAssemblyModule* create(VM&amp;, Structure*, std::unique_ptr&lt;Wasm::ModuleInformation&gt;&amp;, Wasm::CompiledFunctions&amp;, SymbolTable*);
</del><ins>+    static JSWebAssemblyModule* create(VM&amp;, Structure*, std::unique_ptr&lt;Wasm::ModuleInformation&gt;&amp;, SymbolTable* exports, unsigned calleeCount);
</ins><span class="cx">     static Structure* createStructure(VM&amp;, JSGlobalObject*, JSValue);
</span><span class="cx"> 
</span><span class="cx">     DECLARE_INFO;
</span><span class="cx"> 
</span><span class="cx">     const Wasm::ModuleInformation&amp; moduleInformation() const { return *m_moduleInformation.get(); }
</span><del>-    const Wasm::CompiledFunctions&amp; compiledFunctions() const { return m_compiledFunctions; }
</del><span class="cx">     SymbolTable* exportSymbolTable() const { return m_exportSymbolTable.get(); }
</span><span class="cx"> 
</span><ins>+    JSWebAssemblyCallee* callee(unsigned calleeIndex)
+    {
+        RELEASE_ASSERT(calleeIndex &lt; m_calleeCount);
+        return callees()[calleeIndex].get();
+    }
+
+    WriteBarrier&lt;JSWebAssemblyCallee&gt;* callees()
+    {
+        return bitwise_cast&lt;WriteBarrier&lt;JSWebAssemblyCallee&gt;*&gt;(bitwise_cast&lt;char*&gt;(this) + offsetOfCallees());
+    }
+
</ins><span class="cx"> protected:
</span><del>-    JSWebAssemblyModule(VM&amp;, Structure*, std::unique_ptr&lt;Wasm::ModuleInformation&gt;&amp;, Wasm::CompiledFunctions&amp;);
</del><ins>+    JSWebAssemblyModule(VM&amp;, Structure*, std::unique_ptr&lt;Wasm::ModuleInformation&gt;&amp;, unsigned calleeCount);
</ins><span class="cx">     void finishCreation(VM&amp;, SymbolTable*);
</span><span class="cx">     static void destroy(JSCell*);
</span><span class="cx">     static void visitChildren(JSCell*, SlotVisitor&amp;);
</span><ins>+
</ins><span class="cx"> private:
</span><ins>+    static size_t offsetOfCallees()
+    {
+        return WTF::roundUpToMultipleOf&lt;sizeof(WriteBarrier&lt;JSWebAssemblyCallee&gt;)&gt;(sizeof(JSWebAssemblyModule));
+    }
+
+    static size_t allocationSize(unsigned numCallees)
+    {
+        return offsetOfCallees() + sizeof(WriteBarrier&lt;JSWebAssemblyCallee&gt;) * numCallees;
+    }
+
</ins><span class="cx">     std::unique_ptr&lt;Wasm::ModuleInformation&gt; m_moduleInformation;
</span><del>-    Wasm::CompiledFunctions m_compiledFunctions;
</del><span class="cx">     WriteBarrier&lt;SymbolTable&gt; m_exportSymbolTable;
</span><ins>+    unsigned m_calleeCount;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyFunctioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp (209311 => 209312)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp        2016-12-04 20:22:58 UTC (rev 209311)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp        2016-12-04 21:23:56 UTC (rev 209312)
</span><span class="lines">@@ -32,12 +32,12 @@
</span><span class="cx"> #include &quot;JSCInlines.h&quot;
</span><span class="cx"> #include &quot;JSFunctionInlines.h&quot;
</span><span class="cx"> #include &quot;JSObject.h&quot;
</span><ins>+#include &quot;JSWebAssemblyCallee.h&quot;
</ins><span class="cx"> #include &quot;JSWebAssemblyInstance.h&quot;
</span><span class="cx"> #include &quot;LLIntThunks.h&quot;
</span><span class="cx"> #include &quot;ProtoCallFrame.h&quot;
</span><span class="cx"> #include &quot;VM.h&quot;
</span><span class="cx"> #include &quot;WasmFormat.h&quot;
</span><del>-#include &quot;WebAssemblyFunctionCell.h&quot;
</del><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><span class="lines">@@ -45,14 +45,12 @@
</span><span class="cx"> 
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL callWebAssemblyFunction(ExecState* exec)
</span><span class="cx"> {
</span><del>-    auto&amp; vm = exec-&gt;vm();
</del><ins>+    VM&amp; vm = exec-&gt;vm();
</ins><span class="cx">     auto scope = DECLARE_THROW_SCOPE(vm);
</span><del>-    WebAssemblyFunction* callee = jsDynamicCast&lt;WebAssemblyFunction*&gt;(exec-&gt;jsCallee());
-    if (!callee)
</del><ins>+    WebAssemblyFunction* wasmFunction = jsDynamicCast&lt;WebAssemblyFunction*&gt;(exec-&gt;jsCallee());
+    if (!wasmFunction)
</ins><span class="cx">         return JSValue::encode(throwException(exec, scope, createTypeError(exec, &quot;expected a WebAssembly function&quot;, defaultSourceAppender, runtimeTypeForValue(exec-&gt;jsCallee()))));
</span><del>-    const CallableWebAssemblyFunction&amp; callable = callee-&gt;webAssemblyFunctionCell()-&gt;function();
-    const B3::Compilation* jsEntryPoint = callable.jsEntryPoint;
-    const Wasm::Signature* signature = callable.signature;
</del><ins>+    const Wasm::Signature* signature = wasmFunction-&gt;signature();
</ins><span class="cx"> 
</span><span class="cx">     // FIXME is this the right behavior? https://bugs.webkit.org/show_bug.cgi?id=164876
</span><span class="cx">     if (exec-&gt;argumentCount() != signature-&gt;arguments.size())
</span><span class="lines">@@ -92,10 +90,14 @@
</span><span class="cx">         argCount = boxedArgs.size();
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    // Note: we specifically use the WebAsseblyFunction as the callee to begin with in the ProtoCallFrame.
+    // The reason for this is that calling into the llint may stack overflow, and the stack overflow
+    // handler might read the global object from the callee. The JSWebAssemblyCallee doesn't have a
+    // global object, but the WebAssemblyFunction does.
</ins><span class="cx">     ProtoCallFrame protoCallFrame;
</span><del>-    protoCallFrame.init(nullptr, callee, firstArgument, argCount, remainingArgs);
</del><ins>+    protoCallFrame.init(nullptr, wasmFunction, firstArgument, argCount, remainingArgs);
</ins><span class="cx">     
</span><del>-    EncodedJSValue rawResult = vmEntryToWasm(jsEntryPoint-&gt;code().executableAddress(), &amp;vm, &amp;protoCallFrame);
</del><ins>+    EncodedJSValue rawResult = vmEntryToWasm(wasmFunction-&gt;webAssemblyCallee()-&gt;jsEntryPoint(), &amp;vm, &amp;protoCallFrame);
</ins><span class="cx">     // FIXME is this correct? https://bugs.webkit.org/show_bug.cgi?id=164876
</span><span class="cx">     switch (signature-&gt;returnType) {
</span><span class="cx">     case Wasm::Void:
</span><span class="lines">@@ -116,13 +118,12 @@
</span><span class="cx">     return EncodedJSValue();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-WebAssemblyFunction* WebAssemblyFunction::create(VM&amp; vm, JSGlobalObject* globalObject, int length, const String&amp; name, JSWebAssemblyInstance* instance, CallableWebAssemblyFunction&amp;&amp; callable)
</del><ins>+WebAssemblyFunction* WebAssemblyFunction::create(VM&amp; vm, JSGlobalObject* globalObject, unsigned length, const String&amp; name, JSWebAssemblyInstance* instance, JSWebAssemblyCallee* callee, Wasm::Signature* signature)
</ins><span class="cx"> {
</span><span class="cx">     NativeExecutable* executable = vm.getHostFunction(callWebAssemblyFunction, NoIntrinsic, callHostFunctionAsConstructor, nullptr, name);
</span><del>-    WebAssemblyFunctionCell* functionCell = WebAssemblyFunctionCell::create(vm, WTFMove(callable));
</del><span class="cx">     Structure* structure = globalObject-&gt;webAssemblyFunctionStructure();
</span><span class="cx">     WebAssemblyFunction* function = new (NotNull, allocateCell&lt;WebAssemblyFunction&gt;(vm.heap)) WebAssemblyFunction(vm, globalObject, structure);
</span><del>-    function-&gt;finishCreation(vm, executable, length, name, instance, functionCell);
</del><ins>+    function-&gt;finishCreation(vm, executable, length, name, instance, callee, signature);
</ins><span class="cx">     return function;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -143,15 +144,16 @@
</span><span class="cx">     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
</span><span class="cx">     Base::visitChildren(thisObject, visitor);
</span><span class="cx">     visitor.append(&amp;thisObject-&gt;m_instance);
</span><del>-    visitor.append(&amp;thisObject-&gt;m_functionCell);
</del><ins>+    visitor.append(&amp;thisObject-&gt;m_wasmCallee);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebAssemblyFunction::finishCreation(VM&amp; vm, NativeExecutable* executable, int length, const String&amp; name, JSWebAssemblyInstance* instance, WebAssemblyFunctionCell* functionCell)
</del><ins>+void WebAssemblyFunction::finishCreation(VM&amp; vm, NativeExecutable* executable, unsigned length, const String&amp; name, JSWebAssemblyInstance* instance, JSWebAssemblyCallee* wasmCallee, Wasm::Signature* signature)
</ins><span class="cx"> {
</span><span class="cx">     Base::finishCreation(vm, executable, length, name);
</span><span class="cx">     ASSERT(inherits(info()));
</span><span class="cx">     m_instance.set(vm, this, instance);
</span><del>-    m_functionCell.set(vm, this, functionCell);
</del><ins>+    m_wasmCallee.set(vm, this, wasmCallee);
+    m_signature = signature;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyFunctionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunction.h (209311 => 209312)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunction.h        2016-12-04 20:22:58 UTC (rev 209311)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunction.h        2016-12-04 21:23:56 UTC (rev 209312)
</span><span class="lines">@@ -33,7 +33,7 @@
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><span class="cx"> class JSGlobalObject;
</span><del>-class WebAssemblyFunctionCell;
</del><ins>+class JSWebAssemblyCallee;
</ins><span class="cx"> class WebAssemblyInstance;
</span><span class="cx"> 
</span><span class="cx"> namespace B3 {
</span><span class="lines">@@ -44,22 +44,6 @@
</span><span class="cx"> struct Signature;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-class CallableWebAssemblyFunction {
-    WTF_MAKE_NONCOPYABLE(CallableWebAssemblyFunction);
-    CallableWebAssemblyFunction() = delete;
-
-public:
-    CallableWebAssemblyFunction(CallableWebAssemblyFunction&amp;&amp;) = default;
-
-    const B3::Compilation* jsEntryPoint;
-    const Wasm::Signature* signature;
-    CallableWebAssemblyFunction(const B3::Compilation* jsEntryPoint, const Wasm::Signature* signature)
-        : jsEntryPoint(jsEntryPoint)
-        , signature(signature)
-    {
-    }
-};
-
</del><span class="cx"> class WebAssemblyFunction : public JSFunction {
</span><span class="cx"> public:
</span><span class="cx">     typedef JSFunction Base;
</span><span class="lines">@@ -68,21 +52,28 @@
</span><span class="cx"> 
</span><span class="cx">     DECLARE_EXPORT_INFO;
</span><span class="cx"> 
</span><del>-    JS_EXPORT_PRIVATE static WebAssemblyFunction* create(VM&amp;, JSGlobalObject*, int, const String&amp;, JSWebAssemblyInstance*, CallableWebAssemblyFunction&amp;&amp;);
</del><ins>+    JS_EXPORT_PRIVATE static WebAssemblyFunction* create(VM&amp;, JSGlobalObject*, unsigned, const String&amp;, JSWebAssemblyInstance*, JSWebAssemblyCallee*, Wasm::Signature*);
</ins><span class="cx">     static Structure* createStructure(VM&amp;, JSGlobalObject*, JSValue);
</span><span class="cx"> 
</span><del>-    const WebAssemblyFunctionCell* webAssemblyFunctionCell() const { return m_functionCell.get(); }
</del><ins>+    JSWebAssemblyCallee* webAssemblyCallee() const { return m_wasmCallee.get(); }
+    const JSWebAssemblyInstance* instance() const { return m_instance.get(); }
+    const Wasm::Signature* signature()
+    { 
+        ASSERT(m_signature);
+        return m_signature;
+    }
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     static void visitChildren(JSCell*, SlotVisitor&amp;);
</span><span class="cx"> 
</span><del>-    void finishCreation(VM&amp;, NativeExecutable*, int length, const String&amp; name, JSWebAssemblyInstance*, WebAssemblyFunctionCell*);
</del><ins>+    void finishCreation(VM&amp;, NativeExecutable*, unsigned length, const String&amp; name, JSWebAssemblyInstance*, JSWebAssemblyCallee*, Wasm::Signature*);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     WebAssemblyFunction(VM&amp;, JSGlobalObject*, Structure*);
</span><span class="cx"> 
</span><span class="cx">     WriteBarrier&lt;JSWebAssemblyInstance&gt; m_instance;
</span><del>-    WriteBarrier&lt;WebAssemblyFunctionCell&gt; m_functionCell;
</del><ins>+    WriteBarrier&lt;JSWebAssemblyCallee&gt; m_wasmCallee;
+    Wasm::Signature* m_signature;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyFunctionCellcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunctionCell.cpp (209311 => 209312)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunctionCell.cpp        2016-12-04 20:22:58 UTC (rev 209311)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunctionCell.cpp        2016-12-04 21:23:56 UTC (rev 209312)
</span><span class="lines">@@ -1,63 +0,0 @@
</span><del>-/*
- * 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;WebAssemblyFunctionCell.h&quot;
-
-#if ENABLE(WEBASSEMBLY)
-
-#include &quot;JSCInlines.h&quot;
-
-namespace JSC {
-
-const ClassInfo WebAssemblyFunctionCell::s_info = { &quot;WebAssemblyFunctionCell&quot;, nullptr, nullptr, CREATE_METHOD_TABLE(WebAssemblyFunctionCell) };
-
-WebAssemblyFunctionCell* WebAssemblyFunctionCell::create(VM&amp; vm, CallableWebAssemblyFunction&amp;&amp; callable)
-{
-    WebAssemblyFunctionCell* nativeFunction = new (NotNull, allocateCell&lt;WebAssemblyFunctionCell&gt;(vm.heap)) WebAssemblyFunctionCell(vm, WTFMove(callable));
-    nativeFunction-&gt;finishCreation(vm);
-    return nativeFunction;
-}
-
-WebAssemblyFunctionCell::WebAssemblyFunctionCell(VM&amp; vm, CallableWebAssemblyFunction&amp;&amp; callable)
-    : Base(vm, vm.webAssemblyFunctionCellStructure.get())
-    , m_function(WTFMove(callable))
-{
-}
-
-void WebAssemblyFunctionCell::destroy(JSCell* cell)
-{
-    WebAssemblyFunctionCell* nativeFunction = static_cast&lt;WebAssemblyFunctionCell*&gt;(cell);
-    nativeFunction-&gt;WebAssemblyFunctionCell::~WebAssemblyFunctionCell();
-}
-
-Structure* WebAssemblyFunctionCell::createStructure(VM&amp; vm, JSGlobalObject* globalObject, JSValue prototype)
-{
-    return Structure::create(vm, globalObject, prototype, TypeInfo(CellType, StructureFlags), info());
-}
-
-}
-
-#endif // ENABLE(WEBASSEMBLY)
</del></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyFunctionCellh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunctionCell.h (209311 => 209312)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunctionCell.h        2016-12-04 20:22:58 UTC (rev 209311)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunctionCell.h        2016-12-04 21:23:56 UTC (rev 209312)
</span><span class="lines">@@ -1,57 +0,0 @@
</span><del>-/*
- * 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(WEBASSEMBLY)
-
-#include &quot;JSCell.h&quot;
-#include &quot;WebAssemblyFunction.h&quot;
-
-namespace JSC {
-
-class WebAssemblyFunctionCell : public JSCell {
-public:
-    typedef JSCell Base;
-    static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal;
-    static const bool needsDestruction = true;
-
-    static WebAssemblyFunctionCell* create(VM&amp;, CallableWebAssemblyFunction&amp;&amp;);
-    static void destroy(JSCell*);
-    static Structure* createStructure(VM&amp;, JSGlobalObject*, JSValue);
-
-    DECLARE_INFO;
-
-    const CallableWebAssemblyFunction&amp; function() const { return m_function; }
-
-private:
-    WebAssemblyFunctionCell(VM&amp;, CallableWebAssemblyFunction&amp;&amp;);
-
-    CallableWebAssemblyFunction m_function;
-};
-
-} // namespace JSC
-
-#endif // ENABLE(WEBASSEMBLY)
</del></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyModuleConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleConstructor.cpp (209311 => 209312)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleConstructor.cpp        2016-12-04 20:22:58 UTC (rev 209311)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleConstructor.cpp        2016-12-04 21:23:56 UTC (rev 209312)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #include &quot;JSArrayBuffer.h&quot;
</span><span class="cx"> #include &quot;JSCInlines.h&quot;
</span><span class="cx"> #include &quot;JSTypedArrays.h&quot;
</span><ins>+#include &quot;JSWebAssemblyCallee.h&quot;
</ins><span class="cx"> #include &quot;JSWebAssemblyCompileError.h&quot;
</span><span class="cx"> #include &quot;JSWebAssemblyModule.h&quot;
</span><span class="cx"> #include &quot;SymbolTable.h&quot;
</span><span class="lines">@@ -53,7 +54,7 @@
</span><span class="cx"> 
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL constructJSWebAssemblyModule(ExecState* state)
</span><span class="cx"> {
</span><del>-    auto&amp; vm = state-&gt;vm();
</del><ins>+    VM&amp; vm = state-&gt;vm();
</ins><span class="cx">     auto scope = DECLARE_THROW_SCOPE(vm);
</span><span class="cx">     JSValue val = state-&gt;argument(0);
</span><span class="cx"> 
</span><span class="lines">@@ -87,7 +88,13 @@
</span><span class="cx">         exportSymbolTable-&gt;set(NoLockingNecessary, exp.field.impl(), SymbolTableEntry(VarOffset(offset)));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return JSValue::encode(JSWebAssemblyModule::create(vm, structure, plan.getModuleInformation(), plan.getCompiledFunctions(), exportSymbolTable));
</del><ins>+    unsigned calleeCount = plan.compiledFunctionCount();
+    JSWebAssemblyModule* result = JSWebAssemblyModule::create(vm, structure, plan.getModuleInformation(), exportSymbolTable, calleeCount);
+    plan.initializeCallees(state-&gt;jsCallee()-&gt;globalObject(), 
+        [&amp;] (unsigned calleeIndex, JSWebAssemblyCallee* callee) {
+            result-&gt;callees()[calleeIndex].set(vm, result, callee);
+        });
+    return JSValue::encode(result);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL callJSWebAssemblyModule(ExecState* state)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyModuleRecordcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp (209311 => 209312)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp        2016-12-04 20:22:58 UTC (rev 209311)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp        2016-12-04 21:23:56 UTC (rev 209312)
</span><span class="lines">@@ -106,7 +106,6 @@
</span><span class="cx">     auto* globalObject = state-&gt;lexicalGlobalObject();
</span><span class="cx"> 
</span><span class="cx">     const Wasm::ModuleInformation&amp; moduleInformation = instance-&gt;module()-&gt;moduleInformation();
</span><del>-    const Wasm::CompiledFunctions&amp; compiledFunctions = instance-&gt;module()-&gt;compiledFunctions();
</del><span class="cx">     SymbolTable* exportSymbolTable = instance-&gt;module()-&gt;exportSymbolTable();
</span><span class="cx"> 
</span><span class="cx">     // FIXME wire up the imports. https://bugs.webkit.org/show_bug.cgi?id=165118
</span><span class="lines">@@ -124,10 +123,9 @@
</span><span class="cx">             //     a. Let func be an Exported Function Exotic Object created from c.
</span><span class="cx">             //     b. Append func to funcs.
</span><span class="cx">             //     c. Return func.
</span><del>-            const Wasm::FunctionCompilation* compiledFunction = compiledFunctions.at(exp.functionIndex).get();
-            const B3::Compilation* jsEntryPoint = compiledFunction-&gt;jsEntryPoint.get();
-            const Wasm::Signature* signature = moduleInformation.functions.at(exp.functionIndex).signature;
-            WebAssemblyFunction* function = WebAssemblyFunction::create(vm, globalObject, signature-&gt;arguments.size(), exp.field.string(), instance, CallableWebAssemblyFunction(jsEntryPoint, signature));
</del><ins>+            JSWebAssemblyCallee* wasmCallee = instance-&gt;module()-&gt;callee(exp.functionIndex);
+            Wasm::Signature* signature = moduleInformation.functions.at(exp.functionIndex).signature;
+            WebAssemblyFunction* function = WebAssemblyFunction::create(vm, globalObject, signature-&gt;arguments.size(), exp.field.string(), instance, wasmCallee, signature);
</ins><span class="cx">             exportedValue = function;
</span><span class="cx">             break;
</span><span class="cx">         }
</span></span></pre>
</div>
</div>

</body>
</html>