<!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>[189123] trunk/Source</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/189123">189123</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-08-28 14:07:22 -0700 (Fri, 28 Aug 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Create WebAssembly functions
https://bugs.webkit.org/show_bug.cgi?id=148373

Patch by Sukolsak Sakshuwong &lt;sukolsak@gmail.com&gt; on 2015-08-28
Reviewed by Filip Pizlo.

Source/JavaScriptCore:

Create functions from WebAssembly files generated by pack-asmjs
&lt;https://github.com/WebAssembly/polyfill-prototype-1&gt;.
WebAssembly functions created by this patch can only return 0.
Actual code generation will be implemented in subsequent patches.

This patch introduces WebAssemblyExecutable, a new subclass of
ExecutableBase for WebAssembly functions. CodeBlocks can now have
an owner that is not a ScriptExecutable. This patch changes the
return type of CodeBlock::ownerExecutable() from ScriptExecutable*
to ExecutableBase*. It also changes code that calls ScriptExecutable's
methods on CodeBlock::ownerExecutable() to use
CodeBlock::ownerScriptExecutable(), which does jsCast&lt;ScriptExecutable*&gt;.

Since ownerScriptExecutable() is called from WebCore and it uses
jsCast&lt;ScriptExecutable*&gt;, this patch needs to export
ScriptExecutable::info(). This should fix the build error in
https://bugs.webkit.org/show_bug.cgi?id=148555

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::hash):
(JSC::CodeBlock::sourceCodeForTools):
(JSC::CodeBlock::dumpAssumingJITType):
(JSC::CodeBlock::dumpSource):
(JSC::CodeBlock::CodeBlock):
(JSC::CodeBlock::finalizeUnconditionally):
(JSC::CodeBlock::lineNumberForBytecodeOffset):
(JSC::CodeBlock::expressionRangeForBytecodeOffset):
(JSC::CodeBlock::install):
(JSC::CodeBlock::newReplacement):
(JSC::WebAssemblyCodeBlock::replacement):
(JSC::WebAssemblyCodeBlock::capabilityLevelInternal):
(JSC::CodeBlock::updateAllPredictions):
(JSC::CodeBlock::insertBasicBlockBoundariesForControlFlowProfiler):
* bytecode/CodeBlock.h:
(JSC::CodeBlock::ownerExecutable):
(JSC::CodeBlock::ownerScriptExecutable):
(JSC::CodeBlock::codeType):
(JSC::WebAssemblyCodeBlock::WebAssemblyCodeBlock):
* debugger/Debugger.cpp:
(JSC::Debugger::toggleBreakpoint):
* debugger/DebuggerCallFrame.cpp:
(JSC::DebuggerCallFrame::sourceIDForCallFrame):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::InlineStackEntry::executable):
(JSC::DFG::ByteCodeParser::inliningCost):
(JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
(JSC::DFG::ByteCodeParser::parseCodeBlock):
* dfg/DFGCapabilities.cpp:
(JSC::DFG::isSupportedForInlining):
(JSC::DFG::mightCompileEval):
(JSC::DFG::mightCompileProgram):
(JSC::DFG::mightCompileFunctionForCall):
(JSC::DFG::mightCompileFunctionForConstruct):
* dfg/DFGGraph.h:
(JSC::DFG::Graph::executableFor):
* dfg/DFGOSREntry.cpp:
(JSC::DFG::prepareOSREntry):
* inspector/ScriptCallStackFactory.cpp:
(Inspector::CreateScriptCallStackFunctor::operator()):
* interpreter/Interpreter.cpp:
(JSC::eval):
(JSC::isWebAssemblyExecutable):
(JSC::GetStackTraceFunctor::operator()):
(JSC::UnwindFunctor::operator()):
* interpreter/StackVisitor.cpp:
(JSC::StackVisitor::Frame::sourceURL):
(JSC::StackVisitor::Frame::computeLineAndColumn):
* jit/JITOperations.cpp:
* jit/Repatch.cpp:
(JSC::linkPolymorphicCall):
* llint/LLIntData.cpp:
(JSC::LLInt::Data::performAssertions):
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::setUpCall):
* llint/LowLevelInterpreter.asm:
* runtime/CommonSlowPaths.cpp:
(JSC::SLOW_PATH_DECL):
* runtime/Executable.cpp:
(JSC::WebAssemblyExecutable::WebAssemblyExecutable):
(JSC::WebAssemblyExecutable::destroy):
(JSC::WebAssemblyExecutable::visitChildren):
(JSC::WebAssemblyExecutable::clearCode):
(JSC::WebAssemblyExecutable::prepareForExecution):
* runtime/Executable.h:
(JSC::ExecutableBase::isEvalExecutable):
(JSC::ExecutableBase::isFunctionExecutable):
(JSC::ExecutableBase::isProgramExecutable):
(JSC::ExecutableBase::isWebAssemblyExecutable):
(JSC::ExecutableBase::clearCodeVirtual):
* runtime/JSFunction.cpp:
(JSC::JSFunction::create):
* runtime/JSFunction.h:
* runtime/JSFunctionInlines.h:
(JSC::JSFunction::JSFunction):
(JSC::JSFunction::isBuiltinFunction):
* runtime/JSType.h:
* runtime/VM.cpp:
(JSC::VM::VM):
* runtime/VM.h:
* wasm/JSWASMModule.h:
(JSC::JSWASMModule::functions):
* wasm/WASMFunctionParser.cpp:
(JSC::WASMFunctionParser::compile):
* wasm/WASMFunctionParser.h:
* wasm/WASMModuleParser.cpp:
(JSC::WASMModuleParser::WASMModuleParser):
(JSC::WASMModuleParser::parse):
(JSC::WASMModuleParser::parseFunctionDeclarationSection):
(JSC::WASMModuleParser::parseFunctionDefinition):
(JSC::WASMModuleParser::parseExportSection):
(JSC::parseWebAssembly):
* wasm/WASMModuleParser.h:

Source/WebCore:

No new tests, because it is a function rename.

