<!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>[209500] 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/209500">209500</a></dd>
<dt>Author</dt> <dd>utatane.tea@gmail.com</dd>
<dt>Date</dt> <dd>2016-12-07 17:02:13 -0800 (Wed, 07 Dec 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[JSC] Drop translate phase in module loader
https://bugs.webkit.org/show_bug.cgi?id=164861

Reviewed by Saam Barati.

Source/JavaScriptCore:

Originally, this &quot;translate&quot; phase was introduced to the module loader.
However, recent rework discussion[1] starts dropping this phase.
And this &quot;translate&quot; phase is meaningless in the browser side module loader
since this phase originally mimics the node.js's translation hook (like,
transpiling CoffeeScript source to JavaScript).

This &quot;translate&quot; phase is not necessary for the exposed HTML5
&lt;script type=&quot;module&quot;&gt; tag right now. Once the module loader pipeline is
redefined and specified, we need to update the current loader anyway.
So dropping &quot;translate&quot; phase right now is OK.

This a bit simplifies the current module loader pipeline.

[1]: https://github.com/whatwg/loader/issues/147

* builtins/ModuleLoaderPrototype.js:
(newRegistryEntry):
(fulfillFetch):
(requestFetch):
(requestInstantiate):
(provide):
(fulfillTranslate): Deleted.
(requestTranslate): Deleted.
* bytecode/BytecodeIntrinsicRegistry.cpp:
(JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry):
* jsc.cpp:
* runtime/JSGlobalObject.cpp:
* runtime/JSGlobalObject.h:
* runtime/JSModuleLoader.cpp:
(JSC::JSModuleLoader::translate): Deleted.
* runtime/JSModuleLoader.h:
* runtime/ModuleLoaderPrototype.cpp:
(JSC::moduleLoaderPrototypeInstantiate):
(JSC::moduleLoaderPrototypeTranslate): Deleted.

Source/WebCore:

