<!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>[209196] trunk/Source/JavaScriptCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/209196">209196</a></dd>
<dt>Author</dt> <dd>ggaren@apple.com</dd>
<dt>Date</dt> <dd>2016-12-01 13:23:27 -0800 (Thu, 01 Dec 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Removed some unnecessary indirection in code generation
https://bugs.webkit.org/show_bug.cgi?id=165264
Reviewed by Keith Miller.
There's no need to route through JSGlobalObject when producing code --
it just made the code harder to read.
This patch moves functions from JSGlobalObject to their singleton
call sites.
* runtime/CodeCache.cpp:
(JSC::CodeCache::getUnlinkedEvalCodeBlock):
(JSC::CodeCache::getUnlinkedGlobalEvalCodeBlock): Deleted.
* runtime/CodeCache.h:
* runtime/DirectEvalExecutable.cpp:
(JSC::DirectEvalExecutable::create):
* runtime/IndirectEvalExecutable.cpp:
(JSC::IndirectEvalExecutable::create):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::createProgramCodeBlock): Deleted.
(JSC::JSGlobalObject::createLocalEvalCodeBlock): Deleted.
(JSC::JSGlobalObject::createGlobalEvalCodeBlock): Deleted.
(JSC::JSGlobalObject::createModuleProgramCodeBlock): Deleted.
* runtime/JSGlobalObject.h:
* runtime/ModuleProgramExecutable.cpp:
(JSC::ModuleProgramExecutable::create):
* runtime/ProgramExecutable.cpp:
(JSC::ProgramExecutable::initializeGlobalProperties):
* runtime/ProgramExecutable.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeCodeCachecpp">trunk/Source/JavaScriptCore/runtime/CodeCache.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeCodeCacheh">trunk/Source/JavaScriptCore/runtime/CodeCache.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeDirectEvalExecutablecpp">trunk/Source/JavaScriptCore/runtime/DirectEvalExecutable.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeIndirectEvalExecutablecpp">trunk/Source/JavaScriptCore/runtime/IndirectEvalExecutable.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp">trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGlobalObjecth">trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeModuleProgramExecutablecpp">trunk/Source/JavaScriptCore/runtime/ModuleProgramExecutable.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeProgramExecutablecpp">trunk/Source/JavaScriptCore/runtime/ProgramExecutable.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeProgramExecutableh">trunk/Source/JavaScriptCore/runtime/ProgramExecutable.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (209195 => 209196)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-12-01 21:22:07 UTC (rev 209195)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-12-01 21:23:27 UTC (rev 209196)
</span><span class="lines">@@ -1,3 +1,36 @@
</span><ins>+2016-12-01 Geoffrey Garen <ggaren@apple.com>
+
+ Removed some unnecessary indirection in code generation
+ https://bugs.webkit.org/show_bug.cgi?id=165264
+
+ Reviewed by Keith Miller.
+
+ There's no need to route through JSGlobalObject when producing code --
+ it just made the code harder to read.
+
+ This patch moves functions from JSGlobalObject to their singleton
+ call sites.
+
+ * runtime/CodeCache.cpp:
+ (JSC::CodeCache::getUnlinkedEvalCodeBlock):
+ (JSC::CodeCache::getUnlinkedGlobalEvalCodeBlock): Deleted.
+ * runtime/CodeCache.h:
+ * runtime/DirectEvalExecutable.cpp:
+ (JSC::DirectEvalExecutable::create):
+ * runtime/IndirectEvalExecutable.cpp:
+ (JSC::IndirectEvalExecutable::create):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::createProgramCodeBlock): Deleted.
+ (JSC::JSGlobalObject::createLocalEvalCodeBlock): Deleted.
+ (JSC::JSGlobalObject::createGlobalEvalCodeBlock): Deleted.
+ (JSC::JSGlobalObject::createModuleProgramCodeBlock): Deleted.
+ * runtime/JSGlobalObject.h:
+ * runtime/ModuleProgramExecutable.cpp:
+ (JSC::ModuleProgramExecutable::create):
+ * runtime/ProgramExecutable.cpp:
+ (JSC::ProgramExecutable::initializeGlobalProperties):
+ * runtime/ProgramExecutable.h:
+
</ins><span class="cx"> 2016-11-30 JF Bastien <jfbastien@apple.com>
</span><span class="cx">
</span><span class="cx"> WebAssembly: update binary format to 0xD version
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeCodeCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/CodeCache.cpp (209195 => 209196)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/CodeCache.cpp        2016-12-01 21:22:07 UTC (rev 209195)
+++ trunk/Source/JavaScriptCore/runtime/CodeCache.cpp        2016-12-01 21:23:27 UTC (rev 209196)
</span><span class="lines">@@ -85,7 +85,7 @@
</span><span class="cx"> return getUnlinkedGlobalCodeBlock<UnlinkedProgramCodeBlock>(vm, executable, source, strictMode, JSParserScriptMode::Classic, debuggerMode, error, EvalContextType::None);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-UnlinkedEvalCodeBlock* CodeCache::getUnlinkedGlobalEvalCodeBlock(VM& vm, IndirectEvalExecutable* executable, const SourceCode& source, JSParserStrictMode strictMode, DebuggerMode debuggerMode, ParserError& error, EvalContextType evalContextType)
</del><ins>+UnlinkedEvalCodeBlock* CodeCache::getUnlinkedEvalCodeBlock(VM& vm, IndirectEvalExecutable* executable, const SourceCode& source, JSParserStrictMode strictMode, DebuggerMode debuggerMode, ParserError& error, EvalContextType evalContextType)
</ins><span class="cx"> {
</span><span class="cx"> return getUnlinkedGlobalCodeBlock<UnlinkedEvalCodeBlock>(vm, executable, source, strictMode, JSParserScriptMode::Classic, debuggerMode, error, evalContextType);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeCodeCacheh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/CodeCache.h (209195 => 209196)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/CodeCache.h        2016-12-01 21:22:07 UTC (rev 209195)
+++ trunk/Source/JavaScriptCore/runtime/CodeCache.h        2016-12-01 21:23:27 UTC (rev 209196)
</span><span class="lines">@@ -194,7 +194,7 @@
</span><span class="cx"> WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><span class="cx"> UnlinkedProgramCodeBlock* getUnlinkedProgramCodeBlock(VM&, ProgramExecutable*, const SourceCode&, JSParserStrictMode, DebuggerMode, ParserError&);
</span><del>- UnlinkedEvalCodeBlock* getUnlinkedGlobalEvalCodeBlock(VM&, IndirectEvalExecutable*, const SourceCode&, JSParserStrictMode, DebuggerMode, ParserError&, EvalContextType);
</del><ins>+ UnlinkedEvalCodeBlock* getUnlinkedEvalCodeBlock(VM&, IndirectEvalExecutable*, const SourceCode&, JSParserStrictMode, DebuggerMode, ParserError&, EvalContextType);
</ins><span class="cx"> UnlinkedModuleProgramCodeBlock* getUnlinkedModuleProgramCodeBlock(VM&, ModuleProgramExecutable*, const SourceCode&, DebuggerMode, ParserError&);
</span><span class="cx"> UnlinkedFunctionExecutable* getUnlinkedGlobalFunctionExecutable(VM&, const Identifier&, const SourceCode&, DebuggerMode, ParserError&);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeDirectEvalExecutablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/DirectEvalExecutable.cpp (209195 => 209196)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/DirectEvalExecutable.cpp        2016-12-01 21:22:07 UTC (rev 209195)
+++ trunk/Source/JavaScriptCore/runtime/DirectEvalExecutable.cpp        2016-12-01 21:23:27 UTC (rev 209196)
</span><span class="lines">@@ -26,9 +26,12 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "DirectEvalExecutable.h"
</span><span class="cx">
</span><ins>+#include "CodeCache.h"
+#include "Debugger.h"
</ins><span class="cx"> #include "Error.h"
</span><span class="cx"> #include "HeapInlines.h"
</span><span class="cx"> #include "JSCJSValueInlines.h"
</span><ins>+#include "ParserError.h"
</ins><span class="cx">
</span><span class="cx"> namespace JSC {
</span><span class="cx">
</span><span class="lines">@@ -46,11 +49,22 @@
</span><span class="cx"> auto* executable = new (NotNull, allocateCell<DirectEvalExecutable>(*exec->heap())) DirectEvalExecutable(exec, source, isInStrictContext, derivedContextType, isArrowFunctionContext, evalContextType);
</span><span class="cx"> executable->finishCreation(vm);
</span><span class="cx">
</span><del>- UnlinkedEvalCodeBlock* unlinkedEvalCode = globalObject->createLocalEvalCodeBlock(exec, executable, variablesUnderTDZ);
- ASSERT(!!scope.exception() == !unlinkedEvalCode);
- if (!unlinkedEvalCode)
- return 0;
</del><ins>+ ParserError error;
+ JSParserStrictMode strictMode = executable->isStrictMode() ? JSParserStrictMode::Strict : JSParserStrictMode::NotStrict;
+ DebuggerMode debuggerMode = globalObject->hasInteractiveDebugger() ? DebuggerOn : DebuggerOff;
</ins><span class="cx">
</span><ins>+ // We don't bother with CodeCache here because direct eval uses a specialized EvalCodeCache.
+ UnlinkedEvalCodeBlock* unlinkedEvalCode = generateUnlinkedCodeBlock<UnlinkedEvalCodeBlock>(
+ vm, executable, executable->source(), strictMode, JSParserScriptMode::Classic, debuggerMode, error, evalContextType, variablesUnderTDZ);
+
+ if (globalObject->hasDebugger())
+ globalObject->debugger()->sourceParsed(exec, executable->source().provider(), error.line(), error.message());
+
+ if (error.isValid()) {
+ throwVMError(exec, scope, error.toErrorObject(globalObject, executable->source()));
+ return nullptr;
+ }
+
</ins><span class="cx"> executable->m_unlinkedEvalCodeBlock.set(vm, executable, unlinkedEvalCode);
</span><span class="cx">
</span><span class="cx"> return executable;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeIndirectEvalExecutablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/IndirectEvalExecutable.cpp (209195 => 209196)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/IndirectEvalExecutable.cpp        2016-12-01 21:22:07 UTC (rev 209195)
+++ trunk/Source/JavaScriptCore/runtime/IndirectEvalExecutable.cpp        2016-12-01 21:23:27 UTC (rev 209196)
</span><span class="lines">@@ -26,9 +26,12 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "IndirectEvalExecutable.h"
</span><span class="cx">
</span><ins>+#include "CodeCache.h"
+#include "Debugger.h"
</ins><span class="cx"> #include "Error.h"
</span><span class="cx"> #include "HeapInlines.h"
</span><span class="cx"> #include "JSCJSValueInlines.h"
</span><ins>+#include "ParserError.h"
</ins><span class="cx">
</span><span class="cx"> namespace JSC {
</span><span class="cx">
</span><span class="lines">@@ -46,11 +49,21 @@
</span><span class="cx"> auto* executable = new (NotNull, allocateCell<IndirectEvalExecutable>(*exec->heap())) IndirectEvalExecutable(exec, source, isInStrictContext, derivedContextType, isArrowFunctionContext, evalContextType);
</span><span class="cx"> executable->finishCreation(vm);
</span><span class="cx">
</span><del>- UnlinkedEvalCodeBlock* unlinkedEvalCode = globalObject->createGlobalEvalCodeBlock(exec, executable);
- ASSERT(!!scope.exception() == !unlinkedEvalCode);
- if (!unlinkedEvalCode)
- return 0;
</del><ins>+ ParserError error;
+ JSParserStrictMode strictMode = executable->isStrictMode() ? JSParserStrictMode::Strict : JSParserStrictMode::NotStrict;
+ DebuggerMode debuggerMode = globalObject->hasInteractiveDebugger() ? DebuggerOn : DebuggerOff;
+
+ UnlinkedEvalCodeBlock* unlinkedEvalCode = vm.codeCache()->getUnlinkedEvalCodeBlock(
+ vm, executable, executable->source(), strictMode, debuggerMode, error, evalContextType);
</ins><span class="cx">
</span><ins>+ if (globalObject->hasDebugger())
+ globalObject->debugger()->sourceParsed(exec, executable->source().provider(), error.line(), error.message());
+
+ if (error.isValid()) {
+ throwVMError(exec, scope, error.toErrorObject(globalObject, executable->source()));
+ return nullptr;
+ }
+
</ins><span class="cx"> executable->m_unlinkedEvalCodeBlock.set(vm, executable, unlinkedEvalCode);
</span><span class="cx">
</span><span class="cx"> return executable;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp (209195 => 209196)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2016-12-01 21:22:07 UTC (rev 209195)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2016-12-01 21:23:27 UTC (rev 209196)
</span><span class="lines">@@ -1332,96 +1332,6 @@
</span><span class="cx"> ASSERT_GC_OBJECT_INHERITS(globalObject, JSGlobalObject::info());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-UnlinkedProgramCodeBlock* JSGlobalObject::createProgramCodeBlock(CallFrame* callFrame, ProgramExecutable* executable, JSObject** exception)
-{
- ParserError error;
- JSParserStrictMode strictMode = executable->isStrictMode() ? JSParserStrictMode::Strict : JSParserStrictMode::NotStrict;
- DebuggerMode debuggerMode = hasInteractiveDebugger() ? DebuggerOn : DebuggerOff;
- UnlinkedProgramCodeBlock* unlinkedCodeBlock = vm().codeCache()->getUnlinkedProgramCodeBlock(
- vm(), executable, executable->source(), strictMode,
- debuggerMode, error);
-
- if (hasDebugger())
- debugger()->sourceParsed(callFrame, executable->source().provider(), error.line(), error.message());
-
- if (error.isValid()) {
- *exception = error.toErrorObject(this, executable->source());
- return nullptr;
- }
-
- return unlinkedCodeBlock;
-}
-
-UnlinkedEvalCodeBlock* JSGlobalObject::createLocalEvalCodeBlock(CallFrame* callFrame, DirectEvalExecutable* executable, const VariableEnvironment* variablesUnderTDZ)
-{
- VM& vm = this->vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- ParserError error;
- JSParserStrictMode strictMode = executable->isStrictMode() ? JSParserStrictMode::Strict : JSParserStrictMode::NotStrict;
- DebuggerMode debuggerMode = hasInteractiveDebugger() ? DebuggerOn : DebuggerOff;
- EvalContextType evalContextType = executable->executableInfo().evalContextType();
-
- // We don't bother with CodeCache here because local eval uses a specialized EvalCodeCache.
- UnlinkedEvalCodeBlock* unlinkedCodeBlock = generateUnlinkedCodeBlock<UnlinkedEvalCodeBlock>(
- vm, executable, executable->source(), strictMode, JSParserScriptMode::Classic, debuggerMode, error, evalContextType, variablesUnderTDZ);
-
- if (hasDebugger())
- debugger()->sourceParsed(callFrame, executable->source().provider(), error.line(), error.message());
-
- if (error.isValid()) {
- throwVMError(callFrame, scope, error.toErrorObject(this, executable->source()));
- return nullptr;
- }
-
- return unlinkedCodeBlock;
-}
-
-UnlinkedEvalCodeBlock* JSGlobalObject::createGlobalEvalCodeBlock(CallFrame* callFrame, IndirectEvalExecutable* executable)
-{
- VM& vm = this->vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- ParserError error;
- JSParserStrictMode strictMode = executable->isStrictMode() ? JSParserStrictMode::Strict : JSParserStrictMode::NotStrict;
- DebuggerMode debuggerMode = hasInteractiveDebugger() ? DebuggerOn : DebuggerOff;
- EvalContextType evalContextType = executable->executableInfo().evalContextType();
-
- UnlinkedEvalCodeBlock* unlinkedCodeBlock = vm.codeCache()->getUnlinkedGlobalEvalCodeBlock(
- vm, executable, executable->source(), strictMode, debuggerMode, error, evalContextType);
-
- if (hasDebugger())
- debugger()->sourceParsed(callFrame, executable->source().provider(), error.line(), error.message());
-
- if (error.isValid()) {
- throwVMError(callFrame, scope, error.toErrorObject(this, executable->source()));
- return nullptr;
- }
-
- return unlinkedCodeBlock;
-}
-
-UnlinkedModuleProgramCodeBlock* JSGlobalObject::createModuleProgramCodeBlock(CallFrame* callFrame, ModuleProgramExecutable* executable)
-{
- VM& vm = this->vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- ParserError error;
- DebuggerMode debuggerMode = hasInteractiveDebugger() ? DebuggerOn : DebuggerOff;
- UnlinkedModuleProgramCodeBlock* unlinkedCodeBlock = vm.codeCache()->getUnlinkedModuleProgramCodeBlock(
- vm, executable, executable->source(), debuggerMode, error);
-
- if (hasDebugger())
- debugger()->sourceParsed(callFrame, executable->source().provider(), error.line(), error.message());
-
- if (error.isValid()) {
- throwVMError(callFrame, scope, error.toErrorObject(this, executable->source()));
- return nullptr;
- }
-
- return unlinkedCodeBlock;
-}
-
</del><span class="cx"> void JSGlobalObject::setRemoteDebuggingEnabled(bool enabled)
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(REMOTE_INSPECTOR)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h (209195 => 209196)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h        2016-12-01 21:22:07 UTC (rev 209195)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h        2016-12-01 21:23:27 UTC (rev 209196)
</span><span class="lines">@@ -834,11 +834,6 @@
</span><span class="cx"> unsigned weakRandomInteger() { return m_weakRandom.getUint32(); }
</span><span class="cx"> WeakRandom& weakRandom() { return m_weakRandom; }
</span><span class="cx">
</span><del>- UnlinkedProgramCodeBlock* createProgramCodeBlock(CallFrame*, ProgramExecutable*, JSObject** exception);
- UnlinkedEvalCodeBlock* createLocalEvalCodeBlock(CallFrame*, DirectEvalExecutable*, const VariableEnvironment*);
- UnlinkedEvalCodeBlock* createGlobalEvalCodeBlock(CallFrame*, IndirectEvalExecutable*);
- UnlinkedModuleProgramCodeBlock* createModuleProgramCodeBlock(CallFrame*, ModuleProgramExecutable*);
-
</del><span class="cx"> bool needsSiteSpecificQuirks() const { return m_needsSiteSpecificQuirks; }
</span><span class="cx">
</span><span class="cx"> protected:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeModuleProgramExecutablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/ModuleProgramExecutable.cpp (209195 => 209196)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ModuleProgramExecutable.cpp        2016-12-01 21:22:07 UTC (rev 209195)
+++ trunk/Source/JavaScriptCore/runtime/ModuleProgramExecutable.cpp        2016-12-01 21:23:27 UTC (rev 209196)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx">
</span><span class="cx"> #include "BatchedTransitionOptimizer.h"
</span><span class="cx"> #include "CodeBlock.h"
</span><ins>+#include "CodeCache.h"
</ins><span class="cx"> #include "Debugger.h"
</span><span class="cx"> #include "JIT.h"
</span><span class="cx"> #include "JSCInlines.h"
</span><span class="lines">@@ -53,13 +54,26 @@
</span><span class="cx">
</span><span class="cx"> ModuleProgramExecutable* ModuleProgramExecutable::create(ExecState* exec, const SourceCode& source)
</span><span class="cx"> {
</span><ins>+ VM& vm = exec->vm();
+ auto scope = DECLARE_THROW_SCOPE(vm);
+
</ins><span class="cx"> JSGlobalObject* globalObject = exec->lexicalGlobalObject();
</span><span class="cx"> ModuleProgramExecutable* executable = new (NotNull, allocateCell<ModuleProgramExecutable>(*exec->heap())) ModuleProgramExecutable(exec, source);
</span><span class="cx"> executable->finishCreation(exec->vm());
</span><span class="cx">
</span><del>- UnlinkedModuleProgramCodeBlock* unlinkedModuleProgramCode = globalObject->createModuleProgramCodeBlock(exec, executable);
- if (!unlinkedModuleProgramCode)
</del><ins>+ ParserError error;
+ DebuggerMode debuggerMode = globalObject->hasInteractiveDebugger() ? DebuggerOn : DebuggerOff;
+ UnlinkedModuleProgramCodeBlock* unlinkedModuleProgramCode = vm.codeCache()->getUnlinkedModuleProgramCodeBlock(
+ vm, executable, executable->source(), debuggerMode, error);
+
+ if (globalObject->hasDebugger())
+ globalObject->debugger()->sourceParsed(exec, executable->source().provider(), error.line(), error.message());
+
+ if (error.isValid()) {
+ throwVMError(exec, scope, error.toErrorObject(globalObject, executable->source()));
</ins><span class="cx"> return nullptr;
</span><ins>+ }
+
</ins><span class="cx"> executable->m_unlinkedModuleProgramCodeBlock.set(exec->vm(), executable, unlinkedModuleProgramCode);
</span><span class="cx">
</span><span class="cx"> executable->m_moduleEnvironmentSymbolTable.set(exec->vm(), executable, jsCast<SymbolTable*>(unlinkedModuleProgramCode->constantRegister(unlinkedModuleProgramCode->moduleEnvironmentSymbolTableConstantRegisterOffset()).get())->cloneScopePart(exec->vm()));
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeProgramExecutablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/ProgramExecutable.cpp (209195 => 209196)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ProgramExecutable.cpp        2016-12-01 21:22:07 UTC (rev 209195)
+++ trunk/Source/JavaScriptCore/runtime/ProgramExecutable.cpp        2016-12-01 21:23:27 UTC (rev 209196)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx">
</span><span class="cx"> #include "BatchedTransitionOptimizer.h"
</span><span class="cx"> #include "CodeBlock.h"
</span><ins>+#include "CodeCache.h"
</ins><span class="cx"> #include "Debugger.h"
</span><span class="cx"> #include "Exception.h"
</span><span class="cx"> #include "JIT.h"
</span><span class="lines">@@ -79,6 +80,19 @@
</span><span class="cx"> RELEASE_ASSERT(globalObject);
</span><span class="cx"> ASSERT(&globalObject->vm() == &vm);
</span><span class="cx">
</span><ins>+ ParserError error;
+ JSParserStrictMode strictMode = isStrictMode() ? JSParserStrictMode::Strict : JSParserStrictMode::NotStrict;
+ DebuggerMode debuggerMode = globalObject->hasInteractiveDebugger() ? DebuggerOn : DebuggerOff;
+
+ UnlinkedProgramCodeBlock* unlinkedCodeBlock = vm.codeCache()->getUnlinkedProgramCodeBlock(
+ vm, this, source(), strictMode, debuggerMode, error);
+
+ if (globalObject->hasDebugger())
+ globalObject->debugger()->sourceParsed(callFrame, source().provider(), error.line(), error.message());
+
+ if (error.isValid())
+ return error.toErrorObject(globalObject, source());
+
</ins><span class="cx"> JSValue nextPrototype = globalObject->getPrototypeDirect();
</span><span class="cx"> while (nextPrototype && nextPrototype.isObject()) {
</span><span class="cx"> if (UNLIKELY(asObject(nextPrototype)->type() == ProxyObjectType)) {
</span><span class="lines">@@ -88,11 +102,6 @@
</span><span class="cx"> nextPrototype = asObject(nextPrototype)->getPrototypeDirect();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- JSObject* exception = nullptr;
- UnlinkedProgramCodeBlock* unlinkedCodeBlock = globalObject->createProgramCodeBlock(callFrame, this, &exception);
- if (UNLIKELY(exception))
- return exception;
-
</del><span class="cx"> JSGlobalLexicalEnvironment* globalLexicalEnvironment = globalObject->globalLexicalEnvironment();
</span><span class="cx"> const VariableEnvironment& variableDeclarations = unlinkedCodeBlock->variableDeclarations();
</span><span class="cx"> const VariableEnvironment& lexicalDeclarations = unlinkedCodeBlock->lexicalDeclarations();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeProgramExecutableh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/ProgramExecutable.h (209195 => 209196)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ProgramExecutable.h        2016-12-01 21:22:07 UTC (rev 209195)
+++ trunk/Source/JavaScriptCore/runtime/ProgramExecutable.h        2016-12-01 21:23:27 UTC (rev 209196)
</span><span class="lines">@@ -42,7 +42,6 @@
</span><span class="cx"> return executable;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-
</del><span class="cx"> JSObject* initializeGlobalProperties(VM&, CallFrame*, JSScope*);
</span><span class="cx">
</span><span class="cx"> static void destroy(JSCell*);
</span></span></pre>
</div>
</div>
</body>
</html>