* testing/Internals.cpp:
(WebCore::Internals::parserMetaData):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeCodeBlockcpp">trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeCodeBlockh">trunk/Source/JavaScriptCore/bytecode/CodeBlock.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredebuggerDebuggercpp">trunk/Source/JavaScriptCore/debugger/Debugger.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredebuggerDebuggerCallFramecpp">trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGByteCodeParsercpp">trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGCapabilitiescpp">trunk/Source/JavaScriptCore/dfg/DFGCapabilities.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGGraphh">trunk/Source/JavaScriptCore/dfg/DFGGraph.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGOSREntrycpp">trunk/Source/JavaScriptCore/dfg/DFGOSREntry.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorScriptCallStackFactorycpp">trunk/Source/JavaScriptCore/inspector/ScriptCallStackFactory.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinterpreterInterpretercpp">trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinterpreterStackVisitorcpp">trunk/Source/JavaScriptCore/interpreter/StackVisitor.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITOperationscpp">trunk/Source/JavaScriptCore/jit/JITOperations.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitRepatchcpp">trunk/Source/JavaScriptCore/jit/Repatch.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorellintLLIntDatacpp">trunk/Source/JavaScriptCore/llint/LLIntData.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorellintLLIntSlowPathscpp">trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorellintLowLevelInterpreterasm">trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeCommonSlowPathscpp">trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeExecutablecpp">trunk/Source/JavaScriptCore/runtime/Executable.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeExecutableh">trunk/Source/JavaScriptCore/runtime/Executable.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSFunctioncpp">trunk/Source/JavaScriptCore/runtime/JSFunction.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSFunctionh">trunk/Source/JavaScriptCore/runtime/JSFunction.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSFunctionInlinesh">trunk/Source/JavaScriptCore/runtime/JSFunctionInlines.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSTypeh">trunk/Source/JavaScriptCore/runtime/JSType.h</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="#trunkSourceJavaScriptCorewasmJSWASMModuleh">trunk/Source/JavaScriptCore/wasm/JSWASMModule.h</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWASMFunctionParsercpp">trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWASMFunctionParserh">trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.h</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWASMModuleParsercpp">trunk/Source/JavaScriptCore/wasm/WASMModuleParser.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWASMModuleParserh">trunk/Source/JavaScriptCore/wasm/WASMModuleParser.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoretestingInternalscpp">trunk/Source/WebCore/testing/Internals.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -1,3 +1,123 @@
</span><ins>+2015-08-28  Sukolsak Sakshuwong  &lt;sukolsak@gmail.com&gt;
+
+        Create WebAssembly functions
+        https://bugs.webkit.org/show_bug.cgi?id=148373
+
+        Reviewed by Filip Pizlo.
+
+        Create functions from WebAssembly files generated by pack-asmjs
+        &lt;https://github.com/WebAssembly/polyfill-prototype-1&gt;.
+        WebAssembly functions created by this patch can only return 0.
+        Actual code generation will be implemented in subsequent patches.
+
+        This patch introduces WebAssemblyExecutable, a new subclass of
+        ExecutableBase for WebAssembly functions. CodeBlocks can now have
+        an owner that is not a ScriptExecutable. This patch changes the
+        return type of CodeBlock::ownerExecutable() from ScriptExecutable*
+        to ExecutableBase*. It also changes code that calls ScriptExecutable's
+        methods on CodeBlock::ownerExecutable() to use
+        CodeBlock::ownerScriptExecutable(), which does jsCast&lt;ScriptExecutable*&gt;.
+
+        Since ownerScriptExecutable() is called from WebCore and it uses
+        jsCast&lt;ScriptExecutable*&gt;, this patch needs to export
+        ScriptExecutable::info(). This should fix the build error in
+        https://bugs.webkit.org/show_bug.cgi?id=148555
+
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::hash):
+        (JSC::CodeBlock::sourceCodeForTools):
+        (JSC::CodeBlock::dumpAssumingJITType):
+        (JSC::CodeBlock::dumpSource):
+        (JSC::CodeBlock::CodeBlock):
+        (JSC::CodeBlock::finalizeUnconditionally):
+        (JSC::CodeBlock::lineNumberForBytecodeOffset):
+        (JSC::CodeBlock::expressionRangeForBytecodeOffset):
+        (JSC::CodeBlock::install):
+        (JSC::CodeBlock::newReplacement):
+        (JSC::WebAssemblyCodeBlock::replacement):
+        (JSC::WebAssemblyCodeBlock::capabilityLevelInternal):
+        (JSC::CodeBlock::updateAllPredictions):
+        (JSC::CodeBlock::insertBasicBlockBoundariesForControlFlowProfiler):
+        * bytecode/CodeBlock.h:
+        (JSC::CodeBlock::ownerExecutable):
+        (JSC::CodeBlock::ownerScriptExecutable):
+        (JSC::CodeBlock::codeType):
+        (JSC::WebAssemblyCodeBlock::WebAssemblyCodeBlock):
+        * debugger/Debugger.cpp:
+        (JSC::Debugger::toggleBreakpoint):
+        * debugger/DebuggerCallFrame.cpp:
+        (JSC::DebuggerCallFrame::sourceIDForCallFrame):
+        * dfg/DFGByteCodeParser.cpp:
+        (JSC::DFG::ByteCodeParser::InlineStackEntry::executable):
+        (JSC::DFG::ByteCodeParser::inliningCost):
+        (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
+        (JSC::DFG::ByteCodeParser::parseCodeBlock):
+        * dfg/DFGCapabilities.cpp:
+        (JSC::DFG::isSupportedForInlining):
+        (JSC::DFG::mightCompileEval):
+        (JSC::DFG::mightCompileProgram):
+        (JSC::DFG::mightCompileFunctionForCall):
+        (JSC::DFG::mightCompileFunctionForConstruct):
+        * dfg/DFGGraph.h:
+        (JSC::DFG::Graph::executableFor):
+        * dfg/DFGOSREntry.cpp:
+        (JSC::DFG::prepareOSREntry):
+        * inspector/ScriptCallStackFactory.cpp:
+        (Inspector::CreateScriptCallStackFunctor::operator()):
+        * interpreter/Interpreter.cpp:
+        (JSC::eval):
+        (JSC::isWebAssemblyExecutable):
+        (JSC::GetStackTraceFunctor::operator()):
+        (JSC::UnwindFunctor::operator()):
+        * interpreter/StackVisitor.cpp:
+        (JSC::StackVisitor::Frame::sourceURL):
+        (JSC::StackVisitor::Frame::computeLineAndColumn):
+        * jit/JITOperations.cpp:
+        * jit/Repatch.cpp:
+        (JSC::linkPolymorphicCall):
+        * llint/LLIntData.cpp:
+        (JSC::LLInt::Data::performAssertions):
+        * llint/LLIntSlowPaths.cpp:
+        (JSC::LLInt::setUpCall):
+        * llint/LowLevelInterpreter.asm:
+        * runtime/CommonSlowPaths.cpp:
+        (JSC::SLOW_PATH_DECL):
+        * runtime/Executable.cpp:
+        (JSC::WebAssemblyExecutable::WebAssemblyExecutable):
+        (JSC::WebAssemblyExecutable::destroy):
+        (JSC::WebAssemblyExecutable::visitChildren):
+        (JSC::WebAssemblyExecutable::clearCode):
+        (JSC::WebAssemblyExecutable::prepareForExecution):
+        * runtime/Executable.h:
+        (JSC::ExecutableBase::isEvalExecutable):
+        (JSC::ExecutableBase::isFunctionExecutable):
+        (JSC::ExecutableBase::isProgramExecutable):
+        (JSC::ExecutableBase::isWebAssemblyExecutable):
+        (JSC::ExecutableBase::clearCodeVirtual):
+        * runtime/JSFunction.cpp:
+        (JSC::JSFunction::create):
+        * runtime/JSFunction.h:
+        * runtime/JSFunctionInlines.h:
+        (JSC::JSFunction::JSFunction):
+        (JSC::JSFunction::isBuiltinFunction):
+        * runtime/JSType.h:
+        * runtime/VM.cpp:
+        (JSC::VM::VM):
+        * runtime/VM.h:
+        * wasm/JSWASMModule.h:
+        (JSC::JSWASMModule::functions):
+        * wasm/WASMFunctionParser.cpp:
+        (JSC::WASMFunctionParser::compile):
+        * wasm/WASMFunctionParser.h:
+        * wasm/WASMModuleParser.cpp:
+        (JSC::WASMModuleParser::WASMModuleParser):
+        (JSC::WASMModuleParser::parse):
+        (JSC::WASMModuleParser::parseFunctionDeclarationSection):
+        (JSC::WASMModuleParser::parseFunctionDefinition):
+        (JSC::WASMModuleParser::parseExportSection):
+        (JSC::parseWebAssembly):
+        * wasm/WASMModuleParser.h:
+
</ins><span class="cx"> 2015-08-28  Mark Lam  &lt;mark.lam@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Follow up] ScratchRegisterAllocator::preserveReusedRegistersByPushing() should allow room for C helper calls and keep sp properly aligned.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeCodeBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -107,7 +107,7 @@
</span><span class="cx"> {
</span><span class="cx">     if (!m_hash) {
</span><span class="cx">         RELEASE_ASSERT(isSafeToComputeHash());
</span><del>-        m_hash = CodeBlockHash(ownerExecutable()-&gt;source(), specializationKind());
</del><ins>+        m_hash = CodeBlockHash(ownerScriptExecutable()-&gt;source(), specializationKind());
</ins><span class="cx">     }
</span><span class="cx">     return m_hash;
</span><span class="cx"> }
</span><span class="lines">@@ -115,7 +115,7 @@
</span><span class="cx"> CString CodeBlock::sourceCodeForTools() const
</span><span class="cx"> {
</span><span class="cx">     if (codeType() != FunctionCode)
</span><del>-        return ownerExecutable()-&gt;source().toUTF8();
</del><ins>+        return ownerScriptExecutable()-&gt;source().toUTF8();
</ins><span class="cx">     
</span><span class="cx">     SourceProvider* provider = source();
</span><span class="cx">     FunctionExecutable* executable = jsCast&lt;FunctionExecutable*&gt;(ownerExecutable());
</span><span class="lines">@@ -155,13 +155,13 @@
</span><span class="cx">     out.print(&quot;, &quot;, instructionCount());
</span><span class="cx">     if (this-&gt;jitType() == JITCode::BaselineJIT &amp;&amp; m_shouldAlwaysBeInlined)
</span><span class="cx">         out.print(&quot; (ShouldAlwaysBeInlined)&quot;);
</span><del>-    if (ownerExecutable()-&gt;neverInline())
</del><ins>+    if (ownerScriptExecutable()-&gt;neverInline())
</ins><span class="cx">         out.print(&quot; (NeverInline)&quot;);
</span><del>-    if (ownerExecutable()-&gt;neverOptimize())
</del><ins>+    if (ownerScriptExecutable()-&gt;neverOptimize())
</ins><span class="cx">         out.print(&quot; (NeverOptimize)&quot;);
</span><del>-    if (ownerExecutable()-&gt;didTryToEnterInLoop())
</del><ins>+    if (ownerScriptExecutable()-&gt;didTryToEnterInLoop())
</ins><span class="cx">         out.print(&quot; (DidTryToEnterInLoop)&quot;);
</span><del>-    if (ownerExecutable()-&gt;isStrictMode())
</del><ins>+    if (ownerScriptExecutable()-&gt;isStrictMode())
</ins><span class="cx">         out.print(&quot; (StrictMode)&quot;);
</span><span class="cx">     if (this-&gt;jitType() == JITCode::BaselineJIT &amp;&amp; m_didFailFTLCompilation)
</span><span class="cx">         out.print(&quot; (FTLFail)&quot;);
</span><span class="lines">@@ -554,7 +554,7 @@
</span><span class="cx"> 
</span><span class="cx"> void CodeBlock::dumpSource(PrintStream&amp; out)
</span><span class="cx"> {
</span><del>-    ScriptExecutable* executable = ownerExecutable();
</del><ins>+    ScriptExecutable* executable = ownerScriptExecutable();
</ins><span class="cx">     if (executable-&gt;isFunctionExecutable()) {
</span><span class="cx">         FunctionExecutable* functionExecutable = reinterpret_cast&lt;FunctionExecutable*&gt;(executable);
</span><span class="cx">         String source = functionExecutable-&gt;source().provider()-&gt;getRange(
</span><span class="lines">@@ -1753,7 +1753,7 @@
</span><span class="cx">     setNumParameters(unlinkedCodeBlock-&gt;numParameters());
</span><span class="cx"> 
</span><span class="cx">     if (vm()-&gt;typeProfiler() || vm()-&gt;controlFlowProfiler())
</span><del>-        vm()-&gt;functionHasExecutedCache()-&gt;removeUnexecutedRange(m_ownerExecutable-&gt;sourceID(), m_ownerExecutable-&gt;typeProfilingStartOffset(), m_ownerExecutable-&gt;typeProfilingEndOffset());
</del><ins>+        vm()-&gt;functionHasExecutedCache()-&gt;removeUnexecutedRange(ownerExecutable-&gt;sourceID(), ownerExecutable-&gt;typeProfilingStartOffset(), ownerExecutable-&gt;typeProfilingEndOffset());
</ins><span class="cx"> 
</span><span class="cx">     setConstantRegisters(unlinkedCodeBlock-&gt;constantRegisters(), unlinkedCodeBlock-&gt;constantsSourceCodeRepresentation());
</span><span class="cx">     if (unlinkedCodeBlock-&gt;usesGlobalObject())
</span><span class="lines">@@ -1787,7 +1787,7 @@
</span><span class="cx">     for (size_t count = unlinkedCodeBlock-&gt;numberOfFunctionDecls(), i = 0; i &lt; count; ++i) {
</span><span class="cx">         UnlinkedFunctionExecutable* unlinkedExecutable = unlinkedCodeBlock-&gt;functionDecl(i);
</span><span class="cx">         if (vm()-&gt;typeProfiler() || vm()-&gt;controlFlowProfiler())
</span><del>-            vm()-&gt;functionHasExecutedCache()-&gt;insertUnexecutedRange(m_ownerExecutable-&gt;sourceID(), unlinkedExecutable-&gt;typeProfilingStartOffset(), unlinkedExecutable-&gt;typeProfilingEndOffset());
</del><ins>+            vm()-&gt;functionHasExecutedCache()-&gt;insertUnexecutedRange(ownerExecutable-&gt;sourceID(), unlinkedExecutable-&gt;typeProfilingStartOffset(), unlinkedExecutable-&gt;typeProfilingEndOffset());
</ins><span class="cx">         m_functionDecls[i].set(*m_vm, ownerExecutable, unlinkedExecutable-&gt;link(*m_vm, ownerExecutable-&gt;source()));
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -1795,7 +1795,7 @@
</span><span class="cx">     for (size_t count = unlinkedCodeBlock-&gt;numberOfFunctionExprs(), i = 0; i &lt; count; ++i) {
</span><span class="cx">         UnlinkedFunctionExecutable* unlinkedExecutable = unlinkedCodeBlock-&gt;functionExpr(i);
</span><span class="cx">         if (vm()-&gt;typeProfiler() || vm()-&gt;controlFlowProfiler())
</span><del>-            vm()-&gt;functionHasExecutedCache()-&gt;insertUnexecutedRange(m_ownerExecutable-&gt;sourceID(), unlinkedExecutable-&gt;typeProfilingStartOffset(), unlinkedExecutable-&gt;typeProfilingEndOffset());
</del><ins>+            vm()-&gt;functionHasExecutedCache()-&gt;insertUnexecutedRange(ownerExecutable-&gt;sourceID(), unlinkedExecutable-&gt;typeProfilingStartOffset(), unlinkedExecutable-&gt;typeProfilingEndOffset());
</ins><span class="cx">         m_functionExprs[i].set(*m_vm, ownerExecutable, unlinkedExecutable-&gt;link(*m_vm, ownerExecutable-&gt;source()));
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -1927,7 +1927,7 @@
</span><span class="cx"> 
</span><span class="cx">             instructions[i + opLength - 1] = objectAllocationProfile;
</span><span class="cx">             objectAllocationProfile-&gt;initialize(*vm(),
</span><del>-                m_ownerExecutable.get(), m_globalObject-&gt;objectPrototype(), inferredInlineCapacity);
</del><ins>+                ownerExecutable, m_globalObject-&gt;objectPrototype(), inferredInlineCapacity);
</ins><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -2108,7 +2108,7 @@
</span><span class="cx">                     // the user's program, give the type profiler some range to identify these return statements.
</span><span class="cx">                     // Currently, the text offset that is used as identification is &quot;f&quot; in the function keyword
</span><span class="cx">                     // and is stored on TypeLocation's m_divotForFunctionOffsetIfReturnStatement member variable.
</span><del>-                    divotStart = divotEnd = m_ownerExecutable-&gt;typeProfilingStartOffset();
</del><ins>+                    divotStart = divotEnd = ownerExecutable-&gt;typeProfilingStartOffset();
</ins><span class="cx">                     shouldAnalyze = true;
</span><span class="cx">                 }
</span><span class="cx">                 break;
</span><span class="lines">@@ -2116,12 +2116,12 @@
</span><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             std::pair&lt;TypeLocation*, bool&gt; locationPair = vm()-&gt;typeProfiler()-&gt;typeLocationCache()-&gt;getTypeLocation(globalVariableID,
</span><del>-                m_ownerExecutable-&gt;sourceID(), divotStart, divotEnd, globalTypeSet, vm());
</del><ins>+                ownerExecutable-&gt;sourceID(), divotStart, divotEnd, globalTypeSet, vm());
</ins><span class="cx">             TypeLocation* location = locationPair.first;
</span><span class="cx">             bool isNewLocation = locationPair.second;
</span><span class="cx"> 
</span><span class="cx">             if (flag == ProfileTypeBytecodeFunctionReturnStatement)
</span><del>-                location-&gt;m_divotForFunctionOffsetIfReturnStatement = m_ownerExecutable-&gt;typeProfilingStartOffset();
</del><ins>+                location-&gt;m_divotForFunctionOffsetIfReturnStatement = ownerExecutable-&gt;typeProfilingStartOffset();
</ins><span class="cx"> 
</span><span class="cx">             if (shouldAnalyze &amp;&amp; isNewLocation)
</span><span class="cx">                 vm()-&gt;typeProfiler()-&gt;insertNewLocation(location);
</span><span class="lines">@@ -2165,6 +2165,39 @@
</span><span class="cx">     m_heap-&gt;reportExtraMemoryAllocated(sizeof(CodeBlock) + m_instructions.size() * sizeof(Instruction));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(WEBASSEMBLY)
+CodeBlock::CodeBlock(WebAssemblyExecutable* ownerExecutable, VM&amp; vm, JSGlobalObject* globalObject)
+    : m_globalObject(globalObject-&gt;vm(), ownerExecutable, globalObject)
+    , m_heap(&amp;m_globalObject-&gt;vm().heap)
+    , m_numCalleeRegisters(0)
+    , m_numVars(0)
+    , m_isConstructor(false)
+    , m_shouldAlwaysBeInlined(false)
+    , m_didFailFTLCompilation(false)
+    , m_hasBeenCompiledWithFTL(false)
+    , m_hasDebuggerStatement(false)
+    , m_steppingMode(SteppingModeDisabled)
+    , m_numBreakpoints(0)
+    , m_ownerExecutable(m_globalObject-&gt;vm(), ownerExecutable, ownerExecutable)
+    , m_vm(&amp;vm)
+    , m_isStrictMode(false)
+    , m_needsActivation(false)
+    , m_mayBeExecuting(false)
+    , m_codeType(FunctionCode)
+    , m_osrExitCounter(0)
+    , m_optimizationDelayCounter(0)
+    , m_reoptimizationRetryCounter(0)
+#if ENABLE(JIT)
+    , m_capabilityLevelState(DFG::CannotCompile)
+#endif
+{
+    ASSERT(m_heap-&gt;isDeferred());
+
+    m_heap-&gt;m_codeBlocks.add(this);
+    m_heap-&gt;reportExtraMemoryAllocated(sizeof(CodeBlock));
+}
+#endif
+
</ins><span class="cx"> CodeBlock::~CodeBlock()
</span><span class="cx"> {
</span><span class="cx">     if (m_vm-&gt;m_perBytecodeProfiler)
</span><span class="lines">@@ -2510,7 +2543,11 @@
</span><span class="cx"> void CodeBlock::finalizeUnconditionally()
</span><span class="cx"> {
</span><span class="cx">     Interpreter* interpreter = m_vm-&gt;interpreter;
</span><del>-    if (JITCode::couldBeInterpreted(jitType())) {
</del><ins>+    bool ownedByWebAssemblyExecutable = false;
+#if ENABLE(WEBASSEMBLY)
+    ownedByWebAssemblyExecutable = m_ownerExecutable-&gt;isWebAssemblyExecutable();
+#endif
+    if (JITCode::couldBeInterpreted(jitType()) &amp;&amp; !ownedByWebAssemblyExecutable) {
</ins><span class="cx">         const Vector&lt;unsigned&gt;&amp; propertyAccessInstructions = m_unlinkedCode-&gt;propertyAccessInstructions();
</span><span class="cx">         for (size_t size = propertyAccessInstructions.size(), i = 0; i &lt; size; ++i) {
</span><span class="cx">             Instruction* curInstruction = &amp;instructions()[propertyAccessInstructions[i]];
</span><span class="lines">@@ -2915,7 +2952,7 @@
</span><span class="cx"> unsigned CodeBlock::lineNumberForBytecodeOffset(unsigned bytecodeOffset)
</span><span class="cx"> {
</span><span class="cx">     RELEASE_ASSERT(bytecodeOffset &lt; instructions().size());
</span><del>-    return m_ownerExecutable-&gt;firstLine() + m_unlinkedCode-&gt;lineNumberForBytecodeOffset(bytecodeOffset);
</del><ins>+    return ownerScriptExecutable()-&gt;firstLine() + m_unlinkedCode-&gt;lineNumberForBytecodeOffset(bytecodeOffset);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> unsigned CodeBlock::columnNumberForBytecodeOffset(unsigned bytecodeOffset)
</span><span class="lines">@@ -2934,7 +2971,7 @@
</span><span class="cx">     m_unlinkedCode-&gt;expressionRangeForBytecodeOffset(bytecodeOffset, divot, startOffset, endOffset, line, column);
</span><span class="cx">     divot += m_sourceOffset;
</span><span class="cx">     column += line ? 1 : firstLineColumnOffset();
</span><del>-    line += m_ownerExecutable-&gt;firstLine();
</del><ins>+    line += ownerScriptExecutable()-&gt;firstLine();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool CodeBlock::hasOpDebugForLineAndColumn(unsigned line, unsigned column)
</span><span class="lines">@@ -3011,12 +3048,12 @@
</span><span class="cx"> 
</span><span class="cx"> void CodeBlock::install()
</span><span class="cx"> {
</span><del>-    ownerExecutable()-&gt;installCode(this);
</del><ins>+    ownerScriptExecutable()-&gt;installCode(this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> PassRefPtr&lt;CodeBlock&gt; CodeBlock::newReplacement()
</span><span class="cx"> {
</span><del>-    return ownerExecutable()-&gt;newReplacementCodeBlockFor(specializationKind());
</del><ins>+    return ownerScriptExecutable()-&gt;newReplacementCodeBlockFor(specializationKind());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(JIT)
</span><span class="lines">@@ -3051,7 +3088,19 @@
</span><span class="cx">         return DFG::functionForConstructCapabilityLevel(this);
</span><span class="cx">     return DFG::functionForCallCapabilityLevel(this);
</span><span class="cx"> }
</span><ins>+
+#if ENABLE(WEBASSEMBLY)
+CodeBlock* WebAssemblyCodeBlock::replacement()
+{
+    return nullptr;
+}
+
+DFG::CapabilityLevel WebAssemblyCodeBlock::capabilityLevelInternal()
+{
+    return DFG::CannotCompile;
+}
</ins><span class="cx"> #endif
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> void CodeBlock::jettison(Profiler::JettisonReason reason, ReoptimizationMode mode, const FireDetail* detail)
</span><span class="cx"> {
</span><span class="lines">@@ -3603,6 +3652,10 @@
</span><span class="cx"> 
</span><span class="cx"> void CodeBlock::updateAllPredictions()
</span><span class="cx"> {
</span><ins>+#if ENABLE(WEBASSEMBLY)
+    if (m_ownerExecutable-&gt;isWebAssemblyExecutable())
+        return;
+#endif
</ins><span class="cx">     updateAllValueProfilePredictions();
</span><span class="cx">     updateAllArrayPredictions();
</span><span class="cx"> }
</span><span class="lines">@@ -3920,7 +3973,7 @@
</span><span class="cx">             RELEASE_ASSERT(vm()-&gt;interpreter-&gt;getOpcodeID(instructions[endIdx].u.opcode) == op_profile_control_flow);
</span><span class="cx">             basicBlockEndOffset = instructions[endIdx + 1].u.operand - 1;
</span><span class="cx">         } else {
</span><del>-            basicBlockEndOffset = m_sourceOffset + m_ownerExecutable-&gt;source().length() - 1; // Offset before the closing brace.
</del><ins>+            basicBlockEndOffset = m_sourceOffset + ownerScriptExecutable()-&gt;source().length() - 1; // Offset before the closing brace.
</ins><span class="cx">             basicBlockStartOffset = std::min(basicBlockStartOffset, basicBlockEndOffset); // Some start offsets may be at the closing brace, ensure it is the offset before.
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -3948,7 +4001,7 @@
</span><span class="cx">             continue;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        BasicBlockLocation* basicBlockLocation = vm()-&gt;controlFlowProfiler()-&gt;getBasicBlockLocation(m_ownerExecutable-&gt;sourceID(), basicBlockStartOffset, basicBlockEndOffset);
</del><ins>+        BasicBlockLocation* basicBlockLocation = vm()-&gt;controlFlowProfiler()-&gt;getBasicBlockLocation(ownerScriptExecutable()-&gt;sourceID(), basicBlockStartOffset, basicBlockEndOffset);
</ins><span class="cx"> 
</span><span class="cx">         // Find all functions that are enclosed within the range: [basicBlockStartOffset, basicBlockEndOffset]
</span><span class="cx">         // and insert these functions' start/end offsets as gaps in the current BasicBlockLocation.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeCodeBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/CodeBlock.h (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/CodeBlock.h        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/bytecode/CodeBlock.h        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -96,6 +96,9 @@
</span><span class="cx">     CodeBlock(CopyParsedBlockTag, CodeBlock&amp; other);
</span><span class="cx">         
</span><span class="cx">     CodeBlock(ScriptExecutable* ownerExecutable, UnlinkedCodeBlock*, JSScope*, PassRefPtr&lt;SourceProvider&gt;, unsigned sourceOffset, unsigned firstLineColumnOffset);
</span><ins>+#if ENABLE(WEBASSEMBLY)
+    CodeBlock(WebAssemblyExecutable* ownerExecutable, VM&amp;, JSGlobalObject*);
+#endif
</ins><span class="cx"> 
</span><span class="cx">     WriteBarrier&lt;JSGlobalObject&gt; m_globalObject;
</span><span class="cx">     Heap* m_heap;
</span><span class="lines">@@ -303,7 +306,8 @@
</span><span class="cx"> 
</span><span class="cx">     void jettison(Profiler::JettisonReason, ReoptimizationMode = DontCountReoptimization, const FireDetail* = nullptr);
</span><span class="cx">     
</span><del>-    ScriptExecutable* ownerExecutable() const { return m_ownerExecutable.get(); }
</del><ins>+    ExecutableBase* ownerExecutable() const { return m_ownerExecutable.get(); }
+    ScriptExecutable* ownerScriptExecutable() const { return jsCast&lt;ScriptExecutable*&gt;(m_ownerExecutable.get()); }
</ins><span class="cx"> 
</span><span class="cx">     void setVM(VM* vm) { m_vm = vm; }
</span><span class="cx">     VM* vm() { return m_vm; }
</span><span class="lines">@@ -346,7 +350,15 @@
</span><span class="cx">         return m_needsActivation;
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    CodeType codeType() const { return m_unlinkedCode-&gt;codeType(); }
</del><ins>+    CodeType codeType() const
+    {
+#if ENABLE(WEBASSEMBLY)
+        if (m_ownerExecutable-&gt;isWebAssemblyExecutable())
+            return FunctionCode;
+#endif
+        return m_unlinkedCode-&gt;codeType();
+    }
+
</ins><span class="cx">     PutPropertySlot::Context putByIdContext() const
</span><span class="cx">     {
</span><span class="cx">         if (codeType() == EvalCode)
</span><span class="lines">@@ -983,7 +995,7 @@
</span><span class="cx">             unsigned m_numBreakpoints : 30;
</span><span class="cx">         };
</span><span class="cx">     };
</span><del>-    WriteBarrier&lt;ScriptExecutable&gt; m_ownerExecutable;
</del><ins>+    WriteBarrier&lt;ExecutableBase&gt; m_ownerExecutable;
</ins><span class="cx">     VM* m_vm;
</span><span class="cx"> 
</span><span class="cx">     RefCountedArray&lt;Instruction&gt; m_instructions;
</span><span class="lines">@@ -1134,6 +1146,27 @@
</span><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+#if ENABLE(WEBASSEMBLY)
+class WebAssemblyCodeBlock : public CodeBlock {
+public:
+    WebAssemblyCodeBlock(CopyParsedBlockTag, WebAssemblyCodeBlock&amp; other)
+        : CodeBlock(CopyParsedBlock, other)
+    {
+    }
+
+    WebAssemblyCodeBlock(WebAssemblyExecutable* ownerExecutable, VM&amp; vm, JSGlobalObject* globalObject)
+        : CodeBlock(ownerExecutable, vm, globalObject)
+    {
+    }
+
+#if ENABLE(JIT)
+protected:
+    virtual CodeBlock* replacement() override;
+    virtual DFG::CapabilityLevel capabilityLevelInternal() override;
+#endif
+};
+#endif
+
</ins><span class="cx"> inline Register&amp; ExecState::r(int index)
</span><span class="cx"> {
</span><span class="cx">     CodeBlock* codeBlock = this-&gt;codeBlock();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredebuggerDebuggercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/debugger/Debugger.cpp (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/debugger/Debugger.cpp        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/debugger/Debugger.cpp        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -227,7 +227,7 @@
</span><span class="cx"> 
</span><span class="cx"> void Debugger::toggleBreakpoint(CodeBlock* codeBlock, Breakpoint&amp; breakpoint, BreakpointState enabledOrNot)
</span><span class="cx"> {
</span><del>-    ScriptExecutable* executable = codeBlock-&gt;ownerExecutable();
</del><ins>+    ScriptExecutable* executable = codeBlock-&gt;ownerScriptExecutable();
</ins><span class="cx"> 
</span><span class="cx">     SourceID sourceID = static_cast&lt;SourceID&gt;(executable-&gt;sourceID());
</span><span class="cx">     if (breakpoint.sourceID != sourceID)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredebuggerDebuggerCallFramecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -242,7 +242,7 @@
</span><span class="cx">     CodeBlock* codeBlock = callFrame-&gt;codeBlock();
</span><span class="cx">     if (!codeBlock)
</span><span class="cx">         return noSourceID;
</span><del>-    return codeBlock-&gt;ownerExecutable()-&gt;sourceID();
</del><ins>+    return codeBlock-&gt;ownerScriptExecutable()-&gt;sourceID();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> JSValue DebuggerCallFrame::thisValueForCallFrame(CallFrame* callFrame)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGByteCodeParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -939,7 +939,7 @@
</span><span class="cx">         CodeBlock* m_profiledBlock;
</span><span class="cx">         InlineCallFrame* m_inlineCallFrame;
</span><span class="cx">         
</span><del>-        ScriptExecutable* executable() { return m_codeBlock-&gt;ownerExecutable(); }
</del><ins>+        ScriptExecutable* executable() { return m_codeBlock-&gt;ownerScriptExecutable(); }
</ins><span class="cx">         
</span><span class="cx">         QueryableExitProfile m_exitProfile;
</span><span class="cx">         
</span><span class="lines">@@ -1252,8 +1252,8 @@
</span><span class="cx">         dataLog(&quot;    Might inline function: &quot;, mightInlineFunctionFor(codeBlock, kind), &quot;\n&quot;);
</span><span class="cx">         dataLog(&quot;    Might compile function: &quot;, mightCompileFunctionFor(codeBlock, kind), &quot;\n&quot;);
</span><span class="cx">         dataLog(&quot;    Is supported for inlining: &quot;, isSupportedForInlining(codeBlock), &quot;\n&quot;);
</span><del>-        dataLog(&quot;    Needs activation: &quot;, codeBlock-&gt;ownerExecutable()-&gt;needsActivation(), &quot;\n&quot;);
-        dataLog(&quot;    Is inlining candidate: &quot;, codeBlock-&gt;ownerExecutable()-&gt;isInliningCandidate(), &quot;\n&quot;);
</del><ins>+        dataLog(&quot;    Needs activation: &quot;, codeBlock-&gt;ownerScriptExecutable()-&gt;needsActivation(), &quot;\n&quot;);
+        dataLog(&quot;    Is inlining candidate: &quot;, codeBlock-&gt;ownerScriptExecutable()-&gt;isInliningCandidate(), &quot;\n&quot;);
</ins><span class="cx">     }
</span><span class="cx">     if (!canInline(capabilityLevel)) {
</span><span class="cx">         if (verbose)
</span><span class="lines">@@ -4436,7 +4436,7 @@
</span><span class="cx">         byteCodeParser-&gt;m_graph.freeze(codeBlock-&gt;ownerExecutable());
</span><span class="cx">         // The owner is the machine code block, and we already have a barrier on that when the
</span><span class="cx">         // plan finishes.
</span><del>-        m_inlineCallFrame-&gt;executable.setWithoutWriteBarrier(codeBlock-&gt;ownerExecutable());
</del><ins>+        m_inlineCallFrame-&gt;executable.setWithoutWriteBarrier(codeBlock-&gt;ownerScriptExecutable());
</ins><span class="cx">         m_inlineCallFrame-&gt;setStackOffset(inlineCallFrameStart.offset() - JSStack::CallFrameHeaderSize);
</span><span class="cx">         if (callee) {
</span><span class="cx">             m_inlineCallFrame-&gt;calleeRecovery = ValueRecovery::constant(callee);
</span><span class="lines">@@ -4529,7 +4529,7 @@
</span><span class="cx">         }
</span><span class="cx">         dataLog(
</span><span class="cx">             &quot;: needsActivation = &quot;, codeBlock-&gt;needsActivation(),
</span><del>-            &quot;, isStrictMode = &quot;, codeBlock-&gt;ownerExecutable()-&gt;isStrictMode(), &quot;\n&quot;);
</del><ins>+            &quot;, isStrictMode = &quot;, codeBlock-&gt;ownerScriptExecutable()-&gt;isStrictMode(), &quot;\n&quot;);
</ins><span class="cx">         codeBlock-&gt;baselineVersion()-&gt;dumpBytecode();
</span><span class="cx">     }
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGCapabilitiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGCapabilities.cpp (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGCapabilities.cpp        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/dfg/DFGCapabilities.cpp        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -44,32 +44,36 @@
</span><span class="cx"> 
</span><span class="cx"> bool isSupportedForInlining(CodeBlock* codeBlock)
</span><span class="cx"> {
</span><del>-    return codeBlock-&gt;ownerExecutable()-&gt;isInliningCandidate();
</del><ins>+#if ENABLE(WEBASSEMBLY)
+    if (codeBlock-&gt;ownerExecutable()-&gt;isWebAssemblyExecutable())
+        return false;
+#endif
+    return codeBlock-&gt;ownerScriptExecutable()-&gt;isInliningCandidate();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool mightCompileEval(CodeBlock* codeBlock)
</span><span class="cx"> {
</span><span class="cx">     return isSupported()
</span><span class="cx">         &amp;&amp; codeBlock-&gt;instructionCount() &lt;= Options::maximumOptimizationCandidateInstructionCount()
</span><del>-        &amp;&amp; codeBlock-&gt;ownerExecutable()-&gt;isOkToOptimize();
</del><ins>+        &amp;&amp; codeBlock-&gt;ownerScriptExecutable()-&gt;isOkToOptimize();
</ins><span class="cx"> }
</span><span class="cx"> bool mightCompileProgram(CodeBlock* codeBlock)
</span><span class="cx"> {
</span><span class="cx">     return isSupported()
</span><span class="cx">         &amp;&amp; codeBlock-&gt;instructionCount() &lt;= Options::maximumOptimizationCandidateInstructionCount()
</span><del>-        &amp;&amp; codeBlock-&gt;ownerExecutable()-&gt;isOkToOptimize();
</del><ins>+        &amp;&amp; codeBlock-&gt;ownerScriptExecutable()-&gt;isOkToOptimize();
</ins><span class="cx"> }
</span><span class="cx"> bool mightCompileFunctionForCall(CodeBlock* codeBlock)
</span><span class="cx"> {
</span><span class="cx">     return isSupported()
</span><span class="cx">         &amp;&amp; codeBlock-&gt;instructionCount() &lt;= Options::maximumOptimizationCandidateInstructionCount()
</span><del>-        &amp;&amp; codeBlock-&gt;ownerExecutable()-&gt;isOkToOptimize();
</del><ins>+        &amp;&amp; codeBlock-&gt;ownerScriptExecutable()-&gt;isOkToOptimize();
</ins><span class="cx"> }
</span><span class="cx"> bool mightCompileFunctionForConstruct(CodeBlock* codeBlock)
</span><span class="cx"> {
</span><span class="cx">     return isSupported()
</span><span class="cx">         &amp;&amp; codeBlock-&gt;instructionCount() &lt;= Options::maximumOptimizationCandidateInstructionCount()
</span><del>-        &amp;&amp; codeBlock-&gt;ownerExecutable()-&gt;isOkToOptimize();
</del><ins>+        &amp;&amp; codeBlock-&gt;ownerScriptExecutable()-&gt;isOkToOptimize();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool mightInlineFunctionForCall(CodeBlock* codeBlock)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGGraphh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGGraph.h (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGGraph.h        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/dfg/DFGGraph.h        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -345,7 +345,7 @@
</span><span class="cx">     ScriptExecutable* executableFor(InlineCallFrame* inlineCallFrame)
</span><span class="cx">     {
</span><span class="cx">         if (!inlineCallFrame)
</span><del>-            return m_codeBlock-&gt;ownerExecutable();
</del><ins>+            return m_codeBlock-&gt;ownerScriptExecutable();
</ins><span class="cx">         
</span><span class="cx">         return inlineCallFrame-&gt;executable.get();
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGOSREntrycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGOSREntry.cpp (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGOSREntry.cpp        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/dfg/DFGOSREntry.cpp        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -112,7 +112,7 @@
</span><span class="cx">     sanitizeStackForVM(vm);
</span><span class="cx">     
</span><span class="cx">     if (bytecodeIndex)
</span><del>-        codeBlock-&gt;ownerExecutable()-&gt;setDidTryToEnterInLoop(true);
</del><ins>+        codeBlock-&gt;ownerScriptExecutable()-&gt;setDidTryToEnterInLoop(true);
</ins><span class="cx">     
</span><span class="cx">     if (codeBlock-&gt;jitType() != JITCode::DFGJIT) {
</span><span class="cx">         RELEASE_ASSERT(codeBlock-&gt;jitType() == JITCode::FTLJIT);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorScriptCallStackFactorycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/ScriptCallStackFactory.cpp (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/ScriptCallStackFactory.cpp        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/inspector/ScriptCallStackFactory.cpp        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -66,6 +66,10 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if (m_remainingCapacityForFrameCapture) {
</span><ins>+#if ENABLE(WEBASSEMBLY)
+            if (visitor-&gt;codeBlock()-&gt;ownerExecutable()-&gt;isWebAssemblyExecutable())
+                return StackVisitor::Continue;
+#endif
</ins><span class="cx">             unsigned line;
</span><span class="cx">             unsigned column;
</span><span class="cx">             visitor-&gt;computeLineAndColumn(line, column);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinterpreterInterpretercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -168,7 +168,7 @@
</span><span class="cx">         ASSERT(!callFrame-&gt;vm().exception());
</span><span class="cx"> 
</span><span class="cx">         ThisTDZMode thisTDZMode = callerCodeBlock-&gt;unlinkedCodeBlock()-&gt;constructorKind() == ConstructorKind::Derived ? ThisTDZMode::AlwaysCheck : ThisTDZMode::CheckIfNeeded;
</span><del>-        eval = callerCodeBlock-&gt;evalCodeCache().getSlow(callFrame, callerCodeBlock-&gt;ownerExecutable(), callerCodeBlock-&gt;isStrictMode(), thisTDZMode, programSource, callerScopeChain);
</del><ins>+        eval = callerCodeBlock-&gt;evalCodeCache().getSlow(callFrame, callerCodeBlock-&gt;ownerScriptExecutable(), callerCodeBlock-&gt;isStrictMode(), thisTDZMode, programSource, callerScopeChain);
</ins><span class="cx">         if (!eval)
</span><span class="cx">             return jsUndefined();
</span><span class="cx">     }
</span><span class="lines">@@ -515,6 +515,16 @@
</span><span class="cx">     return traceBuild.toString().impl();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static inline bool isWebAssemblyExecutable(ExecutableBase* executable)
+{
+#if !ENABLE(WEBASSEMBLY)
+    UNUSED_PARAM(executable);
+    return false;
+#else
+    return executable-&gt;isWebAssemblyExecutable();
+#endif
+}
+
</ins><span class="cx"> class GetStackTraceFunctor {
</span><span class="cx"> public:
</span><span class="cx">     GetStackTraceFunctor(VM&amp; vm, Vector&lt;StackFrame&gt;&amp; results, size_t remainingCapacity)
</span><span class="lines">@@ -528,15 +538,17 @@
</span><span class="cx">     {
</span><span class="cx">         VM&amp; vm = m_vm;
</span><span class="cx">         if (m_remainingCapacityForFrameCapture) {
</span><del>-            if (visitor-&gt;isJSFrame() &amp;&amp; !visitor-&gt;codeBlock()-&gt;unlinkedCodeBlock()-&gt;isBuiltinFunction()) {
</del><ins>+            if (visitor-&gt;isJSFrame()
+                &amp;&amp; !isWebAssemblyExecutable(visitor-&gt;codeBlock()-&gt;ownerExecutable())
+                &amp;&amp; !visitor-&gt;codeBlock()-&gt;unlinkedCodeBlock()-&gt;isBuiltinFunction()) {
</ins><span class="cx">                 CodeBlock* codeBlock = visitor-&gt;codeBlock();
</span><span class="cx">                 StackFrame s = {
</span><span class="cx">                     Strong&lt;JSObject&gt;(vm, visitor-&gt;callee()),
</span><span class="cx">                     getStackFrameCodeType(visitor),
</span><del>-                    Strong&lt;ScriptExecutable&gt;(vm, codeBlock-&gt;ownerExecutable()),
</del><ins>+                    Strong&lt;ScriptExecutable&gt;(vm, codeBlock-&gt;ownerScriptExecutable()),
</ins><span class="cx">                     Strong&lt;UnlinkedCodeBlock&gt;(vm, codeBlock-&gt;unlinkedCodeBlock()),
</span><span class="cx">                     codeBlock-&gt;source(),
</span><del>-                    codeBlock-&gt;ownerExecutable()-&gt;firstLine(),
</del><ins>+                    codeBlock-&gt;ownerScriptExecutable()-&gt;firstLine(),
</ins><span class="cx">                     codeBlock-&gt;firstLineColumnOffset(),
</span><span class="cx">                     codeBlock-&gt;sourceOffset(),
</span><span class="cx">                     visitor-&gt;bytecodeOffset(),
</span><span class="lines">@@ -629,7 +641,7 @@
</span><span class="cx">         m_codeBlock = visitor-&gt;codeBlock();
</span><span class="cx">         unsigned bytecodeOffset = visitor-&gt;bytecodeOffset();
</span><span class="cx"> 
</span><del>-        if (m_isTermination || !(m_handler = m_codeBlock ? m_codeBlock-&gt;handlerForBytecodeOffset(bytecodeOffset) : nullptr)) {
</del><ins>+        if (m_isTermination || !(m_handler = (m_codeBlock &amp;&amp; !isWebAssemblyExecutable(m_codeBlock-&gt;ownerExecutable())) ? m_codeBlock-&gt;handlerForBytecodeOffset(bytecodeOffset) : nullptr)) {
</ins><span class="cx">             if (!unwindCallFrame(visitor)) {
</span><span class="cx">                 if (LegacyProfiler* profiler = vm.enabledProfiler())
</span><span class="cx">                     profiler-&gt;exceptionUnwind(m_callFrame);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinterpreterStackVisitorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/interpreter/StackVisitor.cpp (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/interpreter/StackVisitor.cpp        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/interpreter/StackVisitor.cpp        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -221,7 +221,7 @@
</span><span class="cx">     case CodeType::Eval:
</span><span class="cx">     case CodeType::Function:
</span><span class="cx">     case CodeType::Global: {
</span><del>-        String sourceURL = codeBlock()-&gt;ownerExecutable()-&gt;sourceURL();
</del><ins>+        String sourceURL = codeBlock()-&gt;ownerScriptExecutable()-&gt;sourceURL();
</ins><span class="cx">         if (!sourceURL.isEmpty())
</span><span class="cx">             traceLine = sourceURL.impl();
</span><span class="cx">         break;
</span><span class="lines">@@ -292,11 +292,11 @@
</span><span class="cx">     unsigned divotColumn = 0;
</span><span class="cx">     retrieveExpressionInfo(divot, unusedStartOffset, unusedEndOffset, divotLine, divotColumn);
</span><span class="cx"> 
</span><del>-    line = divotLine + codeBlock-&gt;ownerExecutable()-&gt;firstLine();
</del><ins>+    line = divotLine + codeBlock-&gt;ownerScriptExecutable()-&gt;firstLine();
</ins><span class="cx">     column = divotColumn + (divotLine ? 1 : codeBlock-&gt;firstLineColumnOffset());
</span><span class="cx"> 
</span><del>-    if (codeBlock-&gt;ownerExecutable()-&gt;hasOverrideLineNumber())
-        line = codeBlock-&gt;ownerExecutable()-&gt;overrideLineNumber();
</del><ins>+    if (codeBlock-&gt;ownerScriptExecutable()-&gt;hasOverrideLineNumber())
+        line = codeBlock-&gt;ownerScriptExecutable()-&gt;overrideLineNumber();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void StackVisitor::Frame::retrieveExpressionInfo(int&amp; divot, int&amp; startOffset, int&amp; endOffset, unsigned&amp; line, unsigned&amp; column)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITOperationscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITOperations.cpp (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITOperations.cpp        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/jit/JITOperations.cpp        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -848,9 +848,22 @@
</span><span class="cx"> 
</span><span class="cx">     MacroAssemblerCodePtr codePtr;
</span><span class="cx">     CodeBlock* codeBlock = 0;
</span><del>-    if (executable-&gt;isHostFunction())
</del><ins>+    if (executable-&gt;isHostFunction()) {
</ins><span class="cx">         codePtr = executable-&gt;entrypointFor(*vm, kind, MustCheckArity, callLinkInfo-&gt;registerPreservationMode());
</span><del>-    else {
</del><ins>+#if ENABLE(WEBASSEMBLY)
+    } else if (executable-&gt;isWebAssemblyExecutable()) {
+        WebAssemblyExecutable* webAssemblyExecutable = static_cast&lt;WebAssemblyExecutable*&gt;(executable);
+        webAssemblyExecutable-&gt;prepareForExecution(execCallee);
+        codeBlock = webAssemblyExecutable-&gt;codeBlockForCall();
+        ASSERT(codeBlock);
+        ArityCheckMode arity;
+        if (execCallee-&gt;argumentCountIncludingThis() &lt; static_cast&lt;size_t&gt;(codeBlock-&gt;numParameters()))
+            arity = MustCheckArity;
+        else
+            arity = ArityCheckNotRequired;
+        codePtr = webAssemblyExecutable-&gt;entrypointFor(*vm, kind, arity, callLinkInfo-&gt;registerPreservationMode());
+#endif
+    } else {
</ins><span class="cx">         FunctionExecutable* functionExecutable = static_cast&lt;FunctionExecutable*&gt;(executable);
</span><span class="cx"> 
</span><span class="cx">         if (!isCall(kind) &amp;&amp; functionExecutable-&gt;constructAbility() == ConstructAbility::CannotConstruct) {
</span><span class="lines">@@ -896,17 +909,33 @@
</span><span class="cx">     JSScope* scope = function-&gt;scopeUnchecked();
</span><span class="cx">     ExecutableBase* executable = function-&gt;executable();
</span><span class="cx">     if (UNLIKELY(!executable-&gt;hasJITCodeFor(kind))) {
</span><del>-        FunctionExecutable* functionExecutable = static_cast&lt;FunctionExecutable*&gt;(executable);
</del><ins>+        bool isWebAssemblyExecutable = false;
+#if ENABLE(WEBASSEMBLY)
+        isWebAssemblyExecutable = executable-&gt;isWebAssemblyExecutable();
+#endif
+        if (!isWebAssemblyExecutable) {
+            FunctionExecutable* functionExecutable = static_cast&lt;FunctionExecutable*&gt;(executable);
</ins><span class="cx"> 
</span><del>-        if (!isCall(kind) &amp;&amp; functionExecutable-&gt;constructAbility() == ConstructAbility::CannotConstruct) {
-            exec-&gt;vm().throwException(exec, createNotAConstructorError(exec, function));
-            return reinterpret_cast&lt;char*&gt;(vm-&gt;getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress());
-        }
</del><ins>+            if (!isCall(kind) &amp;&amp; functionExecutable-&gt;constructAbility() == ConstructAbility::CannotConstruct) {
+                exec-&gt;vm().throwException(exec, createNotAConstructorError(exec, function));
+                return reinterpret_cast&lt;char*&gt;(vm-&gt;getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress());
+            }
</ins><span class="cx"> 
</span><del>-        JSObject* error = functionExecutable-&gt;prepareForExecution(execCallee, function, scope, kind);
-        if (error) {
-            exec-&gt;vm().throwException(exec, error);
-            return reinterpret_cast&lt;char*&gt;(vm-&gt;getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress());
</del><ins>+            JSObject* error = functionExecutable-&gt;prepareForExecution(execCallee, function, scope, kind);
+            if (error) {
+                exec-&gt;vm().throwException(exec, error);
+                return reinterpret_cast&lt;char*&gt;(vm-&gt;getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress());
+            }
+        } else {
+#if ENABLE(WEBASSEMBLY)
+            if (!isCall(kind)) {
+                exec-&gt;vm().throwException(exec, createNotAConstructorError(exec, function));
+                return reinterpret_cast&lt;char*&gt;(vm-&gt;getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress());
+            }
+
+            WebAssemblyExecutable* webAssemblyExecutable = static_cast&lt;WebAssemblyExecutable*&gt;(executable);
+            webAssemblyExecutable-&gt;prepareForExecution(execCallee);
+#endif
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     return reinterpret_cast&lt;char*&gt;(executable-&gt;entrypointFor(
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitRepatchcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/Repatch.cpp (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/Repatch.cpp        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/jit/Repatch.cpp        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -1742,8 +1742,13 @@
</span><span class="cx">         if (variant.executable()-&gt;isHostFunction())
</span><span class="cx">             codeBlock = nullptr;
</span><span class="cx">         else {
</span><del>-            codeBlock = jsCast&lt;FunctionExecutable*&gt;(variant.executable())-&gt;codeBlockForCall();
-            
</del><ins>+            ExecutableBase* executable = variant.executable();
+#if ENABLE(WEBASSEMBLY)
+            if (executable-&gt;isWebAssemblyExecutable())
+                codeBlock = jsCast&lt;WebAssemblyExecutable*&gt;(executable)-&gt;codeBlockForCall();
+            else
+#endif
+                codeBlock = jsCast&lt;FunctionExecutable*&gt;(executable)-&gt;codeBlockForCall();
</ins><span class="cx">             // If we cannot handle a callee, assume that it's better for this whole thing to be a
</span><span class="cx">             // virtual call.
</span><span class="cx">             if (exec-&gt;argumentCountIncludingThis() &lt; static_cast&lt;size_t&gt;(codeBlock-&gt;numParameters()) || callLinkInfo.callType() == CallLinkInfo::CallVarargs || callLinkInfo.callType() == CallLinkInfo::ConstructVarargs) {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorellintLLIntDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/llint/LLIntData.cpp (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/llint/LLIntData.cpp        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/llint/LLIntData.cpp        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -132,8 +132,8 @@
</span><span class="cx">     ASSERT(maxFrameExtentForSlowPathCall == 64);
</span><span class="cx"> #endif
</span><span class="cx">     ASSERT(StringType == 6);
</span><del>-    ASSERT(ObjectType == 18);
-    ASSERT(FinalObjectType == 19);
</del><ins>+    ASSERT(ObjectType == 19);
+    ASSERT(FinalObjectType == 20);
</ins><span class="cx">     ASSERT(MasqueradesAsUndefined == 1);
</span><span class="cx">     ASSERT(ImplementsHasInstance == 2);
</span><span class="cx">     ASSERT(ImplementsDefaultHasInstance == 8);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorellintLLIntSlowPathscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -1116,9 +1116,14 @@
</span><span class="cx"> 
</span><span class="cx">     MacroAssemblerCodePtr codePtr;
</span><span class="cx">     CodeBlock* codeBlock = 0;
</span><del>-    if (executable-&gt;isHostFunction())
</del><ins>+    bool isWebAssemblyExecutable = false;
+#if ENABLE(WEBASSEMBLY)
+    isWebAssemblyExecutable = executable-&gt;isWebAssemblyExecutable();
+#endif
+
+    if (executable-&gt;isHostFunction()) {
</ins><span class="cx">         codePtr = executable-&gt;entrypointFor(vm, kind, MustCheckArity, RegisterPreservationNotRequired);
</span><del>-    else {
</del><ins>+    } else if (!isWebAssemblyExecutable) {
</ins><span class="cx">         FunctionExecutable* functionExecutable = static_cast&lt;FunctionExecutable*&gt;(executable);
</span><span class="cx"> 
</span><span class="cx">         if (!isCall(kind) &amp;&amp; functionExecutable-&gt;constructAbility() == ConstructAbility::CannotConstruct)
</span><span class="lines">@@ -1135,6 +1140,19 @@
</span><span class="cx">         else
</span><span class="cx">             arity = ArityCheckNotRequired;
</span><span class="cx">         codePtr = functionExecutable-&gt;entrypointFor(vm, kind, arity, RegisterPreservationNotRequired);
</span><ins>+    } else {
+#if ENABLE(WEBASSEMBLY)
+        WebAssemblyExecutable* webAssemblyExecutable = static_cast&lt;WebAssemblyExecutable*&gt;(executable);
+        webAssemblyExecutable-&gt;prepareForExecution(execCallee);
+        codeBlock = webAssemblyExecutable-&gt;codeBlockForCall();
+        ASSERT(codeBlock);
+        ArityCheckMode arity;
+        if (execCallee-&gt;argumentCountIncludingThis() &lt; static_cast&lt;size_t&gt;(codeBlock-&gt;numParameters()))
+            arity = MustCheckArity;
+        else
+            arity = ArityCheckNotRequired;
+        codePtr = webAssemblyExecutable-&gt;entrypointFor(vm, kind, arity, RegisterPreservationNotRequired);
+#endif
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     ASSERT(!!codePtr);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorellintLowLevelInterpreterasm"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -161,8 +161,8 @@
</span><span class="cx"> 
</span><span class="cx"> # Type constants.
</span><span class="cx"> const StringType = 6
</span><del>-const ObjectType = 18
-const FinalObjectType = 19
</del><ins>+const ObjectType = 19
+const FinalObjectType = 20
</ins><span class="cx"> 
</span><span class="cx"> # Type flags constants.
</span><span class="cx"> const MasqueradesAsUndefined = 1
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeCommonSlowPathscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -525,7 +525,7 @@
</span><span class="cx"> SLOW_PATH_DECL(slow_path_enter)
</span><span class="cx"> {
</span><span class="cx">     BEGIN();
</span><del>-    ScriptExecutable* ownerExecutable = exec-&gt;codeBlock()-&gt;ownerExecutable();
</del><ins>+    ExecutableBase* ownerExecutable = exec-&gt;codeBlock()-&gt;ownerExecutable();
</ins><span class="cx">     Heap::heap(ownerExecutable)-&gt;writeBarrier(ownerExecutable);
</span><span class="cx">     END();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeExecutablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Executable.cpp (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Executable.cpp        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/runtime/Executable.cpp        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -31,10 +31,12 @@
</span><span class="cx"> #include &quot;DFGDriver.h&quot;
</span><span class="cx"> #include &quot;JIT.h&quot;
</span><span class="cx"> #include &quot;JSCInlines.h&quot;
</span><ins>+#include &quot;JSWASMModule.h&quot;
</ins><span class="cx"> #include &quot;LLIntEntrypoint.h&quot;
</span><span class="cx"> #include &quot;Parser.h&quot;
</span><span class="cx"> #include &quot;ProfilerDatabase.h&quot;
</span><span class="cx"> #include &quot;TypeProfiler.h&quot;
</span><ins>+#include &quot;WASMFunctionParser.h&quot;
</ins><span class="cx"> #include &lt;wtf/CommaPrinter.h&gt;
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="cx"> #include &lt;wtf/text/StringBuilder.h&gt;
</span><span class="lines">@@ -562,6 +564,62 @@
</span><span class="cx">     return unlinkedExecutable-&gt;link(exec.vm(), source, overrideLineNumber);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(WEBASSEMBLY)
+const ClassInfo WebAssemblyExecutable::s_info = { &quot;WebAssemblyExecutable&quot;, &amp;ExecutableBase::s_info, 0, CREATE_METHOD_TABLE(WebAssemblyExecutable) };
+
+WebAssemblyExecutable::WebAssemblyExecutable(VM&amp; vm, const SourceCode&amp; source, JSWASMModule* module, unsigned functionIndex)
+    : ExecutableBase(vm, vm.webAssemblyExecutableStructure.get(), NUM_PARAMETERS_NOT_COMPILED)
+    , m_source(source)
+    , m_module(vm, this, module)
+    , m_functionIndex(functionIndex)
+{
+}
+
+void WebAssemblyExecutable::destroy(JSCell* cell)
+{
+    static_cast&lt;WebAssemblyExecutable*&gt;(cell)-&gt;WebAssemblyExecutable::~WebAssemblyExecutable();
+}
+
+void WebAssemblyExecutable::visitChildren(JSCell* cell, SlotVisitor&amp; visitor)
+{
+    WebAssemblyExecutable* thisObject = jsCast&lt;WebAssemblyExecutable*&gt;(cell);
+    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
+    ExecutableBase::visitChildren(thisObject, visitor);
+    if (thisObject-&gt;m_codeBlockForCall)
+        thisObject-&gt;m_codeBlockForCall-&gt;visitAggregate(visitor);
+    visitor.append(&amp;thisObject-&gt;m_module);
+}
+
+void WebAssemblyExecutable::clearCode()
+{
+    m_codeBlockForCall = nullptr;
+    Base::clearCode();
+}
+
+void WebAssemblyExecutable::prepareForExecution(ExecState* exec)
+{
+    if (hasJITCodeForCall())
+        return;
+
+    VM&amp; vm = exec-&gt;vm();
+    DeferGC deferGC(vm.heap);
+
+    RefPtr&lt;WebAssemblyCodeBlock&gt; codeBlock = adoptRef(new WebAssemblyCodeBlock(
+        this, vm, exec-&gt;lexicalGlobalObject()));
+
+    WASMFunctionParser::compile(vm, codeBlock.get(), m_module.get(), m_source, m_functionIndex);
+
+    m_jitCodeForCall = codeBlock-&gt;jitCode();
+    m_jitCodeForCallWithArityCheck = MacroAssemblerCodePtr();
+    m_jitCodeForCallWithArityCheckAndPreserveRegs = MacroAssemblerCodePtr();
+    m_numParametersForCall = codeBlock-&gt;numParameters();
+
+    m_codeBlockForCall = codeBlock;
+
+    Heap::heap(this)-&gt;writeBarrier(this);
+}
+#endif
+
</ins><span class="cx"> void ExecutableBase::dump(PrintStream&amp; out) const
</span><span class="cx"> {
</span><span class="cx">     ExecutableBase* realThis = const_cast&lt;ExecutableBase*&gt;(this);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeExecutableh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Executable.h (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Executable.h        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/runtime/Executable.h        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -50,9 +50,11 @@
</span><span class="cx"> class Debugger;
</span><span class="cx"> class EvalCodeBlock;
</span><span class="cx"> class FunctionCodeBlock;
</span><ins>+class JSScope;
+class JSWASMModule;
</ins><span class="cx"> class LLIntOffsetsExtractor;
</span><span class="cx"> class ProgramCodeBlock;
</span><del>-class JSScope;
</del><ins>+class WebAssemblyCodeBlock;
</ins><span class="cx">     
</span><span class="cx"> enum CompilationKind { FirstCompilation, OptimizingCompilation };
</span><span class="cx"> 
</span><span class="lines">@@ -92,15 +94,15 @@
</span><span class="cx">         
</span><span class="cx">     CodeBlockHash hashFor(CodeSpecializationKind) const;
</span><span class="cx"> 
</span><del>-    bool isEvalExecutable()
</del><ins>+    bool isEvalExecutable() const
</ins><span class="cx">     {
</span><span class="cx">         return type() == EvalExecutableType;
</span><span class="cx">     }
</span><del>-    bool isFunctionExecutable()
</del><ins>+    bool isFunctionExecutable() const
</ins><span class="cx">     {
</span><span class="cx">         return type() == FunctionExecutableType;
</span><span class="cx">     }
</span><del>-    bool isProgramExecutable()
</del><ins>+    bool isProgramExecutable() const
</ins><span class="cx">     {
</span><span class="cx">         return type() == ProgramExecutableType;
</span><span class="cx">     }
</span><span class="lines">@@ -111,6 +113,13 @@
</span><span class="cx">         return m_numParametersForCall == NUM_PARAMETERS_IS_HOST;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+#if ENABLE(WEBASSEMBLY)
+    bool isWebAssemblyExecutable() const
+    {
+        return type() == WebAssemblyExecutableType;
+    }
+#endif
+
</ins><span class="cx">     static Structure* createStructure(VM&amp; vm, JSGlobalObject* globalObject, JSValue proto) { return Structure::create(vm, globalObject, proto, TypeInfo(CellType, StructureFlags), info()); }
</span><span class="cx">         
</span><span class="cx">     void clearCode();
</span><span class="lines">@@ -386,7 +395,7 @@
</span><span class="cx"> 
</span><span class="cx">     CodeFeatures features() const { return m_features; }
</span><span class="cx">         
</span><del>-    DECLARE_INFO;
</del><ins>+    DECLARE_EXPORT_INFO;
</ins><span class="cx"> 
</span><span class="cx">     void recordParse(CodeFeatures features, bool hasCapturedVariables, int firstLine, int lastLine, unsigned startColumn, unsigned endColumn)
</span><span class="cx">     {
</span><span class="lines">@@ -562,7 +571,7 @@
</span><span class="cx"> 
</span><span class="cx">     static void destroy(JSCell*);
</span><span class="cx">         
</span><del>-    UnlinkedFunctionExecutable* unlinkedExecutable()
</del><ins>+    UnlinkedFunctionExecutable* unlinkedExecutable() const
</ins><span class="cx">     {
</span><span class="cx">         return m_unlinkedExecutable.get();
</span><span class="cx">     }
</span><span class="lines">@@ -676,6 +685,50 @@
</span><span class="cx">     WriteBarrier&lt;InferredValue&gt; m_singletonFunction;
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+#if ENABLE(WEBASSEMBLY)
+class WebAssemblyExecutable final : public ExecutableBase {
+public:
+    typedef ExecutableBase Base;
+    static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal;
+
+    static WebAssemblyExecutable* create(VM&amp; vm, const SourceCode&amp; source, JSWASMModule* module, unsigned functionIndex)
+    {
+        WebAssemblyExecutable* executable = new (NotNull, allocateCell&lt;WebAssemblyExecutable&gt;(vm.heap)) WebAssemblyExecutable(vm, source, module, functionIndex);
+        executable-&gt;finishCreation(vm);
+        return executable;
+    }
+
+    static Structure* createStructure(VM&amp; vm, JSGlobalObject* globalObject, JSValue proto)
+    {
+        return Structure::create(vm, globalObject, proto, TypeInfo(WebAssemblyExecutableType, StructureFlags), info());
+    }
+
+    static void destroy(JSCell*);
+
+    DECLARE_INFO;
+
+    void clearCode();
+
+    void prepareForExecution(ExecState*);
+
+    WebAssemblyCodeBlock* codeBlockForCall()
+    {
+        return m_codeBlockForCall.get();
+    }
+
+private:
+    WebAssemblyExecutable(VM&amp;, const SourceCode&amp;, JSWASMModule*, unsigned functionIndex);
+
+    static void visitChildren(JSCell*, SlotVisitor&amp;);
+
+    SourceCode m_source;
+    WriteBarrier&lt;JSWASMModule&gt; m_module;
+    unsigned m_functionIndex;
+
+    RefPtr&lt;WebAssemblyCodeBlock&gt; m_codeBlockForCall;
+};
+#endif
+
</ins><span class="cx"> inline void ExecutableBase::clearCodeVirtual(ExecutableBase* executable)
</span><span class="cx"> {
</span><span class="cx">     switch (executable-&gt;type()) {
</span><span class="lines">@@ -685,6 +738,10 @@
</span><span class="cx">         return jsCast&lt;ProgramExecutable*&gt;(executable)-&gt;clearCode();
</span><span class="cx">     case FunctionExecutableType:
</span><span class="cx">         return jsCast&lt;FunctionExecutable*&gt;(executable)-&gt;clearCode();
</span><ins>+#if ENABLE(WEBASSEMBLY)
+    case WebAssemblyExecutableType:
+        return jsCast&lt;WebAssemblyExecutable*&gt;(executable)-&gt;clearCode();
+#endif
</ins><span class="cx">     default:
</span><span class="cx">         return jsCast&lt;NativeExecutable*&gt;(executable)-&gt;clearCode();
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSFunctioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSFunction.cpp (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSFunction.cpp        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/runtime/JSFunction.cpp        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -67,6 +67,16 @@
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(WEBASSEMBLY)
+JSFunction* JSFunction::create(VM&amp; vm, WebAssemblyExecutable* executable, JSScope* scope)
+{
+    JSFunction* function = new (NotNull, allocateCell&lt;JSFunction&gt;(vm.heap)) JSFunction(vm, executable, scope);
+    ASSERT(function-&gt;structure()-&gt;globalObject());
+    function-&gt;finishCreation(vm);
+    return function;
+}
+#endif
+
</ins><span class="cx"> static inline NativeExecutable* getNativeExecutable(VM&amp; vm, NativeFunction nativeFunction, Intrinsic intrinsic, NativeFunction nativeConstructor)
</span><span class="cx"> {
</span><span class="cx"> #if !ENABLE(JIT)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSFunctionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSFunction.h (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSFunction.h        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/runtime/JSFunction.h        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -40,6 +40,7 @@
</span><span class="cx"> class LLIntOffsetsExtractor;
</span><span class="cx"> class NativeExecutable;
</span><span class="cx"> class SourceCode;
</span><ins>+class WebAssemblyExecutable;
</ins><span class="cx"> namespace DFG {
</span><span class="cx"> class SpeculativeJIT;
</span><span class="cx"> class JITCompiler;
</span><span class="lines">@@ -73,6 +74,9 @@
</span><span class="cx">     JS_EXPORT_PRIVATE static JSFunction* create(VM&amp;, JSGlobalObject*, int length, const String&amp; name, NativeStdFunction&amp;&amp;, Intrinsic = NoIntrinsic, NativeFunction nativeConstructor = callHostFunctionAsConstructor);
</span><span class="cx"> 
</span><span class="cx">     static JSFunction* create(VM&amp;, FunctionExecutable*, JSScope*);
</span><ins>+#if ENABLE(WEBASSEMBLY)
+    static JSFunction* create(VM&amp;, WebAssemblyExecutable*, JSScope*);
+#endif
</ins><span class="cx"> 
</span><span class="cx">     static JSFunction* createBuiltinFunction(VM&amp;, FunctionExecutable*, JSGlobalObject*);
</span><span class="cx">     static JSFunction* createBuiltinFunction(VM&amp;, FunctionExecutable*, JSGlobalObject*, const String&amp; name);
</span><span class="lines">@@ -143,6 +147,10 @@
</span><span class="cx">     JSFunction(VM&amp;, FunctionExecutable*, JSScope*);
</span><span class="cx">     JSFunction(VM&amp;, FunctionExecutable*, JSScope*, Structure*);
</span><span class="cx"> 
</span><ins>+#if ENABLE(WEBASSEMBLY)
+    JSFunction(VM&amp;, WebAssemblyExecutable*, JSScope*);
+#endif
+
</ins><span class="cx">     void finishCreation(VM&amp;, NativeExecutable*, int length, const String&amp; name);
</span><span class="cx">     using Base::finishCreation;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSFunctionInlinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSFunctionInlines.h (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSFunctionInlines.h        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/runtime/JSFunctionInlines.h        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -52,6 +52,15 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(WEBASSEMBLY)
+inline JSFunction::JSFunction(VM&amp; vm, WebAssemblyExecutable* executable, JSScope* scope)
+    : Base(vm, scope, scope-&gt;globalObject()-&gt;functionStructure())
+    , m_executable(vm, this, executable)
+    , m_rareData()
+{
+}
+#endif
+
</ins><span class="cx"> inline FunctionExecutable* JSFunction::jsExecutable() const
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!isHostFunctionNonInline());
</span><span class="lines">@@ -66,6 +75,10 @@
</span><span class="cx"> 
</span><span class="cx"> inline bool JSFunction::isBuiltinFunction() const
</span><span class="cx"> {
</span><ins>+#if ENABLE(WEBASSEMBLY)
+    if (m_executable-&gt;isWebAssemblyExecutable())
+        return false;
+#endif
</ins><span class="cx">     return !isHostFunction() &amp;&amp; jsExecutable()-&gt;isBuiltinFunction();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSTypeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSType.h (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSType.h        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/runtime/JSType.h        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx">     EvalExecutableType,
</span><span class="cx">     ProgramExecutableType,
</span><span class="cx">     FunctionExecutableType,
</span><ins>+    WebAssemblyExecutableType,
</ins><span class="cx"> 
</span><span class="cx">     UnlinkedFunctionExecutableType,
</span><span class="cx">     UnlinkedProgramCodeBlockType,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeVMcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/VM.cpp (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/VM.cpp        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/runtime/VM.cpp        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -221,6 +221,9 @@
</span><span class="cx">     evalExecutableStructure.set(*this, EvalExecutable::createStructure(*this, 0, jsNull()));
</span><span class="cx">     programExecutableStructure.set(*this, ProgramExecutable::createStructure(*this, 0, jsNull()));
</span><span class="cx">     functionExecutableStructure.set(*this, FunctionExecutable::createStructure(*this, 0, jsNull()));
</span><ins>+#if ENABLE(WEBASSEMBLY)
+    webAssemblyExecutableStructure.set(*this, WebAssemblyExecutable::createStructure(*this, 0, jsNull()));
+#endif
</ins><span class="cx">     regExpStructure.set(*this, RegExp::createStructure(*this, 0, jsNull()));
</span><span class="cx">     symbolStructure.set(*this, Symbol::createStructure(*this, 0, jsNull()));
</span><span class="cx">     symbolTableStructure.set(*this, SymbolTable::createStructure(*this, 0, jsNull()));
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeVMh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/VM.h (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/VM.h        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/runtime/VM.h        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -279,6 +279,9 @@
</span><span class="cx">     Strong&lt;Structure&gt; evalExecutableStructure;
</span><span class="cx">     Strong&lt;Structure&gt; programExecutableStructure;
</span><span class="cx">     Strong&lt;Structure&gt; functionExecutableStructure;
</span><ins>+#if ENABLE(WEBASSEMBLY)
+    Strong&lt;Structure&gt; webAssemblyExecutableStructure;
+#endif
</ins><span class="cx">     Strong&lt;Structure&gt; regExpStructure;
</span><span class="cx">     Strong&lt;Structure&gt; symbolStructure;
</span><span class="cx">     Strong&lt;Structure&gt; symbolTableStructure;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmJSWASMModuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/JSWASMModule.h (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/JSWASMModule.h        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/wasm/JSWASMModule.h        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -64,6 +64,8 @@
</span><span class="cx">     Vector&lt;WASMFunctionDeclaration&gt;&amp; functionDeclarations() { return m_functionDeclarations; }
</span><span class="cx">     Vector&lt;WASMFunctionPointerTable&gt;&amp; functionPointerTables() { return m_functionPointerTables; }
</span><span class="cx"> 
</span><ins>+    Vector&lt;WriteBarrier&lt;JSFunction&gt;&gt;&amp; functions() { return m_functions; }
+
</ins><span class="cx"> private:
</span><span class="cx">     JSWASMModule(VM&amp; vm, Structure* structure)
</span><span class="cx">         : Base(vm, structure)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWASMFunctionParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.cpp (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.cpp        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.cpp        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -28,7 +28,9 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(WEBASSEMBLY)
</span><span class="cx"> 
</span><ins>+#include &quot;CCallHelpers.h&quot;
</ins><span class="cx"> #include &quot;JSWASMModule.h&quot;
</span><ins>+#include &quot;LinkBuffer.h&quot;
</ins><span class="cx"> #include &quot;WASMFunctionSyntaxChecker.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #define PROPAGATE_ERROR() do { if (!m_errorMessage.isNull()) return 0; } while (0)
</span><span class="lines">@@ -59,6 +61,27 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WASMFunctionParser::compile(VM&amp; vm, CodeBlock* codeBlock, JSWASMModule* module, const SourceCode&amp;, size_t functionIndex)
+{
+    // FIXME: Actually compile the code.
+    CCallHelpers jit(&amp;vm, codeBlock);
+    MacroAssembler::Label beginLabel = jit.label();
+    jit.move(MacroAssembler::TrustedImm64(JSValue::encode(jsNumber(0))), GPRInfo::returnValueGPR);
+    jit.ret();
+    MacroAssembler::Label arityCheck = jit.label();
+    jit.jump(beginLabel);
+
+    LinkBuffer patchBuffer(vm, jit, codeBlock, JITCompilationMustSucceed);
+    MacroAssemblerCodePtr withArityCheck = patchBuffer.locationOf(arityCheck);
+    MacroAssembler::CodeRef result = FINALIZE_CODE(patchBuffer, (&quot;Baseline JIT code for WebAssembly&quot;));
+    codeBlock-&gt;setJITCode(adoptRef(new DirectJITCode(result, withArityCheck, JITCode::BaselineJIT)));
+    codeBlock-&gt;capabilityLevel();
+
+    uint32_t signatureIndex = module-&gt;functionDeclarations()[functionIndex].signatureIndex;
+    const WASMSignature&amp; signature = module-&gt;signatures()[signatureIndex];
+    codeBlock-&gt;setNumParameters(1 + signature.arguments.size());
+}
+
</ins><span class="cx"> template &lt;class Context&gt;
</span><span class="cx"> bool WASMFunctionParser::parseFunction(Context&amp; context)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWASMFunctionParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.h (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.h        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.h        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -36,11 +36,14 @@
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><ins>+class CodeBlock;
</ins><span class="cx"> class JSWASMModule;
</span><ins>+class VM;
</ins><span class="cx"> 
</span><span class="cx"> class WASMFunctionParser {
</span><span class="cx"> public:
</span><span class="cx">     static bool checkSyntax(JSWASMModule*, const SourceCode&amp;, size_t functionIndex, unsigned startOffsetInSource, unsigned&amp; endOffsetInSource, String&amp; errorMessage);
</span><ins>+    static void compile(VM&amp;, CodeBlock*, JSWASMModule*, const SourceCode&amp;, size_t functionIndex);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     WASMFunctionParser(JSWASMModule* module, const SourceCode&amp; source, size_t functionIndex)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWASMModuleParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WASMModuleParser.cpp (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WASMModuleParser.cpp        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/wasm/WASMModuleParser.cpp        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -49,15 +49,17 @@
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><del>-WASMModuleParser::WASMModuleParser(const SourceCode&amp; source)
-    : m_source(source)
</del><ins>+WASMModuleParser::WASMModuleParser(VM&amp; vm, JSGlobalObject* globalObject, const SourceCode&amp; source)
+    : m_vm(vm)
+    , m_globalObject(vm, globalObject)
+    , m_source(source)
</ins><span class="cx">     , m_reader(static_cast&lt;WebAssemblySourceProvider*&gt;(source.provider())-&gt;data())
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-JSWASMModule* WASMModuleParser::parse(VM&amp; vm, JSGlobalObject* globalObject, String&amp; errorMessage)
</del><ins>+JSWASMModule* WASMModuleParser::parse(String&amp; errorMessage)
</ins><span class="cx"> {
</span><del>-    m_module.set(vm, JSWASMModule::create(vm, globalObject-&gt;wasmModuleStructure()));
</del><ins>+    m_module.set(m_vm, JSWASMModule::create(m_vm, m_globalObject-&gt;wasmModuleStructure()));
</ins><span class="cx">     parseModule();
</span><span class="cx">     if (!m_errorMessage.isNull()) {
</span><span class="cx">         errorMessage = m_errorMessage;
</span><span class="lines">@@ -217,6 +219,7 @@
</span><span class="cx">     uint32_t numberOfFunctionDeclarations;
</span><span class="cx">     READ_COMPACT_UINT32_OR_FAIL(numberOfFunctionDeclarations, &quot;Cannot read the number of function declarations.&quot;);
</span><span class="cx">     m_module-&gt;functionDeclarations().reserveInitialCapacity(numberOfFunctionDeclarations);
</span><ins>+    m_module-&gt;functions().reserveInitialCapacity(numberOfFunctionDeclarations);
</ins><span class="cx">     for (uint32_t i = 0; i &lt; numberOfFunctionDeclarations; ++i) {
</span><span class="cx">         WASMFunctionDeclaration functionDeclaration;
</span><span class="cx">         READ_COMPACT_UINT32_OR_FAIL(functionDeclaration.signatureIndex, &quot;Cannot read the signature index.&quot;);
</span><span class="lines">@@ -265,6 +268,10 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     m_reader.setOffset(endOffsetInSource);
</span><ins>+
+    WebAssemblyExecutable* webAssemblyExecutable = WebAssemblyExecutable::create(m_vm, m_source, m_module.get(), functionIndex);
+    JSFunction* function = JSFunction::create(m_vm, webAssemblyExecutable, m_globalObject.get());
+    m_module-&gt;functions().uncheckedAppend(WriteBarrier&lt;JSFunction&gt;(m_vm, m_module.get(), function));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WASMModuleParser::parseExportSection()
</span><span class="lines">@@ -285,11 +292,11 @@
</span><span class="cx">         for (uint32_t exportIndex = 0; exportIndex &lt; numberOfExports; ++exportIndex) {
</span><span class="cx">             String exportName;
</span><span class="cx">             READ_STRING_OR_FAIL(exportName, &quot;Cannot read the function export name.&quot;);
</span><del>-            // FIXME: Check that exportName is legal.
</del><span class="cx">             uint32_t functionIndex;
</span><span class="cx">             READ_COMPACT_UINT32_OR_FAIL(functionIndex, &quot;Cannot read the function index.&quot;);
</span><span class="cx">             FAIL_IF_FALSE(functionIndex &lt; m_module-&gt;functionDeclarations().size(), &quot;The function index is incorrect.&quot;);
</span><del>-            // FIXME: Export the function.
</del><ins>+            Identifier identifier = Identifier::fromString(&amp;m_vm, exportName);
+            m_module-&gt;putDirect(m_vm, identifier, m_module-&gt;functions()[functionIndex].get());
</ins><span class="cx">         }
</span><span class="cx">         break;
</span><span class="cx">     }
</span><span class="lines">@@ -300,8 +307,8 @@
</span><span class="cx"> 
</span><span class="cx"> JSWASMModule* parseWebAssembly(ExecState* exec, const SourceCode&amp; source, String&amp; errorMessage)
</span><span class="cx"> {
</span><del>-    WASMModuleParser WASMModuleParser(source);
-    return WASMModuleParser.parse(exec-&gt;vm(), exec-&gt;lexicalGlobalObject(), errorMessage);
</del><ins>+    WASMModuleParser moduleParser(exec-&gt;vm(), exec-&gt;lexicalGlobalObject(), source);
+    return moduleParser.parse(errorMessage);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWASMModuleParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WASMModuleParser.h (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WASMModuleParser.h        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/JavaScriptCore/wasm/WASMModuleParser.h        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -42,8 +42,8 @@
</span><span class="cx"> 
</span><span class="cx"> class WASMModuleParser {
</span><span class="cx"> public:
</span><del>-    WASMModuleParser(const SourceCode&amp;);
-    JSWASMModule* parse(VM&amp;, JSGlobalObject*, String&amp; errorMessage);
</del><ins>+    WASMModuleParser(VM&amp;, JSGlobalObject*, const SourceCode&amp;);
+    JSWASMModule* parse(String&amp; errorMessage);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     void parseModule();
</span><span class="lines">@@ -57,6 +57,8 @@
</span><span class="cx">     void parseFunctionDefinition(size_t functionIndex);
</span><span class="cx">     void parseExportSection();
</span><span class="cx"> 
</span><ins>+    VM&amp; m_vm;
+    Strong&lt;JSGlobalObject&gt; m_globalObject;
</ins><span class="cx">     const SourceCode&amp; m_source;
</span><span class="cx">     WASMReader m_reader;
</span><span class="cx">     Strong&lt;JSWASMModule&gt; m_module;
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/WebCore/ChangeLog        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-08-28  Sukolsak Sakshuwong  &lt;sukolsak@gmail.com&gt;
+
+        Create WebAssembly functions
+        https://bugs.webkit.org/show_bug.cgi?id=148373
+
+        Reviewed by Filip Pizlo.
+
+        No new tests, because it is a function rename.
+
+        * testing/Internals.cpp:
+        (WebCore::Internals::parserMetaData):
+
</ins><span class="cx"> 2015-08-28  Jer Noble  &lt;jer.noble@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] Make the AllowsInlineMediaPlayback preference work in WebKit / WebKit2.
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.cpp (189122 => 189123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.cpp        2015-08-28 20:35:28 UTC (rev 189122)
+++ trunk/Source/WebCore/testing/Internals.cpp        2015-08-28 21:07:22 UTC (rev 189123)
</span><span class="lines">@@ -1463,7 +1463,7 @@
</span><span class="cx">         GetCallerCodeBlockFunctor iter;
</span><span class="cx">         exec-&gt;iterate(iter);
</span><span class="cx">         CodeBlock* codeBlock = iter.codeBlock();
</span><del>-        executable = codeBlock-&gt;ownerExecutable(); 
</del><ins>+        executable = codeBlock-&gt;ownerScriptExecutable();
</ins><span class="cx">     } else if (code.isFunction()) {
</span><span class="cx">         JSFunction* funcObj = JSC::jsCast&lt;JSFunction*&gt;(code.toObject(exec));
</span><span class="cx">         executable = funcObj-&gt;jsExecutable();
</span><span class="lines">@@ -1485,10 +1485,14 @@
</span><span class="cx">         result.append('&quot;');
</span><span class="cx">     } else if (executable-&gt;isEvalExecutable())
</span><span class="cx">         result.appendLiteral(&quot;eval&quot;);
</span><del>-    else {
-        ASSERT(executable-&gt;isProgramExecutable());
</del><ins>+    else if (executable-&gt;isProgramExecutable())
</ins><span class="cx">         result.appendLiteral(&quot;program&quot;);
</span><del>-    }
</del><ins>+#if ENABLE(WEBASSEMBLY)
+    else if (executable-&gt;isWebAssemblyExecutable())
+        result.appendLiteral(&quot;WebAssembly&quot;);
+#endif
+    else
+        ASSERT_NOT_REACHED();
</ins><span class="cx"> 
</span><span class="cx">     result.appendLiteral(&quot; { &quot;);
</span><span class="cx">     result.appendNumber(startLine);
</span></span></pre>
</div>
</div>

</body>
</html>