<!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 <sukolsak@gmail.com> on 2015-08-28
Reviewed by Filip Pizlo.
Source/JavaScriptCore:
Create functions from WebAssembly files generated by pack-asmjs
<https://github.com/WebAssembly/polyfill-prototype-1>.
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<ScriptExecutable*>.
Since ownerScriptExecutable() is called from WebCore and it uses
jsCast<ScriptExecutable*>, 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 <sukolsak@gmail.com>
+
+ 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
+ <https://github.com/WebAssembly/polyfill-prototype-1>.
+ 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<ScriptExecutable*>.
+
+ Since ownerScriptExecutable() is called from WebCore and it uses
+ jsCast<ScriptExecutable*>, 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 <mark.lam@apple.com>
</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()->source(), specializationKind());
</del><ins>+ m_hash = CodeBlockHash(ownerScriptExecutable()->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()->source().toUTF8();
</del><ins>+ return ownerScriptExecutable()->source().toUTF8();
</ins><span class="cx">
</span><span class="cx"> SourceProvider* provider = source();
</span><span class="cx"> FunctionExecutable* executable = jsCast<FunctionExecutable*>(ownerExecutable());
</span><span class="lines">@@ -155,13 +155,13 @@
</span><span class="cx"> out.print(", ", instructionCount());
</span><span class="cx"> if (this->jitType() == JITCode::BaselineJIT && m_shouldAlwaysBeInlined)
</span><span class="cx"> out.print(" (ShouldAlwaysBeInlined)");
</span><del>- if (ownerExecutable()->neverInline())
</del><ins>+ if (ownerScriptExecutable()->neverInline())
</ins><span class="cx"> out.print(" (NeverInline)");
</span><del>- if (ownerExecutable()->neverOptimize())
</del><ins>+ if (ownerScriptExecutable()->neverOptimize())
</ins><span class="cx"> out.print(" (NeverOptimize)");
</span><del>- if (ownerExecutable()->didTryToEnterInLoop())
</del><ins>+ if (ownerScriptExecutable()->didTryToEnterInLoop())
</ins><span class="cx"> out.print(" (DidTryToEnterInLoop)");
</span><del>- if (ownerExecutable()->isStrictMode())
</del><ins>+ if (ownerScriptExecutable()->isStrictMode())
</ins><span class="cx"> out.print(" (StrictMode)");
</span><span class="cx"> if (this->jitType() == JITCode::BaselineJIT && m_didFailFTLCompilation)
</span><span class="cx"> out.print(" (FTLFail)");
</span><span class="lines">@@ -554,7 +554,7 @@
</span><span class="cx">
</span><span class="cx"> void CodeBlock::dumpSource(PrintStream& out)
</span><span class="cx"> {
</span><del>- ScriptExecutable* executable = ownerExecutable();
</del><ins>+ ScriptExecutable* executable = ownerScriptExecutable();
</ins><span class="cx"> if (executable->isFunctionExecutable()) {
</span><span class="cx"> FunctionExecutable* functionExecutable = reinterpret_cast<FunctionExecutable*>(executable);
</span><span class="cx"> String source = functionExecutable->source().provider()->getRange(
</span><span class="lines">@@ -1753,7 +1753,7 @@
</span><span class="cx"> setNumParameters(unlinkedCodeBlock->numParameters());
</span><span class="cx">
</span><span class="cx"> if (vm()->typeProfiler() || vm()->controlFlowProfiler())
</span><del>- vm()->functionHasExecutedCache()->removeUnexecutedRange(m_ownerExecutable->sourceID(), m_ownerExecutable->typeProfilingStartOffset(), m_ownerExecutable->typeProfilingEndOffset());
</del><ins>+ vm()->functionHasExecutedCache()->removeUnexecutedRange(ownerExecutable->sourceID(), ownerExecutable->typeProfilingStartOffset(), ownerExecutable->typeProfilingEndOffset());
</ins><span class="cx">
</span><span class="cx"> setConstantRegisters(unlinkedCodeBlock->constantRegisters(), unlinkedCodeBlock->constantsSourceCodeRepresentation());
</span><span class="cx"> if (unlinkedCodeBlock->usesGlobalObject())
</span><span class="lines">@@ -1787,7 +1787,7 @@
</span><span class="cx"> for (size_t count = unlinkedCodeBlock->numberOfFunctionDecls(), i = 0; i < count; ++i) {
</span><span class="cx"> UnlinkedFunctionExecutable* unlinkedExecutable = unlinkedCodeBlock->functionDecl(i);
</span><span class="cx"> if (vm()->typeProfiler() || vm()->controlFlowProfiler())
</span><del>- vm()->functionHasExecutedCache()->insertUnexecutedRange(m_ownerExecutable->sourceID(), unlinkedExecutable->typeProfilingStartOffset(), unlinkedExecutable->typeProfilingEndOffset());
</del><ins>+ vm()->functionHasExecutedCache()->insertUnexecutedRange(ownerExecutable->sourceID(), unlinkedExecutable->typeProfilingStartOffset(), unlinkedExecutable->typeProfilingEndOffset());
</ins><span class="cx"> m_functionDecls[i].set(*m_vm, ownerExecutable, unlinkedExecutable->link(*m_vm, ownerExecutable->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->numberOfFunctionExprs(), i = 0; i < count; ++i) {
</span><span class="cx"> UnlinkedFunctionExecutable* unlinkedExecutable = unlinkedCodeBlock->functionExpr(i);
</span><span class="cx"> if (vm()->typeProfiler() || vm()->controlFlowProfiler())
</span><del>- vm()->functionHasExecutedCache()->insertUnexecutedRange(m_ownerExecutable->sourceID(), unlinkedExecutable->typeProfilingStartOffset(), unlinkedExecutable->typeProfilingEndOffset());
</del><ins>+ vm()->functionHasExecutedCache()->insertUnexecutedRange(ownerExecutable->sourceID(), unlinkedExecutable->typeProfilingStartOffset(), unlinkedExecutable->typeProfilingEndOffset());
</ins><span class="cx"> m_functionExprs[i].set(*m_vm, ownerExecutable, unlinkedExecutable->link(*m_vm, ownerExecutable->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->initialize(*vm(),
</span><del>- m_ownerExecutable.get(), m_globalObject->objectPrototype(), inferredInlineCapacity);
</del><ins>+ ownerExecutable, m_globalObject->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 "f" in the function keyword
</span><span class="cx"> // and is stored on TypeLocation's m_divotForFunctionOffsetIfReturnStatement member variable.
</span><del>- divotStart = divotEnd = m_ownerExecutable->typeProfilingStartOffset();
</del><ins>+ divotStart = divotEnd = ownerExecutable->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<TypeLocation*, bool> locationPair = vm()->typeProfiler()->typeLocationCache()->getTypeLocation(globalVariableID,
</span><del>- m_ownerExecutable->sourceID(), divotStart, divotEnd, globalTypeSet, vm());
</del><ins>+ ownerExecutable->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->m_divotForFunctionOffsetIfReturnStatement = m_ownerExecutable->typeProfilingStartOffset();
</del><ins>+ location->m_divotForFunctionOffsetIfReturnStatement = ownerExecutable->typeProfilingStartOffset();
</ins><span class="cx">
</span><span class="cx"> if (shouldAnalyze && isNewLocation)
</span><span class="cx"> vm()->typeProfiler()->insertNewLocation(location);
</span><span class="lines">@@ -2165,6 +2165,39 @@
</span><span class="cx"> m_heap->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& vm, JSGlobalObject* globalObject)
+ : m_globalObject(globalObject->vm(), ownerExecutable, globalObject)
+ , m_heap(&m_globalObject->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->vm(), ownerExecutable, ownerExecutable)
+ , m_vm(&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->isDeferred());
+
+ m_heap->m_codeBlocks.add(this);
+ m_heap->reportExtraMemoryAllocated(sizeof(CodeBlock));
+}
+#endif
+
</ins><span class="cx"> CodeBlock::~CodeBlock()
</span><span class="cx"> {
</span><span class="cx"> if (m_vm->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->interpreter;
</span><del>- if (JITCode::couldBeInterpreted(jitType())) {
</del><ins>+ bool ownedByWebAssemblyExecutable = false;
+#if ENABLE(WEBASSEMBLY)
+ ownedByWebAssemblyExecutable = m_ownerExecutable->isWebAssemblyExecutable();
+#endif
+ if (JITCode::couldBeInterpreted(jitType()) && !ownedByWebAssemblyExecutable) {
</ins><span class="cx"> const Vector<unsigned>& propertyAccessInstructions = m_unlinkedCode->propertyAccessInstructions();
</span><span class="cx"> for (size_t size = propertyAccessInstructions.size(), i = 0; i < size; ++i) {
</span><span class="cx"> Instruction* curInstruction = &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 < instructions().size());
</span><del>- return m_ownerExecutable->firstLine() + m_unlinkedCode->lineNumberForBytecodeOffset(bytecodeOffset);
</del><ins>+ return ownerScriptExecutable()->firstLine() + m_unlinkedCode->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->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->firstLine();
</del><ins>+ line += ownerScriptExecutable()->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()->installCode(this);
</del><ins>+ ownerScriptExecutable()->installCode(this);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> PassRefPtr<CodeBlock> CodeBlock::newReplacement()
</span><span class="cx"> {
</span><del>- return ownerExecutable()->newReplacementCodeBlockFor(specializationKind());
</del><ins>+ return ownerScriptExecutable()->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->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()->interpreter->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->source().length() - 1; // Offset before the closing brace.
</del><ins>+ basicBlockEndOffset = m_sourceOffset + ownerScriptExecutable()->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()->controlFlowProfiler()->getBasicBlockLocation(m_ownerExecutable->sourceID(), basicBlockStartOffset, basicBlockEndOffset);
</del><ins>+ BasicBlockLocation* basicBlockLocation = vm()->controlFlowProfiler()->getBasicBlockLocation(ownerScriptExecutable()->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& other);
</span><span class="cx">
</span><span class="cx"> CodeBlock(ScriptExecutable* ownerExecutable, UnlinkedCodeBlock*, JSScope*, PassRefPtr<SourceProvider>, unsigned sourceOffset, unsigned firstLineColumnOffset);
</span><ins>+#if ENABLE(WEBASSEMBLY)
+ CodeBlock(WebAssemblyExecutable* ownerExecutable, VM&, JSGlobalObject*);
+#endif
</ins><span class="cx">
</span><span class="cx"> WriteBarrier<JSGlobalObject> 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<ScriptExecutable*>(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->codeType(); }
</del><ins>+ CodeType codeType() const
+ {
+#if ENABLE(WEBASSEMBLY)
+ if (m_ownerExecutable->isWebAssemblyExecutable())
+ return FunctionCode;
+#endif
+ return m_unlinkedCode->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<ScriptExecutable> m_ownerExecutable;
</del><ins>+ WriteBarrier<ExecutableBase> m_ownerExecutable;
</ins><span class="cx"> VM* m_vm;
</span><span class="cx">
</span><span class="cx"> RefCountedArray<Instruction> 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& other)
+ : CodeBlock(CopyParsedBlock, other)
+ {
+ }
+
+ WebAssemblyCodeBlock(WebAssemblyExecutable* ownerExecutable, VM& 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& ExecState::r(int index)
</span><span class="cx"> {
</span><span class="cx"> CodeBlock* codeBlock = this->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& breakpoint, BreakpointState enabledOrNot)
</span><span class="cx"> {
</span><del>- ScriptExecutable* executable = codeBlock->ownerExecutable();
</del><ins>+ ScriptExecutable* executable = codeBlock->ownerScriptExecutable();
</ins><span class="cx">
</span><span class="cx"> SourceID sourceID = static_cast<SourceID>(executable->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->codeBlock();
</span><span class="cx"> if (!codeBlock)
</span><span class="cx"> return noSourceID;
</span><del>- return codeBlock->ownerExecutable()->sourceID();
</del><ins>+ return codeBlock->ownerScriptExecutable()->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->ownerExecutable(); }
</del><ins>+ ScriptExecutable* executable() { return m_codeBlock->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(" Might inline function: ", mightInlineFunctionFor(codeBlock, kind), "\n");
</span><span class="cx"> dataLog(" Might compile function: ", mightCompileFunctionFor(codeBlock, kind), "\n");
</span><span class="cx"> dataLog(" Is supported for inlining: ", isSupportedForInlining(codeBlock), "\n");
</span><del>- dataLog(" Needs activation: ", codeBlock->ownerExecutable()->needsActivation(), "\n");
- dataLog(" Is inlining candidate: ", codeBlock->ownerExecutable()->isInliningCandidate(), "\n");
</del><ins>+ dataLog(" Needs activation: ", codeBlock->ownerScriptExecutable()->needsActivation(), "\n");
+ dataLog(" Is inlining candidate: ", codeBlock->ownerScriptExecutable()->isInliningCandidate(), "\n");
</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->m_graph.freeze(codeBlock->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->executable.setWithoutWriteBarrier(codeBlock->ownerExecutable());
</del><ins>+ m_inlineCallFrame->executable.setWithoutWriteBarrier(codeBlock->ownerScriptExecutable());
</ins><span class="cx"> m_inlineCallFrame->setStackOffset(inlineCallFrameStart.offset() - JSStack::CallFrameHeaderSize);
</span><span class="cx"> if (callee) {
</span><span class="cx"> m_inlineCallFrame->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"> ": needsActivation = ", codeBlock->needsActivation(),
</span><del>- ", isStrictMode = ", codeBlock->ownerExecutable()->isStrictMode(), "\n");
</del><ins>+ ", isStrictMode = ", codeBlock->ownerScriptExecutable()->isStrictMode(), "\n");
</ins><span class="cx"> codeBlock->baselineVersion()->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->ownerExecutable()->isInliningCandidate();
</del><ins>+#if ENABLE(WEBASSEMBLY)
+ if (codeBlock->ownerExecutable()->isWebAssemblyExecutable())
+ return false;
+#endif
+ return codeBlock->ownerScriptExecutable()->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"> && codeBlock->instructionCount() <= Options::maximumOptimizationCandidateInstructionCount()
</span><del>- && codeBlock->ownerExecutable()->isOkToOptimize();
</del><ins>+ && codeBlock->ownerScriptExecutable()->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"> && codeBlock->instructionCount() <= Options::maximumOptimizationCandidateInstructionCount()
</span><del>- && codeBlock->ownerExecutable()->isOkToOptimize();
</del><ins>+ && codeBlock->ownerScriptExecutable()->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"> && codeBlock->instructionCount() <= Options::maximumOptimizationCandidateInstructionCount()
</span><del>- && codeBlock->ownerExecutable()->isOkToOptimize();
</del><ins>+ && codeBlock->ownerScriptExecutable()->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"> && codeBlock->instructionCount() <= Options::maximumOptimizationCandidateInstructionCount()
</span><del>- && codeBlock->ownerExecutable()->isOkToOptimize();
</del><ins>+ && codeBlock->ownerScriptExecutable()->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->ownerExecutable();
</del><ins>+ return m_codeBlock->ownerScriptExecutable();
</ins><span class="cx">
</span><span class="cx"> return inlineCallFrame->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->ownerExecutable()->setDidTryToEnterInLoop(true);
</del><ins>+ codeBlock->ownerScriptExecutable()->setDidTryToEnterInLoop(true);
</ins><span class="cx">
</span><span class="cx"> if (codeBlock->jitType() != JITCode::DFGJIT) {
</span><span class="cx"> RELEASE_ASSERT(codeBlock->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->codeBlock()->ownerExecutable()->isWebAssemblyExecutable())
+ return StackVisitor::Continue;
+#endif
</ins><span class="cx"> unsigned line;
</span><span class="cx"> unsigned column;
</span><span class="cx"> visitor->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->vm().exception());
</span><span class="cx">
</span><span class="cx"> ThisTDZMode thisTDZMode = callerCodeBlock->unlinkedCodeBlock()->constructorKind() == ConstructorKind::Derived ? ThisTDZMode::AlwaysCheck : ThisTDZMode::CheckIfNeeded;
</span><del>- eval = callerCodeBlock->evalCodeCache().getSlow(callFrame, callerCodeBlock->ownerExecutable(), callerCodeBlock->isStrictMode(), thisTDZMode, programSource, callerScopeChain);
</del><ins>+ eval = callerCodeBlock->evalCodeCache().getSlow(callFrame, callerCodeBlock->ownerScriptExecutable(), callerCodeBlock->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->isWebAssemblyExecutable();
+#endif
+}
+
</ins><span class="cx"> class GetStackTraceFunctor {
</span><span class="cx"> public:
</span><span class="cx"> GetStackTraceFunctor(VM& vm, Vector<StackFrame>& results, size_t remainingCapacity)
</span><span class="lines">@@ -528,15 +538,17 @@
</span><span class="cx"> {
</span><span class="cx"> VM& vm = m_vm;
</span><span class="cx"> if (m_remainingCapacityForFrameCapture) {
</span><del>- if (visitor->isJSFrame() && !visitor->codeBlock()->unlinkedCodeBlock()->isBuiltinFunction()) {
</del><ins>+ if (visitor->isJSFrame()
+ && !isWebAssemblyExecutable(visitor->codeBlock()->ownerExecutable())
+ && !visitor->codeBlock()->unlinkedCodeBlock()->isBuiltinFunction()) {
</ins><span class="cx"> CodeBlock* codeBlock = visitor->codeBlock();
</span><span class="cx"> StackFrame s = {
</span><span class="cx"> Strong<JSObject>(vm, visitor->callee()),
</span><span class="cx"> getStackFrameCodeType(visitor),
</span><del>- Strong<ScriptExecutable>(vm, codeBlock->ownerExecutable()),
</del><ins>+ Strong<ScriptExecutable>(vm, codeBlock->ownerScriptExecutable()),
</ins><span class="cx"> Strong<UnlinkedCodeBlock>(vm, codeBlock->unlinkedCodeBlock()),
</span><span class="cx"> codeBlock->source(),
</span><del>- codeBlock->ownerExecutable()->firstLine(),
</del><ins>+ codeBlock->ownerScriptExecutable()->firstLine(),
</ins><span class="cx"> codeBlock->firstLineColumnOffset(),
</span><span class="cx"> codeBlock->sourceOffset(),
</span><span class="cx"> visitor->bytecodeOffset(),
</span><span class="lines">@@ -629,7 +641,7 @@
</span><span class="cx"> m_codeBlock = visitor->codeBlock();
</span><span class="cx"> unsigned bytecodeOffset = visitor->bytecodeOffset();
</span><span class="cx">
</span><del>- if (m_isTermination || !(m_handler = m_codeBlock ? m_codeBlock->handlerForBytecodeOffset(bytecodeOffset) : nullptr)) {
</del><ins>+ if (m_isTermination || !(m_handler = (m_codeBlock && !isWebAssemblyExecutable(m_codeBlock->ownerExecutable())) ? m_codeBlock->handlerForBytecodeOffset(bytecodeOffset) : nullptr)) {
</ins><span class="cx"> if (!unwindCallFrame(visitor)) {
</span><span class="cx"> if (LegacyProfiler* profiler = vm.enabledProfiler())
</span><span class="cx"> profiler->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()->ownerExecutable()->sourceURL();
</del><ins>+ String sourceURL = codeBlock()->ownerScriptExecutable()->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->ownerExecutable()->firstLine();
</del><ins>+ line = divotLine + codeBlock->ownerScriptExecutable()->firstLine();
</ins><span class="cx"> column = divotColumn + (divotLine ? 1 : codeBlock->firstLineColumnOffset());
</span><span class="cx">
</span><del>- if (codeBlock->ownerExecutable()->hasOverrideLineNumber())
- line = codeBlock->ownerExecutable()->overrideLineNumber();
</del><ins>+ if (codeBlock->ownerScriptExecutable()->hasOverrideLineNumber())
+ line = codeBlock->ownerScriptExecutable()->overrideLineNumber();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void StackVisitor::Frame::retrieveExpressionInfo(int& divot, int& startOffset, int& endOffset, unsigned& line, unsigned& 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->isHostFunction())
</del><ins>+ if (executable->isHostFunction()) {
</ins><span class="cx"> codePtr = executable->entrypointFor(*vm, kind, MustCheckArity, callLinkInfo->registerPreservationMode());
</span><del>- else {
</del><ins>+#if ENABLE(WEBASSEMBLY)
+ } else if (executable->isWebAssemblyExecutable()) {
+ WebAssemblyExecutable* webAssemblyExecutable = static_cast<WebAssemblyExecutable*>(executable);
+ webAssemblyExecutable->prepareForExecution(execCallee);
+ codeBlock = webAssemblyExecutable->codeBlockForCall();
+ ASSERT(codeBlock);
+ ArityCheckMode arity;
+ if (execCallee->argumentCountIncludingThis() < static_cast<size_t>(codeBlock->numParameters()))
+ arity = MustCheckArity;
+ else
+ arity = ArityCheckNotRequired;
+ codePtr = webAssemblyExecutable->entrypointFor(*vm, kind, arity, callLinkInfo->registerPreservationMode());
+#endif
+ } else {
</ins><span class="cx"> FunctionExecutable* functionExecutable = static_cast<FunctionExecutable*>(executable);
</span><span class="cx">
</span><span class="cx"> if (!isCall(kind) && functionExecutable->constructAbility() == ConstructAbility::CannotConstruct) {
</span><span class="lines">@@ -896,17 +909,33 @@
</span><span class="cx"> JSScope* scope = function->scopeUnchecked();
</span><span class="cx"> ExecutableBase* executable = function->executable();
</span><span class="cx"> if (UNLIKELY(!executable->hasJITCodeFor(kind))) {
</span><del>- FunctionExecutable* functionExecutable = static_cast<FunctionExecutable*>(executable);
</del><ins>+ bool isWebAssemblyExecutable = false;
+#if ENABLE(WEBASSEMBLY)
+ isWebAssemblyExecutable = executable->isWebAssemblyExecutable();
+#endif
+ if (!isWebAssemblyExecutable) {
+ FunctionExecutable* functionExecutable = static_cast<FunctionExecutable*>(executable);
</ins><span class="cx">
</span><del>- if (!isCall(kind) && functionExecutable->constructAbility() == ConstructAbility::CannotConstruct) {
- exec->vm().throwException(exec, createNotAConstructorError(exec, function));
- return reinterpret_cast<char*>(vm->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress());
- }
</del><ins>+ if (!isCall(kind) && functionExecutable->constructAbility() == ConstructAbility::CannotConstruct) {
+ exec->vm().throwException(exec, createNotAConstructorError(exec, function));
+ return reinterpret_cast<char*>(vm->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress());
+ }
</ins><span class="cx">
</span><del>- JSObject* error = functionExecutable->prepareForExecution(execCallee, function, scope, kind);
- if (error) {
- exec->vm().throwException(exec, error);
- return reinterpret_cast<char*>(vm->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress());
</del><ins>+ JSObject* error = functionExecutable->prepareForExecution(execCallee, function, scope, kind);
+ if (error) {
+ exec->vm().throwException(exec, error);
+ return reinterpret_cast<char*>(vm->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress());
+ }
+ } else {
+#if ENABLE(WEBASSEMBLY)
+ if (!isCall(kind)) {
+ exec->vm().throwException(exec, createNotAConstructorError(exec, function));
+ return reinterpret_cast<char*>(vm->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress());
+ }
+
+ WebAssemblyExecutable* webAssemblyExecutable = static_cast<WebAssemblyExecutable*>(executable);
+ webAssemblyExecutable->prepareForExecution(execCallee);
+#endif
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> return reinterpret_cast<char*>(executable->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()->isHostFunction())
</span><span class="cx"> codeBlock = nullptr;
</span><span class="cx"> else {
</span><del>- codeBlock = jsCast<FunctionExecutable*>(variant.executable())->codeBlockForCall();
-
</del><ins>+ ExecutableBase* executable = variant.executable();
+#if ENABLE(WEBASSEMBLY)
+ if (executable->isWebAssemblyExecutable())
+ codeBlock = jsCast<WebAssemblyExecutable*>(executable)->codeBlockForCall();
+ else
+#endif
+ codeBlock = jsCast<FunctionExecutable*>(executable)->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->argumentCountIncludingThis() < static_cast<size_t>(codeBlock->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->isHostFunction())
</del><ins>+ bool isWebAssemblyExecutable = false;
+#if ENABLE(WEBASSEMBLY)
+ isWebAssemblyExecutable = executable->isWebAssemblyExecutable();
+#endif
+
+ if (executable->isHostFunction()) {
</ins><span class="cx"> codePtr = executable->entrypointFor(vm, kind, MustCheckArity, RegisterPreservationNotRequired);
</span><del>- else {
</del><ins>+ } else if (!isWebAssemblyExecutable) {
</ins><span class="cx"> FunctionExecutable* functionExecutable = static_cast<FunctionExecutable*>(executable);
</span><span class="cx">
</span><span class="cx"> if (!isCall(kind) && functionExecutable->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->entrypointFor(vm, kind, arity, RegisterPreservationNotRequired);
</span><ins>+ } else {
+#if ENABLE(WEBASSEMBLY)
+ WebAssemblyExecutable* webAssemblyExecutable = static_cast<WebAssemblyExecutable*>(executable);
+ webAssemblyExecutable->prepareForExecution(execCallee);
+ codeBlock = webAssemblyExecutable->codeBlockForCall();
+ ASSERT(codeBlock);
+ ArityCheckMode arity;
+ if (execCallee->argumentCountIncludingThis() < static_cast<size_t>(codeBlock->numParameters()))
+ arity = MustCheckArity;
+ else
+ arity = ArityCheckNotRequired;
+ codePtr = webAssemblyExecutable->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->codeBlock()->ownerExecutable();
</del><ins>+ ExecutableBase* ownerExecutable = exec->codeBlock()->ownerExecutable();
</ins><span class="cx"> Heap::heap(ownerExecutable)->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 "DFGDriver.h"
</span><span class="cx"> #include "JIT.h"
</span><span class="cx"> #include "JSCInlines.h"
</span><ins>+#include "JSWASMModule.h"
</ins><span class="cx"> #include "LLIntEntrypoint.h"
</span><span class="cx"> #include "Parser.h"
</span><span class="cx"> #include "ProfilerDatabase.h"
</span><span class="cx"> #include "TypeProfiler.h"
</span><ins>+#include "WASMFunctionParser.h"
</ins><span class="cx"> #include <wtf/CommaPrinter.h>
</span><span class="cx"> #include <wtf/Vector.h>
</span><span class="cx"> #include <wtf/text/StringBuilder.h>
</span><span class="lines">@@ -562,6 +564,62 @@
</span><span class="cx"> return unlinkedExecutable->link(exec.vm(), source, overrideLineNumber);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if ENABLE(WEBASSEMBLY)
+const ClassInfo WebAssemblyExecutable::s_info = { "WebAssemblyExecutable", &ExecutableBase::s_info, 0, CREATE_METHOD_TABLE(WebAssemblyExecutable) };
+
+WebAssemblyExecutable::WebAssemblyExecutable(VM& vm, const SourceCode& 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<WebAssemblyExecutable*>(cell)->WebAssemblyExecutable::~WebAssemblyExecutable();
+}
+
+void WebAssemblyExecutable::visitChildren(JSCell* cell, SlotVisitor& visitor)
+{
+ WebAssemblyExecutable* thisObject = jsCast<WebAssemblyExecutable*>(cell);
+ ASSERT_GC_OBJECT_INHERITS(thisObject, info());
+ ExecutableBase::visitChildren(thisObject, visitor);
+ if (thisObject->m_codeBlockForCall)
+ thisObject->m_codeBlockForCall->visitAggregate(visitor);
+ visitor.append(&thisObject->m_module);
+}
+
+void WebAssemblyExecutable::clearCode()
+{
+ m_codeBlockForCall = nullptr;
+ Base::clearCode();
+}
+
+void WebAssemblyExecutable::prepareForExecution(ExecState* exec)
+{
+ if (hasJITCodeForCall())
+ return;
+
+ VM& vm = exec->vm();
+ DeferGC deferGC(vm.heap);
+
+ RefPtr<WebAssemblyCodeBlock> codeBlock = adoptRef(new WebAssemblyCodeBlock(
+ this, vm, exec->lexicalGlobalObject()));
+
+ WASMFunctionParser::compile(vm, codeBlock.get(), m_module.get(), m_source, m_functionIndex);
+
+ m_jitCodeForCall = codeBlock->jitCode();
+ m_jitCodeForCallWithArityCheck = MacroAssemblerCodePtr();
+ m_jitCodeForCallWithArityCheckAndPreserveRegs = MacroAssemblerCodePtr();
+ m_numParametersForCall = codeBlock->numParameters();
+
+ m_codeBlockForCall = codeBlock;
+
+ Heap::heap(this)->writeBarrier(this);
+}
+#endif
+
</ins><span class="cx"> void ExecutableBase::dump(PrintStream& out) const
</span><span class="cx"> {
</span><span class="cx"> ExecutableBase* realThis = const_cast<ExecutableBase*>(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& 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<InferredValue> 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& vm, const SourceCode& source, JSWASMModule* module, unsigned functionIndex)
+ {
+ WebAssemblyExecutable* executable = new (NotNull, allocateCell<WebAssemblyExecutable>(vm.heap)) WebAssemblyExecutable(vm, source, module, functionIndex);
+ executable->finishCreation(vm);
+ return executable;
+ }
+
+ static Structure* createStructure(VM& 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&, const SourceCode&, JSWASMModule*, unsigned functionIndex);
+
+ static void visitChildren(JSCell*, SlotVisitor&);
+
+ SourceCode m_source;
+ WriteBarrier<JSWASMModule> m_module;
+ unsigned m_functionIndex;
+
+ RefPtr<WebAssemblyCodeBlock> m_codeBlockForCall;
+};
+#endif
+
</ins><span class="cx"> inline void ExecutableBase::clearCodeVirtual(ExecutableBase* executable)
</span><span class="cx"> {
</span><span class="cx"> switch (executable->type()) {
</span><span class="lines">@@ -685,6 +738,10 @@
</span><span class="cx"> return jsCast<ProgramExecutable*>(executable)->clearCode();
</span><span class="cx"> case FunctionExecutableType:
</span><span class="cx"> return jsCast<FunctionExecutable*>(executable)->clearCode();
</span><ins>+#if ENABLE(WEBASSEMBLY)
+ case WebAssemblyExecutableType:
+ return jsCast<WebAssemblyExecutable*>(executable)->clearCode();
+#endif
</ins><span class="cx"> default:
</span><span class="cx"> return jsCast<NativeExecutable*>(executable)->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& vm, WebAssemblyExecutable* executable, JSScope* scope)
+{
+ JSFunction* function = new (NotNull, allocateCell<JSFunction>(vm.heap)) JSFunction(vm, executable, scope);
+ ASSERT(function->structure()->globalObject());
+ function->finishCreation(vm);
+ return function;
+}
+#endif
+
</ins><span class="cx"> static inline NativeExecutable* getNativeExecutable(VM& 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&, JSGlobalObject*, int length, const String& name, NativeStdFunction&&, Intrinsic = NoIntrinsic, NativeFunction nativeConstructor = callHostFunctionAsConstructor);
</span><span class="cx">
</span><span class="cx"> static JSFunction* create(VM&, FunctionExecutable*, JSScope*);
</span><ins>+#if ENABLE(WEBASSEMBLY)
+ static JSFunction* create(VM&, WebAssemblyExecutable*, JSScope*);
+#endif
</ins><span class="cx">
</span><span class="cx"> static JSFunction* createBuiltinFunction(VM&, FunctionExecutable*, JSGlobalObject*);
</span><span class="cx"> static JSFunction* createBuiltinFunction(VM&, FunctionExecutable*, JSGlobalObject*, const String& name);
</span><span class="lines">@@ -143,6 +147,10 @@
</span><span class="cx"> JSFunction(VM&, FunctionExecutable*, JSScope*);
</span><span class="cx"> JSFunction(VM&, FunctionExecutable*, JSScope*, Structure*);
</span><span class="cx">
</span><ins>+#if ENABLE(WEBASSEMBLY)
+ JSFunction(VM&, WebAssemblyExecutable*, JSScope*);
+#endif
+
</ins><span class="cx"> void finishCreation(VM&, NativeExecutable*, int length, const String& 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& vm, WebAssemblyExecutable* executable, JSScope* scope)
+ : Base(vm, scope, scope->globalObject()->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->isWebAssemblyExecutable())
+ return false;
+#endif
</ins><span class="cx"> return !isHostFunction() && jsExecutable()->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<Structure> evalExecutableStructure;
</span><span class="cx"> Strong<Structure> programExecutableStructure;
</span><span class="cx"> Strong<Structure> functionExecutableStructure;
</span><ins>+#if ENABLE(WEBASSEMBLY)
+ Strong<Structure> webAssemblyExecutableStructure;
+#endif
</ins><span class="cx"> Strong<Structure> regExpStructure;
</span><span class="cx"> Strong<Structure> symbolStructure;
</span><span class="cx"> Strong<Structure> 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<WASMFunctionDeclaration>& functionDeclarations() { return m_functionDeclarations; }
</span><span class="cx"> Vector<WASMFunctionPointerTable>& functionPointerTables() { return m_functionPointerTables; }
</span><span class="cx">
</span><ins>+ Vector<WriteBarrier<JSFunction>>& functions() { return m_functions; }
+
</ins><span class="cx"> private:
</span><span class="cx"> JSWASMModule(VM& 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 "CCallHelpers.h"
</ins><span class="cx"> #include "JSWASMModule.h"
</span><ins>+#include "LinkBuffer.h"
</ins><span class="cx"> #include "WASMFunctionSyntaxChecker.h"
</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& vm, CodeBlock* codeBlock, JSWASMModule* module, const SourceCode&, size_t functionIndex)
+{
+ // FIXME: Actually compile the code.
+ CCallHelpers jit(&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, ("Baseline JIT code for WebAssembly"));
+ codeBlock->setJITCode(adoptRef(new DirectJITCode(result, withArityCheck, JITCode::BaselineJIT)));
+ codeBlock->capabilityLevel();
+
+ uint32_t signatureIndex = module->functionDeclarations()[functionIndex].signatureIndex;
+ const WASMSignature& signature = module->signatures()[signatureIndex];
+ codeBlock->setNumParameters(1 + signature.arguments.size());
+}
+
</ins><span class="cx"> template <class Context>
</span><span class="cx"> bool WASMFunctionParser::parseFunction(Context& 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&, size_t functionIndex, unsigned startOffsetInSource, unsigned& endOffsetInSource, String& errorMessage);
</span><ins>+ static void compile(VM&, CodeBlock*, JSWASMModule*, const SourceCode&, size_t functionIndex);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> WASMFunctionParser(JSWASMModule* module, const SourceCode& 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& source)
- : m_source(source)
</del><ins>+WASMModuleParser::WASMModuleParser(VM& vm, JSGlobalObject* globalObject, const SourceCode& source)
+ : m_vm(vm)
+ , m_globalObject(vm, globalObject)
+ , m_source(source)
</ins><span class="cx"> , m_reader(static_cast<WebAssemblySourceProvider*>(source.provider())->data())
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-JSWASMModule* WASMModuleParser::parse(VM& vm, JSGlobalObject* globalObject, String& errorMessage)
</del><ins>+JSWASMModule* WASMModuleParser::parse(String& errorMessage)
</ins><span class="cx"> {
</span><del>- m_module.set(vm, JSWASMModule::create(vm, globalObject->wasmModuleStructure()));
</del><ins>+ m_module.set(m_vm, JSWASMModule::create(m_vm, m_globalObject->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, "Cannot read the number of function declarations.");
</span><span class="cx"> m_module->functionDeclarations().reserveInitialCapacity(numberOfFunctionDeclarations);
</span><ins>+ m_module->functions().reserveInitialCapacity(numberOfFunctionDeclarations);
</ins><span class="cx"> for (uint32_t i = 0; i < numberOfFunctionDeclarations; ++i) {
</span><span class="cx"> WASMFunctionDeclaration functionDeclaration;
</span><span class="cx"> READ_COMPACT_UINT32_OR_FAIL(functionDeclaration.signatureIndex, "Cannot read the signature index.");
</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->functions().uncheckedAppend(WriteBarrier<JSFunction>(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 < numberOfExports; ++exportIndex) {
</span><span class="cx"> String exportName;
</span><span class="cx"> READ_STRING_OR_FAIL(exportName, "Cannot read the function export name.");
</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, "Cannot read the function index.");
</span><span class="cx"> FAIL_IF_FALSE(functionIndex < m_module->functionDeclarations().size(), "The function index is incorrect.");
</span><del>- // FIXME: Export the function.
</del><ins>+ Identifier identifier = Identifier::fromString(&m_vm, exportName);
+ m_module->putDirect(m_vm, identifier, m_module->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& source, String& errorMessage)
</span><span class="cx"> {
</span><del>- WASMModuleParser WASMModuleParser(source);
- return WASMModuleParser.parse(exec->vm(), exec->lexicalGlobalObject(), errorMessage);
</del><ins>+ WASMModuleParser moduleParser(exec->vm(), exec->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&);
- JSWASMModule* parse(VM&, JSGlobalObject*, String& errorMessage);
</del><ins>+ WASMModuleParser(VM&, JSGlobalObject*, const SourceCode&);
+ JSWASMModule* parse(String& 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& m_vm;
+ Strong<JSGlobalObject> m_globalObject;
</ins><span class="cx"> const SourceCode& m_source;
</span><span class="cx"> WASMReader m_reader;
</span><span class="cx"> Strong<JSWASMModule> 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 <sukolsak@gmail.com>
+
+ 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 <jer.noble@apple.com>
</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->iterate(iter);
</span><span class="cx"> CodeBlock* codeBlock = iter.codeBlock();
</span><del>- executable = codeBlock->ownerExecutable();
</del><ins>+ executable = codeBlock->ownerScriptExecutable();
</ins><span class="cx"> } else if (code.isFunction()) {
</span><span class="cx"> JSFunction* funcObj = JSC::jsCast<JSFunction*>(code.toObject(exec));
</span><span class="cx"> executable = funcObj->jsExecutable();
</span><span class="lines">@@ -1485,10 +1485,14 @@
</span><span class="cx"> result.append('"');
</span><span class="cx"> } else if (executable->isEvalExecutable())
</span><span class="cx"> result.appendLiteral("eval");
</span><del>- else {
- ASSERT(executable->isProgramExecutable());
</del><ins>+ else if (executable->isProgramExecutable())
</ins><span class="cx"> result.appendLiteral("program");
</span><del>- }
</del><ins>+#if ENABLE(WEBASSEMBLY)
+ else if (executable->isWebAssemblyExecutable())
+ result.appendLiteral("WebAssembly");
+#endif
+ else
+ ASSERT_NOT_REACHED();
</ins><span class="cx">
</span><span class="cx"> result.appendLiteral(" { ");
</span><span class="cx"> result.appendNumber(startLine);
</span></span></pre>
</div>
</div>
</body>
</html>