<!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 <sbarati@apple.com>
+
+ 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 <mattbaker@apple.com>
</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 = "<group>"; };
</span><span class="cx">                 79D5CD591C1106A900CECA07 /* SamplingProfiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SamplingProfiler.h; sourceTree = "<group>"; };
</span><span class="cx">                 79DFCBDA1D88C59600527D03 /* HasOwnPropertyCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HasOwnPropertyCache.h; sourceTree = "<group>"; };
</span><ins>+                79E423E01DEE65320078D355 /* JSWebAssemblyCallee.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSWebAssemblyCallee.cpp; path = js/JSWebAssemblyCallee.cpp; sourceTree = "<group>"; };
+                79E423E11DEE65320078D355 /* JSWebAssemblyCallee.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSWebAssemblyCallee.h; path = js/JSWebAssemblyCallee.h; sourceTree = "<group>"; };
</ins><span class="cx">                 79EE0BFD1B4AFB85000385C9 /* VariableEnvironment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VariableEnvironment.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 79EE0BFE1B4AFB85000385C9 /* VariableEnvironment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VariableEnvironment.h; sourceTree = "<group>"; };
</span><span class="cx">                 79F8FC1C1B9FED0F00CA66AB /* DFGMaximalFlushInsertionPhase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGMaximalFlushInsertionPhase.cpp; path = dfg/DFGMaximalFlushInsertionPhase.cpp; sourceTree = "<group>"; };
</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 = "<group>"; };
</span><span class="cx">                 AD4937C91DDD27340077C807 /* WebAssemblyFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebAssemblyFunction.cpp; path = js/WebAssemblyFunction.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 AD4937CA1DDD27340077C807 /* WebAssemblyFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebAssemblyFunction.h; path = js/WebAssemblyFunction.h; sourceTree = "<group>"; };
</span><del>-                AD4937CD1DDD27D90077C807 /* WebAssemblyFunctionCell.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebAssemblyFunctionCell.cpp; path = js/WebAssemblyFunctionCell.cpp; sourceTree = "<group>"; };
-                AD4937CE1DDD27D90077C807 /* WebAssemblyFunctionCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebAssemblyFunctionCell.h; path = js/WebAssemblyFunctionCell.h; sourceTree = "<group>"; };
</del><span class="cx">                 AD86A93D1AA4D87C002FE77F /* WeakGCMapInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakGCMapInlines.h; sourceTree = "<group>"; };
</span><span class="cx">                 ADDB1F6218D77DB7009B58A8 /* OpaqueRootSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpaqueRootSet.h; sourceTree = "<group>"; };
</span><span class="cx">                 B59F89371891AD3300D5CCDC /* UnlinkedInstructionStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnlinkedInstructionStream.h; sourceTree = "<group>"; };
</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 "JSProxy.h"
</span><span class="cx"> #include "JSString.h"
</span><span class="cx"> #include "JSTypedArrays.h"
</span><ins>+#include "JSWebAssemblyCallee.h"
</ins><span class="cx"> #include "LLIntData.h"
</span><span class="cx"> #include "LLIntThunks.h"
</span><span class="cx"> #include "ObjectConstructor.h"
</span><span class="lines">@@ -2566,7 +2567,7 @@
</span><span class="cx"> return JSValue::decode(bitwise_cast<uint64_t>(result));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static JSValue callWasmFunction(VM* vm, const B3::Compilation& code, Vector<JSValue>& boxedArgs)
</del><ins>+static JSValue callWasmFunction(VM* vm, JSGlobalObject* globalObject, JSWebAssemblyCallee* wasmCallee, Vector<JSValue>& 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->globalExec()->jsCallee(), firstArgument, argCount, remainingArgs);
</ins><span class="cx">
</span><del>- return JSValue::decode(vmEntryToWasm(code.code().executableAddress(), vm, &protoCallFrame));
</del><ins>+ return JSValue::decode(vmEntryToWasm(wasmCallee->jsEntryPoint(), vm, &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->lexicalGlobalObject(),
+ [&] (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 < functionCount; ++i) {
</span><del>- if (!plan.compiledFunction(i))
- dataLogLn("failed to compile function at index", i);
-
</del><span class="cx"> JSArray* testCases = jsCast<JSArray*>(exec->argument(i + 2));
</span><span class="cx"> for (unsigned testIndex = 0; testIndex < testCases->length(); ++testIndex) {
</span><span class="cx"> JSArray* test = jsCast<JSArray*>(testCases->getIndexQuickly(testIndex));
</span><span class="lines">@@ -2624,7 +2633,7 @@
</span><span class="cx"> for (unsigned argIndex = 0; argIndex < arguments->length(); ++argIndex)
</span><span class="cx"> boxedArgs.append(box(exec, vm, arguments->getIndexQuickly(argIndex)));
</span><span class="cx">
</span><del>- JSValue callResult = callWasmFunction(&vm, *plan.compiledFunction(i)->jsEntryPoint, boxedArgs);
</del><ins>+ JSValue callResult = callWasmFunction(&vm, exec->lexicalGlobalObject(), jsCast<JSWebAssemblyCallee*>(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("Arguments: ");
</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 "JSWeakMap.h"
</span><span class="cx"> #include "JSWeakSet.h"
</span><span class="cx"> #include "JSWebAssembly.h"
</span><ins>+#include "JSWebAssemblyCallee.h"
</ins><span class="cx"> #include "JSWithScope.h"
</span><span class="cx"> #include "LazyClassStructureInlines.h"
</span><span class="cx"> #include "LazyPropertyInlines.h"
</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<HashMapBucketDataKey>::createStructure(*this, 0, jsNull()));
</span><span class="cx"> hashMapBucketMapStructure.set(*this, HashMapBucket<HashMapBucketDataKeyValue>::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<Structure> functionExecutableStructure;
</span><span class="cx"> #if ENABLE(WEBASSEMBLY)
</span><span class="cx"> Strong<Structure> webAssemblyExecutableStructure;
</span><del>- Strong<Structure> webAssemblyFunctionCellStructure;
</del><ins>+ Strong<Structure> webAssemblyCalleeStructure;
</ins><span class="cx"> #endif
</span><span class="cx"> Strong<Structure> moduleProgramExecutableStructure;
</span><span class="cx"> Strong<Structure> 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 "JSObject.h"
</span><ins>+#include "js/JSWebAssemblyCallee.h"
</ins><span class="cx"> #include "js/JSWebAssemblyCompileError.h"
</span><span class="cx"> #include "js/JSWebAssemblyInstance.h"
</span><span class="cx"> #include "js/JSWebAssemblyMemory.h"
</span><span class="lines">@@ -37,7 +38,6 @@
</span><span class="cx"> #include "js/WebAssemblyCompileErrorConstructor.h"
</span><span class="cx"> #include "js/WebAssemblyCompileErrorPrototype.h"
</span><span class="cx"> #include "js/WebAssemblyFunction.h"
</span><del>-#include "js/WebAssemblyFunctionCell.h"
</del><span class="cx"> #include "js/WebAssemblyInstanceConstructor.h"
</span><span class="cx"> #include "js/WebAssemblyInstancePrototype.h"
</span><span class="cx"> #include "js/WebAssemblyMemoryConstructor.h"
</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&, Vector<UnlinkedCall>& unlinkedCalls);
</del><ins>+ B3IRGenerator(Memory*, Procedure&, FunctionCompilation*);
</ins><span class="cx">
</span><span class="cx"> bool WARN_UNUSED_RETURN addArguments(const Vector<Type>&);
</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& procedure, Vector<UnlinkedCall>& unlinkedCalls)
</del><ins>+B3IRGenerator::B3IRGenerator(Memory* memory, Procedure& 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->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<FunctionCompilation>();
</span><span class="cx">
</span><span class="cx"> Procedure procedure;
</span><del>- B3IRGenerator context(memory, procedure, result->unlinkedCalls);
</del><ins>+ B3IRGenerator context(memory, procedure, result.get());
</ins><span class="cx"> FunctionParser<B3IRGenerator> 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& proc, B3::Origin origin, B3::BasicBlock* block) const
+ {
+ static_assert(CallFrameSlot::callee * sizeof(Register) < headerSize, "We rely on this here for now.");
+ static_assert(CallFrameSlot::codeBlock * sizeof(Register) < headerSize, "We rely on this here for now.");
+
+ B3::PatchpointValue* getCalleePatchpoint = block->appendNew<B3::PatchpointValue>(proc, B3::Int64, origin);
+ getCalleePatchpoint->resultConstraint = B3::ValueRep::SomeRegister;
+ getCalleePatchpoint->effects = B3::Effects::none();
+ getCalleePatchpoint->setGenerator(
+ [=] (CCallHelpers& jit, const B3::StackmapGenerationParams& params) {
+ GPRReg result = params[0].gpr();
+ MacroAssembler::DataLabelPtr moveLocation = jit.moveWithPatch(MacroAssembler::TrustedImmPtr(nullptr), result);
+ jit.addLinkTask([=] (LinkBuffer& linkBuffer) {
+ compilation->calleeMoveLocation = linkBuffer.locationOf(moveLocation);
+ });
+ });
+
+ B3::Value* framePointer = block->appendNew<B3::Value>(proc, B3::FramePointer, origin);
+ B3::Value* offsetOfCallee = block->appendNew<B3::Const64Value>(proc, origin, CallFrameSlot::callee * sizeof(Register));
+ block->appendNew<B3::MemoryValue>(proc, B3::Store, origin,
+ getCalleePatchpoint,
+ block->appendNew<B3::Value>(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->appendNew<B3::Const64Value>(proc, origin, CallFrameSlot::codeBlock * sizeof(Register));
+ block->appendNew<B3::MemoryValue>(proc, B3::Store, origin,
+ block->appendNew<B3::Const64Value>(proc, origin, 0),
+ block->appendNew<B3::Value>(proc, B3::Add, origin, framePointer, offsetOfCodeBlock));
+ }
+
</ins><span class="cx"> template<typename Functor>
</span><span class="cx"> void loadArguments(const Vector<Type>& argumentTypes, B3::Procedure& proc, B3::BasicBlock* block, B3::Origin origin, const Functor& 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<UnlinkedCall> unlinkedCalls;
</span><ins>+ CodeLocationDataLabelPtr calleeMoveLocation;
</ins><span class="cx"> std::unique_ptr<B3::Compilation> code;
</span><span class="cx"> std::unique_ptr<B3::Compilation> 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 "B3Compilation.h"
</span><ins>+#include "JSCInlines.h"
+#include "JSGlobalObject.h"
+#include "JSWebAssemblyCallee.h"
</ins><span class="cx"> #include "WasmB3IRGenerator.h"
</span><span class="cx"> #include "WasmCallingConvention.h"
</span><span class="cx"> #include "WasmMemory.h"
</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<void(unsigned, JSWebAssemblyCallee*)> callback)
+{
+ ASSERT(!failed());
+ for (unsigned i = 0; i < m_compiledFunctions.size(); i++) {
+ std::unique_ptr<FunctionCompilation>& compilation = m_compiledFunctions[i];
+ CodeLocationDataLabelPtr calleeMoveLocation = compilation->calleeMoveLocation;
+ JSWebAssemblyCallee* callee = JSWebAssemblyCallee::create(globalObject->vm(), WTFMove(compilation));
+
+ MacroAssembler::repatchPointer(calleeMoveLocation, callee);
+
+ if (verbose)
+ dataLogLn("Made Wasm callee: ", 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 <wtf/ThreadSafeRefCounted.h>
</span><span class="cx"> #include <wtf/Vector.h>
</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<void(unsigned, JSWebAssemblyCallee*)>);
+
</ins><span class="cx"> bool WARN_UNUSED_RETURN failed() const { return m_failed; }
</span><span class="cx"> const String& 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& getCompiledFunctions()
- {
- RELEASE_ASSERT(!failed());
- return m_compiledFunctions;
- }
</del><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> std::unique_ptr<ModuleInformation> 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 "config.h"
+#include "JSWebAssemblyCallee.h"
+
+#if ENABLE(WEBASSEMBLY)
+
+#include "JSCInlines.h"
+
+namespace JSC {
+
+const ClassInfo JSWebAssemblyCallee::s_info = { "WebAssemblyCallee", nullptr, 0, CREATE_METHOD_TABLE(JSWebAssemblyCallee) };
+
+JSWebAssemblyCallee::JSWebAssemblyCallee(VM& vm)
+ : Base(vm, vm.webAssemblyCalleeStructure.get())
+{ }
+
+void JSWebAssemblyCallee::finishCreation(VM& vm, std::unique_ptr<Wasm::FunctionCompilation>&& compilation)
+{
+ Base::finishCreation(vm);
+
+ m_code = WTFMove(compilation->code);
+ m_jsEntryPoint = WTFMove(compilation->jsEntryPoint);
+}
+
+void JSWebAssemblyCallee::destroy(JSCell* cell)
+{
+ JSWebAssemblyCallee* thisObject = jsCast<JSWebAssemblyCallee*>(cell);
+ thisObject->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 "JSCallee.h"
+#include "WasmFormat.h"
+
+namespace JSC {
+
+class JSWebAssemblyCallee : public JSCell {
+public:
+ typedef JSCell Base;
+ static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal;
+
+ static JSWebAssemblyCallee* create(VM& vm, std::unique_ptr<Wasm::FunctionCompilation>&& compilation)
+ {
+ JSWebAssemblyCallee* callee = new (NotNull, allocateCell<JSWebAssemblyCallee>(vm.heap)) JSWebAssemblyCallee(vm);
+ callee->finishCreation(vm, WTFMove(compilation));
+ return callee;
+ }
+
+ static Structure* createStructure(VM& 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->code().executableAddress(); }
+
+private:
+ void finishCreation(VM&, std::unique_ptr<Wasm::FunctionCompilation>&&);
+ JSWebAssemblyCallee(VM&);
+
+ std::unique_ptr<B3::Compilation> m_code;
+ std::unique_ptr<B3::Compilation> 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 "JSCInlines.h"
</span><ins>+#include "JSWebAssemblyCallee.h"
</ins><span class="cx"> #include "WasmFormat.h"
</span><span class="cx"> #include "WasmMemory.h"
</span><span class="cx"> #include <wtf/StdLibExtras.h>
</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& vm, Structure* structure, std::unique_ptr<Wasm::ModuleInformation>& moduleInformation, Wasm::CompiledFunctions& compiledFunctions, SymbolTable* exportSymbolTable)
</del><ins>+const ClassInfo JSWebAssemblyModule::s_info = { "WebAssembly.Module", &Base::s_info, nullptr, CREATE_METHOD_TABLE(JSWebAssemblyModule) };
+
+JSWebAssemblyModule* JSWebAssemblyModule::create(VM& vm, Structure* structure, std::unique_ptr<Wasm::ModuleInformation>& moduleInformation,
+ SymbolTable* exportSymbolTable, unsigned calleeCount)
</ins><span class="cx"> {
</span><del>- auto* instance = new (NotNull, allocateCell<JSWebAssemblyModule>(vm.heap)) JSWebAssemblyModule(vm, structure, moduleInformation, compiledFunctions);
</del><ins>+ auto* instance = new (NotNull, allocateCell<JSWebAssemblyModule>(vm.heap, allocationSize(calleeCount))) JSWebAssemblyModule(vm, structure, moduleInformation, calleeCount);
</ins><span class="cx"> instance->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& vm, Structure* structure, std::unique_ptr<Wasm::ModuleInformation>& moduleInformation, Wasm::CompiledFunctions& compiledFunctions)
</del><ins>+JSWebAssemblyModule::JSWebAssemblyModule(VM& vm, Structure* structure, std::unique_ptr<Wasm::ModuleInformation>& 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<JSWebAssemblyCallee>));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void JSWebAssemblyModule::finishCreation(VM& 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(&thisObject->m_exportSymbolTable);
</span><ins>+ for (unsigned i = 0; i < thisObject->m_calleeCount; i++) {
+ WriteBarrier<JSWebAssemblyCallee>* callee = &thisObject->callees()[i];
+ visitor.append(callee);
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-const ClassInfo JSWebAssemblyModule::s_info = { "WebAssembly.Module", &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&, Structure*, std::unique_ptr<Wasm::ModuleInformation>&, Wasm::CompiledFunctions&, SymbolTable*);
</del><ins>+ static JSWebAssemblyModule* create(VM&, Structure*, std::unique_ptr<Wasm::ModuleInformation>&, SymbolTable* exports, unsigned calleeCount);
</ins><span class="cx"> static Structure* createStructure(VM&, JSGlobalObject*, JSValue);
</span><span class="cx">
</span><span class="cx"> DECLARE_INFO;
</span><span class="cx">
</span><span class="cx"> const Wasm::ModuleInformation& moduleInformation() const { return *m_moduleInformation.get(); }
</span><del>- const Wasm::CompiledFunctions& 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 < m_calleeCount);
+ return callees()[calleeIndex].get();
+ }
+
+ WriteBarrier<JSWebAssemblyCallee>* callees()
+ {
+ return bitwise_cast<WriteBarrier<JSWebAssemblyCallee>*>(bitwise_cast<char*>(this) + offsetOfCallees());
+ }
+
</ins><span class="cx"> protected:
</span><del>- JSWebAssemblyModule(VM&, Structure*, std::unique_ptr<Wasm::ModuleInformation>&, Wasm::CompiledFunctions&);
</del><ins>+ JSWebAssemblyModule(VM&, Structure*, std::unique_ptr<Wasm::ModuleInformation>&, unsigned calleeCount);
</ins><span class="cx"> void finishCreation(VM&, SymbolTable*);
</span><span class="cx"> static void destroy(JSCell*);
</span><span class="cx"> static void visitChildren(JSCell*, SlotVisitor&);
</span><ins>+
</ins><span class="cx"> private:
</span><ins>+ static size_t offsetOfCallees()
+ {
+ return WTF::roundUpToMultipleOf<sizeof(WriteBarrier<JSWebAssemblyCallee>)>(sizeof(JSWebAssemblyModule));
+ }
+
+ static size_t allocationSize(unsigned numCallees)
+ {
+ return offsetOfCallees() + sizeof(WriteBarrier<JSWebAssemblyCallee>) * numCallees;
+ }
+
</ins><span class="cx"> std::unique_ptr<Wasm::ModuleInformation> m_moduleInformation;
</span><del>- Wasm::CompiledFunctions m_compiledFunctions;
</del><span class="cx"> WriteBarrier<SymbolTable> 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 "JSCInlines.h"
</span><span class="cx"> #include "JSFunctionInlines.h"
</span><span class="cx"> #include "JSObject.h"
</span><ins>+#include "JSWebAssemblyCallee.h"
</ins><span class="cx"> #include "JSWebAssemblyInstance.h"
</span><span class="cx"> #include "LLIntThunks.h"
</span><span class="cx"> #include "ProtoCallFrame.h"
</span><span class="cx"> #include "VM.h"
</span><span class="cx"> #include "WasmFormat.h"
</span><del>-#include "WebAssemblyFunctionCell.h"
</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& vm = exec->vm();
</del><ins>+ VM& vm = exec->vm();
</ins><span class="cx"> auto scope = DECLARE_THROW_SCOPE(vm);
</span><del>- WebAssemblyFunction* callee = jsDynamicCast<WebAssemblyFunction*>(exec->jsCallee());
- if (!callee)
</del><ins>+ WebAssemblyFunction* wasmFunction = jsDynamicCast<WebAssemblyFunction*>(exec->jsCallee());
+ if (!wasmFunction)
</ins><span class="cx"> return JSValue::encode(throwException(exec, scope, createTypeError(exec, "expected a WebAssembly function", defaultSourceAppender, runtimeTypeForValue(exec->jsCallee()))));
</span><del>- const CallableWebAssemblyFunction& callable = callee->webAssemblyFunctionCell()->function();
- const B3::Compilation* jsEntryPoint = callable.jsEntryPoint;
- const Wasm::Signature* signature = callable.signature;
</del><ins>+ const Wasm::Signature* signature = wasmFunction->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->argumentCount() != signature->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->code().executableAddress(), &vm, &protoCallFrame);
</del><ins>+ EncodedJSValue rawResult = vmEntryToWasm(wasmFunction->webAssemblyCallee()->jsEntryPoint(), &vm, &protoCallFrame);
</ins><span class="cx"> // FIXME is this correct? https://bugs.webkit.org/show_bug.cgi?id=164876
</span><span class="cx"> switch (signature->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& vm, JSGlobalObject* globalObject, int length, const String& name, JSWebAssemblyInstance* instance, CallableWebAssemblyFunction&& callable)
</del><ins>+WebAssemblyFunction* WebAssemblyFunction::create(VM& vm, JSGlobalObject* globalObject, unsigned length, const String& 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->webAssemblyFunctionStructure();
</span><span class="cx"> WebAssemblyFunction* function = new (NotNull, allocateCell<WebAssemblyFunction>(vm.heap)) WebAssemblyFunction(vm, globalObject, structure);
</span><del>- function->finishCreation(vm, executable, length, name, instance, functionCell);
</del><ins>+ function->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(&thisObject->m_instance);
</span><del>- visitor.append(&thisObject->m_functionCell);
</del><ins>+ visitor.append(&thisObject->m_wasmCallee);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WebAssemblyFunction::finishCreation(VM& vm, NativeExecutable* executable, int length, const String& name, JSWebAssemblyInstance* instance, WebAssemblyFunctionCell* functionCell)
</del><ins>+void WebAssemblyFunction::finishCreation(VM& vm, NativeExecutable* executable, unsigned length, const String& 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&&) = 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&, JSGlobalObject*, int, const String&, JSWebAssemblyInstance*, CallableWebAssemblyFunction&&);
</del><ins>+ JS_EXPORT_PRIVATE static WebAssemblyFunction* create(VM&, JSGlobalObject*, unsigned, const String&, JSWebAssemblyInstance*, JSWebAssemblyCallee*, Wasm::Signature*);
</ins><span class="cx"> static Structure* createStructure(VM&, 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&);
</span><span class="cx">
</span><del>- void finishCreation(VM&, NativeExecutable*, int length, const String& name, JSWebAssemblyInstance*, WebAssemblyFunctionCell*);
</del><ins>+ void finishCreation(VM&, NativeExecutable*, unsigned length, const String& name, JSWebAssemblyInstance*, JSWebAssemblyCallee*, Wasm::Signature*);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> WebAssemblyFunction(VM&, JSGlobalObject*, Structure*);
</span><span class="cx">
</span><span class="cx"> WriteBarrier<JSWebAssemblyInstance> m_instance;
</span><del>- WriteBarrier<WebAssemblyFunctionCell> m_functionCell;
</del><ins>+ WriteBarrier<JSWebAssemblyCallee> 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 "config.h"
-#include "WebAssemblyFunctionCell.h"
-
-#if ENABLE(WEBASSEMBLY)
-
-#include "JSCInlines.h"
-
-namespace JSC {
-
-const ClassInfo WebAssemblyFunctionCell::s_info = { "WebAssemblyFunctionCell", nullptr, nullptr, CREATE_METHOD_TABLE(WebAssemblyFunctionCell) };
-
-WebAssemblyFunctionCell* WebAssemblyFunctionCell::create(VM& vm, CallableWebAssemblyFunction&& callable)
-{
- WebAssemblyFunctionCell* nativeFunction = new (NotNull, allocateCell<WebAssemblyFunctionCell>(vm.heap)) WebAssemblyFunctionCell(vm, WTFMove(callable));
- nativeFunction->finishCreation(vm);
- return nativeFunction;
-}
-
-WebAssemblyFunctionCell::WebAssemblyFunctionCell(VM& vm, CallableWebAssemblyFunction&& callable)
- : Base(vm, vm.webAssemblyFunctionCellStructure.get())
- , m_function(WTFMove(callable))
-{
-}
-
-void WebAssemblyFunctionCell::destroy(JSCell* cell)
-{
- WebAssemblyFunctionCell* nativeFunction = static_cast<WebAssemblyFunctionCell*>(cell);
- nativeFunction->WebAssemblyFunctionCell::~WebAssemblyFunctionCell();
-}
-
-Structure* WebAssemblyFunctionCell::createStructure(VM& 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 "JSCell.h"
-#include "WebAssemblyFunction.h"
-
-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&, CallableWebAssemblyFunction&&);
- static void destroy(JSCell*);
- static Structure* createStructure(VM&, JSGlobalObject*, JSValue);
-
- DECLARE_INFO;
-
- const CallableWebAssemblyFunction& function() const { return m_function; }
-
-private:
- WebAssemblyFunctionCell(VM&, CallableWebAssemblyFunction&&);
-
- 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 "JSArrayBuffer.h"
</span><span class="cx"> #include "JSCInlines.h"
</span><span class="cx"> #include "JSTypedArrays.h"
</span><ins>+#include "JSWebAssemblyCallee.h"
</ins><span class="cx"> #include "JSWebAssemblyCompileError.h"
</span><span class="cx"> #include "JSWebAssemblyModule.h"
</span><span class="cx"> #include "SymbolTable.h"
</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& vm = state->vm();
</del><ins>+ VM& vm = state->vm();
</ins><span class="cx"> auto scope = DECLARE_THROW_SCOPE(vm);
</span><span class="cx"> JSValue val = state->argument(0);
</span><span class="cx">
</span><span class="lines">@@ -87,7 +88,13 @@
</span><span class="cx"> exportSymbolTable->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->jsCallee()->globalObject(),
+ [&] (unsigned calleeIndex, JSWebAssemblyCallee* callee) {
+ result->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->lexicalGlobalObject();
</span><span class="cx">
</span><span class="cx"> const Wasm::ModuleInformation& moduleInformation = instance->module()->moduleInformation();
</span><del>- const Wasm::CompiledFunctions& compiledFunctions = instance->module()->compiledFunctions();
</del><span class="cx"> SymbolTable* exportSymbolTable = instance->module()->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->jsEntryPoint.get();
- const Wasm::Signature* signature = moduleInformation.functions.at(exp.functionIndex).signature;
- WebAssemblyFunction* function = WebAssemblyFunction::create(vm, globalObject, signature->arguments.size(), exp.field.string(), instance, CallableWebAssemblyFunction(jsEntryPoint, signature));
</del><ins>+ JSWebAssemblyCallee* wasmCallee = instance->module()->callee(exp.functionIndex);
+ Wasm::Signature* signature = moduleInformation.functions.at(exp.functionIndex).signature;
+ WebAssemblyFunction* function = WebAssemblyFunction::create(vm, globalObject, signature->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>