* bindings/js/JSDOMWindowBase.cpp:
* bindings/js/JSWorkerGlobalScopeBase.cpp:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebuiltinsModuleLoaderPrototypejs">trunk/Source/JavaScriptCore/builtins/ModuleLoaderPrototype.js</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeBytecodeIntrinsicRegistrycpp">trunk/Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejsccpp">trunk/Source/JavaScriptCore/jsc.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="#trunkSourceJavaScriptCoreruntimeJSModuleLoadercpp">trunk/Source/JavaScriptCore/runtime/JSModuleLoader.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSModuleLoaderh">trunk/Source/JavaScriptCore/runtime/JSModuleLoader.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeModuleLoaderPrototypecpp">trunk/Source/JavaScriptCore/runtime/ModuleLoaderPrototype.cpp</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMWindowBasecpp">trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSWorkerGlobalScopeBasecpp">trunk/Source/WebCore/bindings/js/JSWorkerGlobalScopeBase.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (209499 => 209500)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-12-08 00:50:17 UTC (rev 209499)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-12-08 01:02:13 UTC (rev 209500)
</span><span class="lines">@@ -1,3 +1,45 @@
</span><ins>+2016-12-07  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
+
+        [JSC] Drop translate phase in module loader
+        https://bugs.webkit.org/show_bug.cgi?id=164861
+
+        Reviewed by Saam Barati.
+
+        Originally, this &quot;translate&quot; phase was introduced to the module loader.
+        However, recent rework discussion[1] starts dropping this phase.
+        And this &quot;translate&quot; phase is meaningless in the browser side module loader
+        since this phase originally mimics the node.js's translation hook (like,
+        transpiling CoffeeScript source to JavaScript).
+
+        This &quot;translate&quot; phase is not necessary for the exposed HTML5
+        &lt;script type=&quot;module&quot;&gt; tag right now. Once the module loader pipeline is
+        redefined and specified, we need to update the current loader anyway.
+        So dropping &quot;translate&quot; phase right now is OK.
+
+        This a bit simplifies the current module loader pipeline.
+
+        [1]: https://github.com/whatwg/loader/issues/147
+
+        * builtins/ModuleLoaderPrototype.js:
+        (newRegistryEntry):
+        (fulfillFetch):
+        (requestFetch):
+        (requestInstantiate):
+        (provide):
+        (fulfillTranslate): Deleted.
+        (requestTranslate): Deleted.
+        * bytecode/BytecodeIntrinsicRegistry.cpp:
+        (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry):
+        * jsc.cpp:
+        * runtime/JSGlobalObject.cpp:
+        * runtime/JSGlobalObject.h:
+        * runtime/JSModuleLoader.cpp:
+        (JSC::JSModuleLoader::translate): Deleted.
+        * runtime/JSModuleLoader.h:
+        * runtime/ModuleLoaderPrototype.cpp:
+        (JSC::moduleLoaderPrototypeInstantiate):
+        (JSC::moduleLoaderPrototypeTranslate): Deleted.
+
</ins><span class="cx"> 2016-12-07  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Add ability to distinguish if a Script was parsed as a module
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebuiltinsModuleLoaderPrototypejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/builtins/ModuleLoaderPrototype.js (209499 => 209500)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/builtins/ModuleLoaderPrototype.js        2016-12-08 00:50:17 UTC (rev 209499)
+++ trunk/Source/JavaScriptCore/builtins/ModuleLoaderPrototype.js        2016-12-08 01:02:13 UTC (rev 209500)
</span><span class="lines">@@ -30,8 +30,7 @@
</span><span class="cx"> // Currently, there are 4 hooks.
</span><span class="cx"> //    1. Loader.resolve
</span><span class="cx"> //    2. Loader.fetch
</span><del>-//    3. Loader.translate
-//    4. Loader.instantiate
</del><ins>+//    3. Loader.instantiate
</ins><span class="cx"> 
</span><span class="cx"> function setStateToMax(entry, newState)
</span><span class="cx"> {
</span><span class="lines">@@ -54,22 +53,15 @@
</span><span class="cx">     //     a. If the status is Fetch and there is no entry.fetch promise, the entry is ready to fetch.
</span><span class="cx">     //     b. If the status is Fetch and there is the entry.fetch promise, the entry is just fetching the resource.
</span><span class="cx">     //
</span><del>-    // 2. Translate
-    //     Ready to translate (or now translating) the raw fetched resource to the ECMAScript source code.
-    //     We can insert the hook that translates the resources e.g. transpilers.
-    //     a. If the status is Translate and there is no entry.translate promise, the entry is ready to translate.
-    //     b. If the status is Translate and there is the entry.translate promise, the entry is just translating
-    //        the payload to the source code.
-    //
-    // 3. Instantiate (AnalyzeModule)
-    //     Ready to instantiate (or now instantiating) the module record from the fetched (and translated)
</del><ins>+    // 2. Instantiate (AnalyzeModule)
+    //     Ready to instantiate (or now instantiating) the module record from the fetched
</ins><span class="cx">     //     source code.
</span><span class="cx">     //     Typically, we parse the module code, extract the dependencies and binding information.
</span><span class="cx">     //     a. If the status is Instantiate and there is no entry.instantiate promise, the entry is ready to instantiate.
</span><del>-    //     b. If the status is Instantiate and there is the entry.translate promise, the entry is just instantiating
</del><ins>+    //     b. If the status is Instantiate and there is the entry.fetch promise, the entry is just instantiating
</ins><span class="cx">     //        the module record.
</span><span class="cx">     //
</span><del>-    // 4. Satisfy
</del><ins>+    // 3. Satisfy
</ins><span class="cx">     //     Ready to request the dependent modules (or now requesting &amp; resolving).
</span><span class="cx">     //     Without this state, the current draft causes infinite recursion when there is circular dependency.
</span><span class="cx">     //     a. If the status is Satisfy and there is no entry.satisfy promise, the entry is ready to resolve the dependencies.
</span><span class="lines">@@ -76,14 +68,14 @@
</span><span class="cx">     //     b. If the status is Satisfy and there is the entry.satisfy promise, the entry is just resolving
</span><span class="cx">     //        the dependencies.
</span><span class="cx">     //
</span><del>-    // 5. Link
</del><ins>+    // 4. Link
</ins><span class="cx">     //     Ready to link the module with the other modules.
</span><span class="cx">     //     Linking means that the module imports and exports the bindings from/to the other modules.
</span><span class="cx">     //
</span><del>-    // 6. Ready
</del><ins>+    // 5. Ready
</ins><span class="cx">     //     The module is linked, so the module is ready to be executed.
</span><span class="cx">     //
</span><del>-    // Each registry entry has the 4 promises; &quot;fetch&quot;, &quot;translate&quot;, &quot;instantiate&quot; and &quot;satisfy&quot;.
</del><ins>+    // Each registry entry has the 4 promises; &quot;fetch&quot;, &quot;instantiate&quot; and &quot;satisfy&quot;.
</ins><span class="cx">     // They are assigned when starting the each phase. And they are fulfilled when the each phase is completed.
</span><span class="cx">     //
</span><span class="cx">     // In the current module draft, linking will be performed after the whole modules are instantiated and the dependencies are resolved.
</span><span class="lines">@@ -100,7 +92,6 @@
</span><span class="cx">         state: @ModuleFetch,
</span><span class="cx">         metadata: @undefined,
</span><span class="cx">         fetch: @undefined,
</span><del>-        translate: @undefined,
</del><span class="cx">         instantiate: @undefined,
</span><span class="cx">         satisfy: @undefined,
</span><span class="cx">         dependencies: [], // To keep the module order, we store the module keys in the array.
</span><span class="lines">@@ -143,18 +134,6 @@
</span><span class="cx">     if (!entry.fetch)
</span><span class="cx">         entry.fetch = @newPromiseCapability(@InternalPromise).@promise;
</span><span class="cx">     this.forceFulfillPromise(entry.fetch, payload);
</span><del>-    this.setStateToMax(entry, @ModuleTranslate);
-}
-
-function fulfillTranslate(entry, source)
-{
-    // https://whatwg.github.io/loader/#fulfill-translate
-
-    &quot;use strict&quot;;
-
-    if (!entry.translate)
-        entry.translate = @newPromiseCapability(@InternalPromise).@promise;
-    this.forceFulfillPromise(entry.translate, source);
</del><span class="cx">     this.setStateToMax(entry, @ModuleInstantiate);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -240,7 +219,7 @@
</span><span class="cx">     //     For example, JavaScriptCore shell can provide the hook fetching the resource
</span><span class="cx">     //     from the local file system.
</span><span class="cx">     var fetchPromise = this.fetch(key, initiator).then((payload) =&gt; {
</span><del>-        this.setStateToMax(entry, @ModuleTranslate);
</del><ins>+        this.setStateToMax(entry, @ModuleInstantiate);
</ins><span class="cx">         return payload;
</span><span class="cx">     });
</span><span class="cx">     entry.fetch = fetchPromise;
</span><span class="lines">@@ -247,31 +226,6 @@
</span><span class="cx">     return fetchPromise;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function requestTranslate(key, initiator)
-{
-    // https://whatwg.github.io/loader/#request-translate
-
-    &quot;use strict&quot;;
-
-    var entry = this.ensureRegistered(key);
-    if (entry.translate)
-        return entry.translate;
-
-    var translatePromise = this.requestFetch(key, initiator).then((payload) =&gt; {
-        // Hook point.
-        // 3. Loader.translate
-        //     https://whatwg.github.io/loader/#browser-translate
-        //     Take the key and the fetched source code and translate it to the ES6 source code.
-        //     Typically it is used by the transpilers.
-        return this.translate(key, payload, initiator).then((source) =&gt; {
-            this.setStateToMax(entry, @ModuleInstantiate);
-            return source;
-        });
-    });
-    entry.translate = translatePromise;
-    return translatePromise;
-}
-
</del><span class="cx"> function requestInstantiate(key, initiator)
</span><span class="cx"> {
</span><span class="cx">     // https://whatwg.github.io/loader/#request-instantiate
</span><span class="lines">@@ -282,11 +236,11 @@
</span><span class="cx">     if (entry.instantiate)
</span><span class="cx">         return entry.instantiate;
</span><span class="cx"> 
</span><del>-    var instantiatePromise = this.requestTranslate(key, initiator).then((source) =&gt; {
</del><ins>+    var instantiatePromise = this.requestFetch(key, initiator).then((source) =&gt; {
</ins><span class="cx">         // Hook point.
</span><del>-        // 4. Loader.instantiate
</del><ins>+        // 3. Loader.instantiate
</ins><span class="cx">         //     https://whatwg.github.io/loader/#browser-instantiate
</span><del>-        //     Take the key and the translated source code, and instantiate the module record
</del><ins>+        //     Take the key and the fetched source code, and instantiate the module record
</ins><span class="cx">         //     by parsing the module source code.
</span><span class="cx">         //     It has the chance to provide the optional module instance that is different from
</span><span class="cx">         //     the ordinary one.
</span><span class="lines">@@ -462,20 +416,11 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (stage === @ModuleTranslate) {
-        if (entry.state &gt; @ModuleTranslate)
-            @throwTypeError(&quot;Requested module is already translated.&quot;);
-        this.fulfillFetch(entry, @undefined);
-        this.fulfillTranslate(entry, value);
-        return;
-    }
-
</del><span class="cx">     if (stage === @ModuleInstantiate) {
</span><span class="cx">         if (entry.state &gt; @ModuleInstantiate)
</span><span class="cx">             @throwTypeError(&quot;Requested module is already instantiated.&quot;);
</span><span class="cx">         this.fulfillFetch(entry, @undefined);
</span><del>-        this.fulfillTranslate(entry, value);
-        entry.translate.then((source) =&gt; {
</del><ins>+        entry.fetch.then((source) =&gt; {
</ins><span class="cx">             this.fulfillInstantiate(entry, value, source);
</span><span class="cx">         });
</span><span class="cx">         return;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeBytecodeIntrinsicRegistrycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.cpp (209499 => 209500)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.cpp        2016-12-08 00:50:17 UTC (rev 209499)
+++ trunk/Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.cpp        2016-12-08 01:02:13 UTC (rev 209500)
</span><span class="lines">@@ -56,7 +56,6 @@
</span><span class="cx">     m_MAX_STRING_LENGTH.set(m_vm, jsNumber(JSString::MaxLength));
</span><span class="cx">     m_MAX_SAFE_INTEGER.set(m_vm, jsDoubleNumber(maxSafeInteger()));
</span><span class="cx">     m_ModuleFetch.set(m_vm, jsNumber(static_cast&lt;unsigned&gt;(JSModuleLoader::Status::Fetch)));
</span><del>-    m_ModuleTranslate.set(m_vm, jsNumber(static_cast&lt;unsigned&gt;(JSModuleLoader::Status::Translate)));
</del><span class="cx">     m_ModuleInstantiate.set(m_vm, jsNumber(static_cast&lt;unsigned&gt;(JSModuleLoader::Status::Instantiate)));
</span><span class="cx">     m_ModuleSatisfy.set(m_vm, jsNumber(static_cast&lt;unsigned&gt;(JSModuleLoader::Status::Satisfy)));
</span><span class="cx">     m_ModuleLink.set(m_vm, jsNumber(static_cast&lt;unsigned&gt;(JSModuleLoader::Status::Link)));
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejsccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jsc.cpp (209499 => 209500)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jsc.cpp        2016-12-08 00:50:17 UTC (rev 209499)
+++ trunk/Source/JavaScriptCore/jsc.cpp        2016-12-08 01:02:13 UTC (rev 209500)
</span><span class="lines">@@ -1279,9 +1279,19 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> const ClassInfo GlobalObject::s_info = { &quot;global&quot;, &amp;JSGlobalObject::s_info, nullptr, CREATE_METHOD_TABLE(GlobalObject) };
</span><del>-const GlobalObjectMethodTable GlobalObject::s_globalObjectMethodTable = { &amp;supportsRichSourceInfo, &amp;shouldInterruptScript, &amp;javaScriptRuntimeFlags, 0, &amp;shouldInterruptScriptBeforeTimeout, &amp;moduleLoaderResolve, &amp;moduleLoaderFetch, nullptr, nullptr, nullptr, nullptr };
</del><ins>+const GlobalObjectMethodTable GlobalObject::s_globalObjectMethodTable = {
+    &amp;supportsRichSourceInfo,
+    &amp;shouldInterruptScript,
+    &amp;javaScriptRuntimeFlags,
+    nullptr,
+    &amp;shouldInterruptScriptBeforeTimeout,
+    &amp;moduleLoaderResolve,
+    &amp;moduleLoaderFetch,
+    nullptr,
+    nullptr,
+    nullptr
+};
</ins><span class="cx"> 
</span><del>-
</del><span class="cx"> GlobalObject::GlobalObject(VM&amp; vm, Structure* structure)
</span><span class="cx">     : JSGlobalObject(vm, structure, &amp;s_globalObjectMethodTable)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp (209499 => 209500)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2016-12-08 00:50:17 UTC (rev 209499)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2016-12-08 01:02:13 UTC (rev 209500)
</span><span class="lines">@@ -246,7 +246,18 @@
</span><span class="cx"> 
</span><span class="cx"> const ClassInfo JSGlobalObject::s_info = { &quot;GlobalObject&quot;, &amp;Base::s_info, &amp;globalObjectTable, CREATE_METHOD_TABLE(JSGlobalObject) };
</span><span class="cx"> 
</span><del>-const GlobalObjectMethodTable JSGlobalObject::s_globalObjectMethodTable = { &amp;supportsRichSourceInfo, &amp;shouldInterruptScript, &amp;javaScriptRuntimeFlags, nullptr, &amp;shouldInterruptScriptBeforeTimeout, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };
</del><ins>+const GlobalObjectMethodTable JSGlobalObject::s_globalObjectMethodTable = {
+    &amp;supportsRichSourceInfo,
+    &amp;shouldInterruptScript,
+    &amp;javaScriptRuntimeFlags,
+    nullptr,
+    &amp;shouldInterruptScriptBeforeTimeout,
+    nullptr,
+    nullptr,
+    nullptr,
+    nullptr,
+    nullptr
+};
</ins><span class="cx"> 
</span><span class="cx"> /* Source for JSGlobalObject.lut.h
</span><span class="cx"> @begin globalObjectTable
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h (209499 => 209500)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h        2016-12-08 00:50:17 UTC (rev 209499)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h        2016-12-08 01:02:13 UTC (rev 209500)
</span><span class="lines">@@ -189,9 +189,6 @@
</span><span class="cx">     typedef JSInternalPromise* (*ModuleLoaderFetchPtr)(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue);
</span><span class="cx">     ModuleLoaderFetchPtr moduleLoaderFetch;
</span><span class="cx"> 
</span><del>-    typedef JSInternalPromise* (*ModuleLoaderTranslatePtr)(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue, JSValue);
-    ModuleLoaderTranslatePtr moduleLoaderTranslate;
-
</del><span class="cx">     typedef JSInternalPromise* (*ModuleLoaderInstantiatePtr)(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue, JSValue);
</span><span class="cx">     ModuleLoaderInstantiatePtr moduleLoaderInstantiate;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSModuleLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSModuleLoader.cpp (209499 => 209500)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSModuleLoader.cpp        2016-12-08 00:50:17 UTC (rev 209499)
+++ trunk/Source/JavaScriptCore/runtime/JSModuleLoader.cpp        2016-12-08 01:02:13 UTC (rev 209500)
</span><span class="lines">@@ -169,19 +169,6 @@
</span><span class="cx">     return deferred-&gt;promise();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-JSInternalPromise* JSModuleLoader::translate(ExecState* exec, JSValue key, JSValue payload, JSValue initiator)
-{
-    if (Options::dumpModuleLoadingState())
-        dataLog(&quot;Loader [translate] &quot;, printableModuleKey(exec, key), &quot;\n&quot;);
-
-    JSGlobalObject* globalObject = exec-&gt;lexicalGlobalObject();
-    if (globalObject-&gt;globalObjectMethodTable()-&gt;moduleLoaderTranslate)
-        return globalObject-&gt;globalObjectMethodTable()-&gt;moduleLoaderTranslate(globalObject, exec, this, key, payload, initiator);
-    JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject);
-    deferred-&gt;resolve(exec, payload);
-    return deferred-&gt;promise();
-}
-
</del><span class="cx"> JSInternalPromise* JSModuleLoader::instantiate(ExecState* exec, JSValue key, JSValue source, JSValue initiator)
</span><span class="cx"> {
</span><span class="cx">     if (Options::dumpModuleLoadingState())
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSModuleLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSModuleLoader.h (209499 => 209500)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSModuleLoader.h        2016-12-08 00:50:17 UTC (rev 209499)
+++ trunk/Source/JavaScriptCore/runtime/JSModuleLoader.h        2016-12-08 01:02:13 UTC (rev 209500)
</span><span class="lines">@@ -40,11 +40,10 @@
</span><span class="cx"> 
</span><span class="cx">     enum Status {
</span><span class="cx">         Fetch = 1,
</span><del>-        Translate = 2,
-        Instantiate = 3,
-        Satisfy = 4,
-        Link = 5,
-        Ready = 6,
</del><ins>+        Instantiate,
+        Satisfy,
+        Link,
+        Ready,
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     static JSModuleLoader* create(ExecState* exec, VM&amp; vm, JSGlobalObject* globalObject, Structure* structure)
</span><span class="lines">@@ -70,7 +69,6 @@
</span><span class="cx">     // Platform dependent hooked APIs.
</span><span class="cx">     JSInternalPromise* resolve(ExecState*, JSValue name, JSValue referrer, JSValue initiator);
</span><span class="cx">     JSInternalPromise* fetch(ExecState*, JSValue key, JSValue initiator);
</span><del>-    JSInternalPromise* translate(ExecState*, JSValue key, JSValue payload, JSValue initiator);
</del><span class="cx">     JSInternalPromise* instantiate(ExecState*, JSValue key, JSValue source, JSValue initiator);
</span><span class="cx"> 
</span><span class="cx">     // Additional platform dependent hooked APIs.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeModuleLoaderPrototypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/ModuleLoaderPrototype.cpp (209499 => 209500)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ModuleLoaderPrototype.cpp        2016-12-08 00:50:17 UTC (rev 209499)
+++ trunk/Source/JavaScriptCore/runtime/ModuleLoaderPrototype.cpp        2016-12-08 01:02:13 UTC (rev 209500)
</span><span class="lines">@@ -51,7 +51,6 @@
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeModuleDeclarationInstantiation(ExecState*);
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeResolve(ExecState*);
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeFetch(ExecState*);
</span><del>-static EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeTranslate(ExecState*);
</del><span class="cx"> static EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeInstantiate(ExecState*);
</span><span class="cx"> 
</span><span class="cx"> }
</span><span class="lines">@@ -71,12 +70,10 @@
</span><span class="cx">     ensureRegistered               JSBuiltin                                           DontEnum|Function 1
</span><span class="cx">     forceFulfillPromise            JSBuiltin                                           DontEnum|Function 2
</span><span class="cx">     fulfillFetch                   JSBuiltin                                           DontEnum|Function 2
</span><del>-    fulfillTranslate               JSBuiltin                                           DontEnum|Function 2
</del><span class="cx">     fulfillInstantiate             JSBuiltin                                           DontEnum|Function 2
</span><span class="cx">     commitInstantiated             JSBuiltin                                           DontEnum|Function 3
</span><span class="cx">     instantiation                  JSBuiltin                                           DontEnum|Function 3
</span><span class="cx">     requestFetch                   JSBuiltin                                           DontEnum|Function 2
</span><del>-    requestTranslate               JSBuiltin                                           DontEnum|Function 2
</del><span class="cx">     requestInstantiate             JSBuiltin                                           DontEnum|Function 2
</span><span class="cx">     requestSatisfy                 JSBuiltin                                           DontEnum|Function 2
</span><span class="cx">     requestInstantiateAll          JSBuiltin                                           DontEnum|Function 2
</span><span class="lines">@@ -94,7 +91,6 @@
</span><span class="cx">     requestedModules               moduleLoaderPrototypeRequestedModules               DontEnum|Function 1
</span><span class="cx">     resolve                        moduleLoaderPrototypeResolve                        DontEnum|Function 2
</span><span class="cx">     fetch                          moduleLoaderPrototypeFetch                          DontEnum|Function 2
</span><del>-    translate                      moduleLoaderPrototypeTranslate                      DontEnum|Function 3
</del><span class="cx">     instantiate                    moduleLoaderPrototypeInstantiate                    DontEnum|Function 3
</span><span class="cx"> @end
</span><span class="cx"> */
</span><span class="lines">@@ -203,23 +199,11 @@
</span><span class="cx">     return JSValue::encode(loader-&gt;fetch(exec, exec-&gt;argument(0), exec-&gt;argument(1)));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeTranslate(ExecState* exec)
-{
-    // Hook point, Loader.translate
-    // https://whatwg.github.io/loader/#browser-translate
-    // Take the key and the fetched source code and translate it to the ES6 source code.
-    // Typically it is used by the transpilers.
-    JSModuleLoader* loader = jsDynamicCast&lt;JSModuleLoader*&gt;(exec-&gt;thisValue());
-    if (!loader)
-        return JSValue::encode(jsUndefined());
-    return JSValue::encode(loader-&gt;translate(exec, exec-&gt;argument(0), exec-&gt;argument(1), exec-&gt;argument(2)));
-}
-
</del><span class="cx"> EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeInstantiate(ExecState* exec)
</span><span class="cx"> {
</span><span class="cx">     // Hook point, Loader.instantiate
</span><span class="cx">     // https://whatwg.github.io/loader/#browser-instantiate
</span><del>-    // Take the key and the translated source code, and instantiate the module record
</del><ins>+    // Take the key and the fetched source code, and instantiate the module record
</ins><span class="cx">     // by parsing the module source code.
</span><span class="cx">     // It has the chance to provide the optional module instance that is different from
</span><span class="cx">     // the ordinary one.
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (209499 => 209500)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-12-08 00:50:17 UTC (rev 209499)
+++ trunk/Source/WebCore/ChangeLog        2016-12-08 01:02:13 UTC (rev 209500)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2016-12-07  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
+
+        [JSC] Drop translate phase in module loader
+        https://bugs.webkit.org/show_bug.cgi?id=164861
+
+        Reviewed by Saam Barati.
+
+        * bindings/js/JSDOMWindowBase.cpp:
+        * bindings/js/JSWorkerGlobalScopeBase.cpp:
+
</ins><span class="cx"> 2016-12-07  Keith Rollin  &lt;krollin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Network event record/replay
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMWindowBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp (209499 => 209500)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp        2016-12-08 00:50:17 UTC (rev 209499)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp        2016-12-08 01:02:13 UTC (rev 209500)
</span><span class="lines">@@ -57,7 +57,18 @@
</span><span class="cx"> 
</span><span class="cx"> const ClassInfo JSDOMWindowBase::s_info = { &quot;Window&quot;, &amp;JSDOMGlobalObject::s_info, 0, CREATE_METHOD_TABLE(JSDOMWindowBase) };
</span><span class="cx"> 
</span><del>-const GlobalObjectMethodTable JSDOMWindowBase::s_globalObjectMethodTable = { &amp;supportsRichSourceInfo, &amp;shouldInterruptScript, &amp;javaScriptRuntimeFlags, &amp;queueTaskToEventLoop, &amp;shouldInterruptScriptBeforeTimeout, &amp;moduleLoaderResolve, &amp;moduleLoaderFetch, nullptr, nullptr, &amp;moduleLoaderEvaluate, &amp;defaultLanguage };
</del><ins>+const GlobalObjectMethodTable JSDOMWindowBase::s_globalObjectMethodTable = {
+    &amp;supportsRichSourceInfo,
+    &amp;shouldInterruptScript,
+    &amp;javaScriptRuntimeFlags,
+    &amp;queueTaskToEventLoop,
+    &amp;shouldInterruptScriptBeforeTimeout,
+    &amp;moduleLoaderResolve,
+    &amp;moduleLoaderFetch,
+    nullptr,
+    &amp;moduleLoaderEvaluate,
+    &amp;defaultLanguage
+};
</ins><span class="cx"> 
</span><span class="cx"> JSDOMWindowBase::JSDOMWindowBase(VM&amp; vm, Structure* structure, RefPtr&lt;DOMWindow&gt;&amp;&amp; window, JSDOMWindowShell* shell)
</span><span class="cx">     : JSDOMGlobalObject(vm, structure, shell-&gt;world(), &amp;s_globalObjectMethodTable)
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSWorkerGlobalScopeBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSWorkerGlobalScopeBase.cpp (209499 => 209500)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSWorkerGlobalScopeBase.cpp        2016-12-08 00:50:17 UTC (rev 209499)
+++ trunk/Source/WebCore/bindings/js/JSWorkerGlobalScopeBase.cpp        2016-12-08 01:02:13 UTC (rev 209500)
</span><span class="lines">@@ -47,7 +47,18 @@
</span><span class="cx"> 
</span><span class="cx"> const ClassInfo JSWorkerGlobalScopeBase::s_info = { &quot;WorkerGlobalScope&quot;, &amp;JSDOMGlobalObject::s_info, 0, CREATE_METHOD_TABLE(JSWorkerGlobalScopeBase) };
</span><span class="cx"> 
</span><del>-const GlobalObjectMethodTable JSWorkerGlobalScopeBase::s_globalObjectMethodTable = { &amp;supportsRichSourceInfo, &amp;shouldInterruptScript, &amp;javaScriptRuntimeFlags, &amp;queueTaskToEventLoop, &amp;shouldInterruptScriptBeforeTimeout, nullptr, nullptr, nullptr, nullptr, nullptr, &amp;defaultLanguage };
</del><ins>+const GlobalObjectMethodTable JSWorkerGlobalScopeBase::s_globalObjectMethodTable = {
+    &amp;supportsRichSourceInfo,
+    &amp;shouldInterruptScript,
+    &amp;javaScriptRuntimeFlags,
+    &amp;queueTaskToEventLoop,
+    &amp;shouldInterruptScriptBeforeTimeout,
+    nullptr,
+    nullptr,
+    nullptr,
+    nullptr,
+    &amp;defaultLanguage
+};
</ins><span class="cx"> 
</span><span class="cx"> JSWorkerGlobalScopeBase::JSWorkerGlobalScopeBase(JSC::VM&amp; vm, JSC::Structure* structure, RefPtr&lt;WorkerGlobalScope&gt;&amp;&amp; impl)
</span><span class="cx">     : JSDOMGlobalObject(vm, structure, normalWorld(vm), &amp;s_globalObjectMethodTable)
</span></span></pre>
</div>
</div>

</body>
</html>