<!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>[204330] 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/204330">204330</a></dd>
<dt>Author</dt> <dd>utatane.tea@gmail.com</dd>
<dt>Date</dt> <dd>2016-08-10 01:37:06 -0700 (Wed, 10 Aug 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[ES6] Add ModuleLoaderPrototype and move methods to it
https://bugs.webkit.org/show_bug.cgi?id=160633

Reviewed by Saam Barati.

Source/JavaScriptCore:

In the future, we need to add the ability to create the new Loader object (by users).
So rather than holding all the methods in the ModuleLoaderObject instance, moving them
to ModuleLoaderPrototype and create the default JSModuleLoader instance is better.

No behavior change.

* CMakeLists.txt:
* DerivedSources.make:
* JavaScriptCore.xcodeproj/project.pbxproj:
* builtins/ModuleLoaderObject.js:
(setStateToMax): Deleted.
(newRegistryEntry): Deleted.
(ensureRegistered): Deleted.
(forceFulfillPromise): Deleted.
(fulfillFetch): Deleted.
(fulfillTranslate): Deleted.
(fulfillInstantiate): Deleted.
(commitInstantiated): Deleted.
(instantiation): Deleted.
(requestFetch): Deleted.
(requestTranslate): Deleted.
(requestInstantiate): Deleted.
(requestResolveDependencies.): Deleted.
(requestResolveDependencies): Deleted.
(requestInstantiateAll): Deleted.
(requestLink): Deleted.
(requestReady): Deleted.
(link): Deleted.
(moduleEvaluation): Deleted.
(provide): Deleted.
(loadAndEvaluateModule): Deleted.
(loadModule): Deleted.
(linkAndEvaluateModule): Deleted.
* builtins/ModuleLoaderPrototype.js: Renamed from Source/JavaScriptCore/builtins/ModuleLoaderObject.js.
(setStateToMax):
(newRegistryEntry):
(ensureRegistered):
(forceFulfillPromise):
(fulfillFetch):
(fulfillTranslate):
(fulfillInstantiate):
(commitInstantiated):
(instantiation):
(requestFetch):
(requestTranslate):
(requestInstantiate):
(requestResolveDependencies.):
(requestResolveDependencies):
(requestInstantiateAll):
(requestLink):
(requestReady):
(link):
(moduleEvaluation):
(provide):
(loadAndEvaluateModule):
(loadModule):
(linkAndEvaluateModule):
* bytecode/BytecodeIntrinsicRegistry.cpp:
(JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry):
* jsc.cpp:
(GlobalObject::moduleLoaderResolve):
(GlobalObject::moduleLoaderFetch):
* runtime/Completion.cpp:
(JSC::loadAndEvaluateModule):
(JSC::loadModule):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::visitChildren):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::moduleLoader):
(JSC::JSGlobalObject::moduleLoaderStructure):
* runtime/JSModuleLoader.cpp: Added.
(JSC::JSModuleLoader::JSModuleLoader):
(JSC::JSModuleLoader::finishCreation):
(JSC::printableModuleKey):
(JSC::JSModuleLoader::provide):
(JSC::JSModuleLoader::loadAndEvaluateModule):
(JSC::JSModuleLoader::loadModule):
(JSC::JSModuleLoader::linkAndEvaluateModule):
(JSC::JSModuleLoader::resolve):
(JSC::JSModuleLoader::fetch):
(JSC::JSModuleLoader::translate):
(JSC::JSModuleLoader::instantiate):
(JSC::JSModuleLoader::evaluate):
* runtime/JSModuleLoader.h: Copied from Source/JavaScriptCore/runtime/ModuleLoaderObject.h.
(JSC::JSModuleLoader::create):
(JSC::JSModuleLoader::createStructure):
* runtime/JSModuleRecord.h:
* runtime/ModuleLoaderObject.cpp: Removed.
(JSC::ModuleLoaderObject::ModuleLoaderObject): Deleted.
(JSC::ModuleLoaderObject::finishCreation): Deleted.
(JSC::printableModuleKey): Deleted.
(JSC::ModuleLoaderObject::provide): Deleted.
(JSC::ModuleLoaderObject::loadAndEvaluateModule): Deleted.
(JSC::ModuleLoaderObject::loadModule): Deleted.
(JSC::ModuleLoaderObject::linkAndEvaluateModule): Deleted.
(JSC::ModuleLoaderObject::resolve): Deleted.
(JSC::ModuleLoaderObject::fetch): Deleted.
(JSC::ModuleLoaderObject::translate): Deleted.
(JSC::ModuleLoaderObject::instantiate): Deleted.
(JSC::ModuleLoaderObject::evaluate): Deleted.
(JSC::moduleLoaderObjectParseModule): Deleted.
(JSC::moduleLoaderObjectRequestedModules): Deleted.
(JSC::moduleLoaderObjectModuleDeclarationInstantiation): Deleted.
(JSC::moduleLoaderObjectResolve): Deleted.
(JSC::moduleLoaderObjectFetch): Deleted.
(JSC::moduleLoaderObjectTranslate): Deleted.
(JSC::moduleLoaderObjectInstantiate): Deleted.
(JSC::moduleLoaderObjectEvaluate): Deleted.
* runtime/ModuleLoaderObject.h:
(JSC::ModuleLoaderObject::create): Deleted.
(JSC::ModuleLoaderObject::createStructure): Deleted.
* runtime/ModuleLoaderPrototype.cpp: Added.
(JSC::ModuleLoaderPrototype::ModuleLoaderPrototype):
(JSC::moduleLoaderPrototypeParseModule):
(JSC::moduleLoaderPrototypeRequestedModules):
(JSC::moduleLoaderPrototypeModuleDeclarationInstantiation):
(JSC::moduleLoaderPrototypeResolve):
(JSC::moduleLoaderPrototypeFetch):
(JSC::moduleLoaderPrototypeTranslate):
(JSC::moduleLoaderPrototypeInstantiate):
(JSC::moduleLoaderPrototypeEvaluate):
* runtime/ModuleLoaderPrototype.h: Renamed from Source/JavaScriptCore/runtime/ModuleLoaderObject.h.
(JSC::ModuleLoaderPrototype::create):
(JSC::ModuleLoaderPrototype::createStructure):

Source/WebCore:

No behavior change.

* ForwardingHeaders/runtime/JSModuleLoader.h: Added.
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::moduleLoaderResolve):
(WebCore::JSDOMWindowBase::moduleLoaderFetch):
(WebCore::JSDOMWindowBase::moduleLoaderEvaluate):
* bindings/js/JSDOMWindowBase.h:
* bindings/js/JSModuleLoader.cpp:
(WebCore::JSModuleLoader::resolve):
(WebCore::JSModuleLoader::fetch):
(WebCore::JSModuleLoader::evaluate):
* bindings/js/JSModuleLoader.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreCMakeListstxt">trunk/Source/JavaScriptCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreDerivedSourcesmake">trunk/Source/JavaScriptCore/DerivedSources.make</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj">trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj</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="#trunkSourceJavaScriptCoreruntimeCompletioncpp">trunk/Source/JavaScriptCore/runtime/Completion.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="#trunkSourceJavaScriptCoreruntimeJSModuleRecordh">trunk/Source/JavaScriptCore/runtime/JSModuleRecord.h</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="#trunkSourceWebCorebindingsjsJSDOMWindowBaseh">trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSModuleLoadercpp">trunk/Source/WebCore/bindings/js/JSModuleLoader.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSModuleLoaderh">trunk/Source/WebCore/bindings/js/JSModuleLoader.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCorebuiltinsModuleLoaderPrototypejs">trunk/Source/JavaScriptCore/builtins/ModuleLoaderPrototype.js</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="#trunkSourceJavaScriptCoreruntimeModuleLoaderPrototypeh">trunk/Source/JavaScriptCore/runtime/ModuleLoaderPrototype.h</a></li>
<li><a href="#trunkSourceWebCoreForwardingHeadersruntimeJSModuleLoaderh">trunk/Source/WebCore/ForwardingHeaders/runtime/JSModuleLoader.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCorebuiltinsModuleLoaderObjectjs">trunk/Source/JavaScriptCore/builtins/ModuleLoaderObject.js</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeModuleLoaderObjectcpp">trunk/Source/JavaScriptCore/runtime/ModuleLoaderObject.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeModuleLoaderObjecth">trunk/Source/JavaScriptCore/runtime/ModuleLoaderObject.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/CMakeLists.txt (204329 => 204330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/CMakeLists.txt        2016-08-10 08:18:03 UTC (rev 204329)
+++ trunk/Source/JavaScriptCore/CMakeLists.txt        2016-08-10 08:37:06 UTC (rev 204330)
</span><span class="lines">@@ -717,6 +717,7 @@
</span><span class="cx">     runtime/JSMap.cpp
</span><span class="cx">     runtime/JSMapIterator.cpp
</span><span class="cx">     runtime/JSModuleEnvironment.cpp
</span><ins>+    runtime/JSModuleLoader.cpp
</ins><span class="cx">     runtime/JSModuleNamespaceObject.cpp
</span><span class="cx">     runtime/JSModuleRecord.cpp
</span><span class="cx">     runtime/JSNativeStdFunction.cpp
</span><span class="lines">@@ -757,7 +758,7 @@
</span><span class="cx">     runtime/MathCommon.cpp
</span><span class="cx">     runtime/MathObject.cpp
</span><span class="cx">     runtime/MemoryStatistics.cpp
</span><del>-    runtime/ModuleLoaderObject.cpp
</del><ins>+    runtime/ModuleLoaderPrototype.cpp
</ins><span class="cx">     runtime/NativeErrorConstructor.cpp
</span><span class="cx">     runtime/NativeErrorPrototype.cpp
</span><span class="cx">     runtime/NativeStdFunctionCell.cpp
</span><span class="lines">@@ -873,7 +874,7 @@
</span><span class="cx">     runtime/JSPromiseConstructor.cpp
</span><span class="cx">     runtime/JSPromisePrototype.cpp
</span><span class="cx">     runtime/MapPrototype.cpp
</span><del>-    runtime/ModuleLoaderObject.cpp
</del><ins>+    runtime/ModuleLoaderPrototype.cpp
</ins><span class="cx">     runtime/NumberConstructor.cpp
</span><span class="cx">     runtime/NumberPrototype.cpp
</span><span class="cx">     runtime/ObjectConstructor.cpp
</span><span class="lines">@@ -1231,7 +1232,7 @@
</span><span class="cx">     ${JAVASCRIPTCORE_DIR}/builtins/InternalPromiseConstructor.js
</span><span class="cx">     ${JAVASCRIPTCORE_DIR}/builtins/IteratorPrototype.js
</span><span class="cx">     ${JAVASCRIPTCORE_DIR}/builtins/MapPrototype.js
</span><del>-    ${JAVASCRIPTCORE_DIR}/builtins/ModuleLoaderObject.js
</del><ins>+    ${JAVASCRIPTCORE_DIR}/builtins/ModuleLoaderPrototype.js
</ins><span class="cx">     ${JAVASCRIPTCORE_DIR}/builtins/NumberConstructor.js
</span><span class="cx">     ${JAVASCRIPTCORE_DIR}/builtins/NumberPrototype.js
</span><span class="cx">     ${JAVASCRIPTCORE_DIR}/builtins/ObjectConstructor.js
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (204329 => 204330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-08-10 08:18:03 UTC (rev 204329)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-08-10 08:37:06 UTC (rev 204330)
</span><span class="lines">@@ -1,3 +1,136 @@
</span><ins>+2016-08-10  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
+
+        [ES6] Add ModuleLoaderPrototype and move methods to it
+        https://bugs.webkit.org/show_bug.cgi?id=160633
+
+        Reviewed by Saam Barati.
+
+        In the future, we need to add the ability to create the new Loader object (by users).
+        So rather than holding all the methods in the ModuleLoaderObject instance, moving them
+        to ModuleLoaderPrototype and create the default JSModuleLoader instance is better.
+
+        No behavior change.
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * builtins/ModuleLoaderObject.js:
+        (setStateToMax): Deleted.
+        (newRegistryEntry): Deleted.
+        (ensureRegistered): Deleted.
+        (forceFulfillPromise): Deleted.
+        (fulfillFetch): Deleted.
+        (fulfillTranslate): Deleted.
+        (fulfillInstantiate): Deleted.
+        (commitInstantiated): Deleted.
+        (instantiation): Deleted.
+        (requestFetch): Deleted.
+        (requestTranslate): Deleted.
+        (requestInstantiate): Deleted.
+        (requestResolveDependencies.): Deleted.
+        (requestResolveDependencies): Deleted.
+        (requestInstantiateAll): Deleted.
+        (requestLink): Deleted.
+        (requestReady): Deleted.
+        (link): Deleted.
+        (moduleEvaluation): Deleted.
+        (provide): Deleted.
+        (loadAndEvaluateModule): Deleted.
+        (loadModule): Deleted.
+        (linkAndEvaluateModule): Deleted.
+        * builtins/ModuleLoaderPrototype.js: Renamed from Source/JavaScriptCore/builtins/ModuleLoaderObject.js.
+        (setStateToMax):
+        (newRegistryEntry):
+        (ensureRegistered):
+        (forceFulfillPromise):
+        (fulfillFetch):
+        (fulfillTranslate):
+        (fulfillInstantiate):
+        (commitInstantiated):
+        (instantiation):
+        (requestFetch):
+        (requestTranslate):
+        (requestInstantiate):
+        (requestResolveDependencies.):
+        (requestResolveDependencies):
+        (requestInstantiateAll):
+        (requestLink):
+        (requestReady):
+        (link):
+        (moduleEvaluation):
+        (provide):
+        (loadAndEvaluateModule):
+        (loadModule):
+        (linkAndEvaluateModule):
+        * bytecode/BytecodeIntrinsicRegistry.cpp:
+        (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry):
+        * jsc.cpp:
+        (GlobalObject::moduleLoaderResolve):
+        (GlobalObject::moduleLoaderFetch):
+        * runtime/Completion.cpp:
+        (JSC::loadAndEvaluateModule):
+        (JSC::loadModule):
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::init):
+        (JSC::JSGlobalObject::visitChildren):
+        * runtime/JSGlobalObject.h:
+        (JSC::JSGlobalObject::moduleLoader):
+        (JSC::JSGlobalObject::moduleLoaderStructure):
+        * runtime/JSModuleLoader.cpp: Added.
+        (JSC::JSModuleLoader::JSModuleLoader):
+        (JSC::JSModuleLoader::finishCreation):
+        (JSC::printableModuleKey):
+        (JSC::JSModuleLoader::provide):
+        (JSC::JSModuleLoader::loadAndEvaluateModule):
+        (JSC::JSModuleLoader::loadModule):
+        (JSC::JSModuleLoader::linkAndEvaluateModule):
+        (JSC::JSModuleLoader::resolve):
+        (JSC::JSModuleLoader::fetch):
+        (JSC::JSModuleLoader::translate):
+        (JSC::JSModuleLoader::instantiate):
+        (JSC::JSModuleLoader::evaluate):
+        * runtime/JSModuleLoader.h: Copied from Source/JavaScriptCore/runtime/ModuleLoaderObject.h.
+        (JSC::JSModuleLoader::create):
+        (JSC::JSModuleLoader::createStructure):
+        * runtime/JSModuleRecord.h:
+        * runtime/ModuleLoaderObject.cpp: Removed.
+        (JSC::ModuleLoaderObject::ModuleLoaderObject): Deleted.
+        (JSC::ModuleLoaderObject::finishCreation): Deleted.
+        (JSC::printableModuleKey): Deleted.
+        (JSC::ModuleLoaderObject::provide): Deleted.
+        (JSC::ModuleLoaderObject::loadAndEvaluateModule): Deleted.
+        (JSC::ModuleLoaderObject::loadModule): Deleted.
+        (JSC::ModuleLoaderObject::linkAndEvaluateModule): Deleted.
+        (JSC::ModuleLoaderObject::resolve): Deleted.
+        (JSC::ModuleLoaderObject::fetch): Deleted.
+        (JSC::ModuleLoaderObject::translate): Deleted.
+        (JSC::ModuleLoaderObject::instantiate): Deleted.
+        (JSC::ModuleLoaderObject::evaluate): Deleted.
+        (JSC::moduleLoaderObjectParseModule): Deleted.
+        (JSC::moduleLoaderObjectRequestedModules): Deleted.
+        (JSC::moduleLoaderObjectModuleDeclarationInstantiation): Deleted.
+        (JSC::moduleLoaderObjectResolve): Deleted.
+        (JSC::moduleLoaderObjectFetch): Deleted.
+        (JSC::moduleLoaderObjectTranslate): Deleted.
+        (JSC::moduleLoaderObjectInstantiate): Deleted.
+        (JSC::moduleLoaderObjectEvaluate): Deleted.
+        * runtime/ModuleLoaderObject.h:
+        (JSC::ModuleLoaderObject::create): Deleted.
+        (JSC::ModuleLoaderObject::createStructure): Deleted.
+        * runtime/ModuleLoaderPrototype.cpp: Added.
+        (JSC::ModuleLoaderPrototype::ModuleLoaderPrototype):
+        (JSC::moduleLoaderPrototypeParseModule):
+        (JSC::moduleLoaderPrototypeRequestedModules):
+        (JSC::moduleLoaderPrototypeModuleDeclarationInstantiation):
+        (JSC::moduleLoaderPrototypeResolve):
+        (JSC::moduleLoaderPrototypeFetch):
+        (JSC::moduleLoaderPrototypeTranslate):
+        (JSC::moduleLoaderPrototypeInstantiate):
+        (JSC::moduleLoaderPrototypeEvaluate):
+        * runtime/ModuleLoaderPrototype.h: Renamed from Source/JavaScriptCore/runtime/ModuleLoaderObject.h.
+        (JSC::ModuleLoaderPrototype::create):
+        (JSC::ModuleLoaderPrototype::createStructure):
+
</ins><span class="cx"> 2016-08-09  Saam Barati  &lt;sbarati@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         JSBoundFunction should lazily generate its name string
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreDerivedSourcesmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/DerivedSources.make (204329 => 204330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/DerivedSources.make        2016-08-10 08:18:03 UTC (rev 204329)
+++ trunk/Source/JavaScriptCore/DerivedSources.make        2016-08-10 08:37:06 UTC (rev 204330)
</span><span class="lines">@@ -97,7 +97,7 @@
</span><span class="cx">     $(JavaScriptCore)/builtins/InternalPromiseConstructor.js \
</span><span class="cx">     $(JavaScriptCore)/builtins/IteratorPrototype.js \
</span><span class="cx">     $(JavaScriptCore)/builtins/MapPrototype.js \
</span><del>-    $(JavaScriptCore)/builtins/ModuleLoaderObject.js \
</del><ins>+    $(JavaScriptCore)/builtins/ModuleLoaderPrototype.js \
</ins><span class="cx">     $(JavaScriptCore)/builtins/NumberConstructor.js \
</span><span class="cx">     $(JavaScriptCore)/builtins/NumberPrototype.js \
</span><span class="cx">     $(JavaScriptCore)/builtins/ObjectConstructor.js \
</span><span class="lines">@@ -147,7 +147,7 @@
</span><span class="cx">     JSPromisePrototype.lut.h \
</span><span class="cx">     JSPromiseConstructor.lut.h \
</span><span class="cx">     MapPrototype.lut.h \
</span><del>-    ModuleLoaderObject.lut.h \
</del><ins>+    ModuleLoaderPrototype.lut.h \
</ins><span class="cx">     NumberConstructor.lut.h \
</span><span class="cx">     NumberPrototype.lut.h \
</span><span class="cx">     ObjectConstructor.lut.h \
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (204329 => 204330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2016-08-10 08:18:03 UTC (rev 204329)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2016-08-10 08:37:06 UTC (rev 204330)
</span><span class="lines">@@ -1456,7 +1456,7 @@
</span><span class="cx">                 996B731D1BDA08EF00331B84 /* JSGlobalObject.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B730B1BD9FA2C00331B84 /* JSGlobalObject.lut.h */; };
</span><span class="cx">                 996B731E1BDA08EF00331B84 /* JSPromiseConstructor.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C184E2417BFFA36007CB63A /* JSPromiseConstructor.lut.h */; };
</span><span class="cx">                 996B731F1BDA08EF00331B84 /* JSPromisePrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C184E2517BFFA36007CB63A /* JSPromisePrototype.lut.h */; };
</span><del>-                996B73201BDA08EF00331B84 /* ModuleLoaderObject.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B730C1BD9FA2C00331B84 /* ModuleLoaderObject.lut.h */; };
</del><ins>+                996B73201BDA08EF00331B84 /* ModuleLoaderPrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B730C1BD9FA2C00331B84 /* ModuleLoaderPrototype.lut.h */; };
</ins><span class="cx">                 996B73211BDA08EF00331B84 /* NumberPrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B730D1BD9FA2C00331B84 /* NumberPrototype.lut.h */; };
</span><span class="cx">                 996B73221BDA08EF00331B84 /* ObjectConstructor.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B730E1BD9FA2C00331B84 /* ObjectConstructor.lut.h */; };
</span><span class="cx">                 996B73231BDA08EF00331B84 /* ReflectObject.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B730F1BD9FA2C00331B84 /* ReflectObject.lut.h */; };
</span><span class="lines">@@ -2046,8 +2046,8 @@
</span><span class="cx">                 E33F50851B8437A000413856 /* JSInternalPromiseDeferred.h in Headers */ = {isa = PBXBuildFile; fileRef = E33F50831B8437A000413856 /* JSInternalPromiseDeferred.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 E33F50871B8449EF00413856 /* JSInternalPromiseConstructor.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = E33F50861B8449EF00413856 /* JSInternalPromiseConstructor.lut.h */; };
</span><span class="cx">                 E354622B1B6065D100545386 /* ConstructAbility.h in Headers */ = {isa = PBXBuildFile; fileRef = E354622A1B6065D100545386 /* ConstructAbility.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                E355F3521B7DC85300C50DC5 /* ModuleLoaderObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E355F3501B7DC85300C50DC5 /* ModuleLoaderObject.cpp */; };
-                E355F3531B7DC85300C50DC5 /* ModuleLoaderObject.h in Headers */ = {isa = PBXBuildFile; fileRef = E355F3511B7DC85300C50DC5 /* ModuleLoaderObject.h */; };
</del><ins>+                E355F3521B7DC85300C50DC5 /* ModuleLoaderPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E355F3501B7DC85300C50DC5 /* ModuleLoaderPrototype.cpp */; };
+                E355F3531B7DC85300C50DC5 /* ModuleLoaderPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = E355F3511B7DC85300C50DC5 /* ModuleLoaderPrototype.h */; };
</ins><span class="cx">                 E35E035F1B7AB43E0073AD2A /* InspectorInstrumentationObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E35E035D1B7AB43E0073AD2A /* InspectorInstrumentationObject.cpp */; };
</span><span class="cx">                 E35E03601B7AB43E0073AD2A /* InspectorInstrumentationObject.h in Headers */ = {isa = PBXBuildFile; fileRef = E35E035E1B7AB43E0073AD2A /* InspectorInstrumentationObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 E3794E751B77EB97005543AE /* ModuleAnalyzer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3794E731B77EB97005543AE /* ModuleAnalyzer.cpp */; };
</span><span class="lines">@@ -2125,6 +2125,8 @@
</span><span class="cx">                 FED94F2E171E3E2300BE77A4 /* Watchdog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FED94F2B171E3E2300BE77A4 /* Watchdog.cpp */; };
</span><span class="cx">                 FED94F2F171E3E2300BE77A4 /* Watchdog.h in Headers */ = {isa = PBXBuildFile; fileRef = FED94F2C171E3E2300BE77A4 /* Watchdog.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 FEF040511AAE662D00BD28B0 /* CompareAndSwapTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEF040501AAE662D00BD28B0 /* CompareAndSwapTest.cpp */; };
</span><ins>+                D9722752DC54459B9125B539 /* JSModuleLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 77B25CB2C3094A92A38E1DB3 /* JSModuleLoader.h */; };
+                13FECE06D3B445FCB6C93461 /* JSModuleLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1879510614C540FFB561C124 /* JSModuleLoader.cpp */; };
</ins><span class="cx"> /* End PBXBuildFile section */
</span><span class="cx"> 
</span><span class="cx"> /* Begin PBXContainerItemProxy section */
</span><span class="lines">@@ -3699,7 +3701,7 @@
</span><span class="cx">                 996B73091BD9FA2C00331B84 /* ErrorPrototype.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ErrorPrototype.lut.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 996B730A1BD9FA2C00331B84 /* JSDataViewPrototype.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDataViewPrototype.lut.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 996B730B1BD9FA2C00331B84 /* JSGlobalObject.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalObject.lut.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                996B730C1BD9FA2C00331B84 /* ModuleLoaderObject.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModuleLoaderObject.lut.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                996B730C1BD9FA2C00331B84 /* ModuleLoaderPrototype.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModuleLoaderPrototype.lut.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 996B730D1BD9FA2C00331B84 /* NumberPrototype.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NumberPrototype.lut.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 996B730E1BD9FA2C00331B84 /* ObjectConstructor.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjectConstructor.lut.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 996B730F1BD9FA2C00331B84 /* ReflectObject.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReflectObject.lut.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -4272,7 +4274,7 @@
</span><span class="cx">                 E178636C0D9BEEC300D74E75 /* InitializeThreading.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InitializeThreading.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E18E3A560DF9278C00D90B34 /* VM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = VM.h; sourceTree = &quot;&lt;group&gt;&quot;; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
</span><span class="cx">                 E18E3A570DF9278C00D90B34 /* VM.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = VM.cpp; sourceTree = &quot;&lt;group&gt;&quot;; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
</span><del>-                E30677971B8BC6F5003F87F0 /* ModuleLoaderObject.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = ModuleLoaderObject.js; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                E30677971B8BC6F5003F87F0 /* ModuleLoaderPrototype.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = ModuleLoaderPrototype.js; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 E318CBBE1B8AEF5100A2929D /* JSModuleNamespaceObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSModuleNamespaceObject.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E318CBBF1B8AEF5100A2929D /* JSModuleNamespaceObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSModuleNamespaceObject.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E33637A31B63220200EE0840 /* ReflectObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReflectObject.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -4293,8 +4295,8 @@
</span><span class="cx">                 E33F50861B8449EF00413856 /* JSInternalPromiseConstructor.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInternalPromiseConstructor.lut.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E33F50881B844A1A00413856 /* InternalPromiseConstructor.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = InternalPromiseConstructor.js; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E354622A1B6065D100545386 /* ConstructAbility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConstructAbility.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                E355F3501B7DC85300C50DC5 /* ModuleLoaderObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ModuleLoaderObject.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                E355F3511B7DC85300C50DC5 /* ModuleLoaderObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModuleLoaderObject.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                E355F3501B7DC85300C50DC5 /* ModuleLoaderPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ModuleLoaderPrototype.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E355F3511B7DC85300C50DC5 /* ModuleLoaderPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModuleLoaderPrototype.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 E35E035D1B7AB43E0073AD2A /* InspectorInstrumentationObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorInstrumentationObject.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E35E035E1B7AB43E0073AD2A /* InspectorInstrumentationObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorInstrumentationObject.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E35E03611B7AB4850073AD2A /* InspectorInstrumentationObject.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = InspectorInstrumentationObject.js; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -4412,6 +4414,8 @@
</span><span class="cx">                 FEDA50D51B97F4D9009A3B4F /* PingPongStackOverflowTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PingPongStackOverflowTest.h; path = API/tests/PingPongStackOverflowTest.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 FEF040501AAE662D00BD28B0 /* CompareAndSwapTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CompareAndSwapTest.cpp; path = API/tests/CompareAndSwapTest.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 FEF040521AAEC4ED00BD28B0 /* CompareAndSwapTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CompareAndSwapTest.h; path = API/tests/CompareAndSwapTest.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                77B25CB2C3094A92A38E1DB3 /* JSModuleLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSModuleLoader.h; path = JSModuleLoader.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                1879510614C540FFB561C124 /* JSModuleLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSModuleLoader.cpp; path = JSModuleLoader.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx"> /* End PBXFileReference section */
</span><span class="cx"> 
</span><span class="cx"> /* Begin PBXFrameworksBuildPhase section */
</span><span class="lines">@@ -5481,7 +5485,7 @@
</span><span class="cx">                                 BC18C52D0E16FCE100B34460 /* Lexer.lut.h */,
</span><span class="cx">                                 70DE9A081BE7D670005D89D9 /* LLIntAssembly.h */,
</span><span class="cx">                                 7035587E1C418458004BD7BF /* MapPrototype.lut.h */,
</span><del>-                                996B730C1BD9FA2C00331B84 /* ModuleLoaderObject.lut.h */,
</del><ins>+                                996B730C1BD9FA2C00331B84 /* ModuleLoaderPrototype.lut.h */,
</ins><span class="cx">                                 BC2680E60E16D52300A06E92 /* NumberConstructor.lut.h */,
</span><span class="cx">                                 996B730D1BD9FA2C00331B84 /* NumberPrototype.lut.h */,
</span><span class="cx">                                 996B730E1BD9FA2C00331B84 /* ObjectConstructor.lut.h */,
</span><span class="lines">@@ -5941,8 +5945,8 @@
</span><span class="cx">                                 90213E3B123A40C200D422F3 /* MemoryStatistics.cpp */,
</span><span class="cx">                                 90213E3C123A40C200D422F3 /* MemoryStatistics.h */,
</span><span class="cx">                                 7C008CE5187631B600955C24 /* Microtask.h */,
</span><del>-                                E355F3501B7DC85300C50DC5 /* ModuleLoaderObject.cpp */,
-                                E355F3511B7DC85300C50DC5 /* ModuleLoaderObject.h */,
</del><ins>+                                E355F3501B7DC85300C50DC5 /* ModuleLoaderPrototype.cpp */,
+                                E355F3511B7DC85300C50DC5 /* ModuleLoaderPrototype.h */,
</ins><span class="cx">                                 BC02E9080E1839DB000F9297 /* NativeErrorConstructor.cpp */,
</span><span class="cx">                                 BC02E9090E1839DB000F9297 /* NativeErrorConstructor.h */,
</span><span class="cx">                                 BC02E90A0E1839DB000F9297 /* NativeErrorPrototype.cpp */,
</span><span class="lines">@@ -6123,6 +6127,8 @@
</span><span class="cx">                                 709FB8661AE335C60039D069 /* WeakSetPrototype.h */,
</span><span class="cx">                                 A7DCB77912E3D90500911940 /* WriteBarrier.h */,
</span><span class="cx">                                 C2B6D75218A33793004A9301 /* WriteBarrierInlines.h */,
</span><ins>+                                77B25CB2C3094A92A38E1DB3 /* JSModuleLoader.h */,
+                                1879510614C540FFB561C124 /* JSModuleLoader.cpp */,
</ins><span class="cx">                         );
</span><span class="cx">                         path = runtime;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="lines">@@ -6956,7 +6962,7 @@
</span><span class="cx">                                 E33F50881B844A1A00413856 /* InternalPromiseConstructor.js */,
</span><span class="cx">                                 7CF9BC5B1B65D9A3009DB1EF /* IteratorPrototype.js */,
</span><span class="cx">                                 7035587C1C418419004BD7BF /* MapPrototype.js */,
</span><del>-                                E30677971B8BC6F5003F87F0 /* ModuleLoaderObject.js */,
</del><ins>+                                E30677971B8BC6F5003F87F0 /* ModuleLoaderPrototype.js */,
</ins><span class="cx">                                 A52704861D027C8800354C37 /* NumberConstructor.js */,
</span><span class="cx">                                 A15DE5C51C0FBF8D0089133D /* NumberPrototype.js */,
</span><span class="cx">                                 7CF9BC5C1B65D9B1009DB1EF /* ObjectConstructor.js */,
</span><span class="lines">@@ -7950,8 +7956,8 @@
</span><span class="cx">                                 86C568E211A213EE0007F7F0 /* MIPSAssembler.h in Headers */,
</span><span class="cx">                                 C4703CD7192844CC0013FBEA /* models.py in Headers */,
</span><span class="cx">                                 E3794E761B77EB97005543AE /* ModuleAnalyzer.h in Headers */,
</span><del>-                                E355F3531B7DC85300C50DC5 /* ModuleLoaderObject.h in Headers */,
-                                996B73201BDA08EF00331B84 /* ModuleLoaderObject.lut.h in Headers */,
</del><ins>+                                E355F3531B7DC85300C50DC5 /* ModuleLoaderPrototype.h in Headers */,
+                                996B73201BDA08EF00331B84 /* ModuleLoaderPrototype.lut.h in Headers */,
</ins><span class="cx">                                 BC02E9110E1839DB000F9297 /* NativeErrorConstructor.h in Headers */,
</span><span class="cx">                                 BC02E9130E1839DB000F9297 /* NativeErrorPrototype.h in Headers */,
</span><span class="cx">                                 E33E8D211B9013DE00346B52 /* NativeStdFunctionCell.h in Headers */,
</span><span class="lines">@@ -8220,6 +8226,7 @@
</span><span class="cx">                                 262D85B71C0D650F006ACB61 /* AirFixPartialRegisterStalls.h in Headers */,
</span><span class="cx">                                 86704B4312DB8A8100A9FE7B /* YarrSyntaxChecker.h in Headers */,
</span><span class="cx">                                 A79D3ED9C5064DD0A8466A3A /* ModuleScopeData.h in Headers */,
</span><ins>+                                D9722752DC54459B9125B539 /* JSModuleLoader.h in Headers */,
</ins><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span><span class="cx">                 };
</span><span class="lines">@@ -9344,7 +9351,7 @@
</span><span class="cx">                                 90213E3D123A40C200D422F3 /* MemoryStatistics.cpp in Sources */,
</span><span class="cx">                                 0FB5467D14F5CFD6002C2989 /* MethodOfGettingAValueProfile.cpp in Sources */,
</span><span class="cx">                                 E3794E751B77EB97005543AE /* ModuleAnalyzer.cpp in Sources */,
</span><del>-                                E355F3521B7DC85300C50DC5 /* ModuleLoaderObject.cpp in Sources */,
</del><ins>+                                E355F3521B7DC85300C50DC5 /* ModuleLoaderPrototype.cpp in Sources */,
</ins><span class="cx">                                 0F338E0B1BF0276C0013C88F /* B3Compilation.cpp in Sources */,
</span><span class="cx">                                 14469DE0107EC7E700650446 /* NativeErrorConstructor.cpp in Sources */,
</span><span class="cx">                                 79160DBD1C8E3EC8008C085A /* ProxyRevoke.cpp in Sources */,
</span><span class="lines">@@ -9533,6 +9540,7 @@
</span><span class="cx">                                 86704B8912DBA33700A9FE7B /* YarrPattern.cpp in Sources */,
</span><span class="cx">                                 86704B4212DB8A8100A9FE7B /* YarrSyntaxChecker.cpp in Sources */,
</span><span class="cx">                                 0F2BBD991C5FF3F50023EF23 /* B3VariableValue.cpp in Sources */,
</span><ins>+                                13FECE06D3B445FCB6C93461 /* JSModuleLoader.cpp in Sources */,
</ins><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span><span class="cx">                 };
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebuiltinsModuleLoaderObjectjs"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/builtins/ModuleLoaderObject.js (204329 => 204330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/builtins/ModuleLoaderObject.js        2016-08-10 08:18:03 UTC (rev 204329)
+++ trunk/Source/JavaScriptCore/builtins/ModuleLoaderObject.js        2016-08-10 08:37:06 UTC (rev 204330)
</span><span class="lines">@@ -1,562 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-// https://whatwg.github.io/loader/#loader-object
-// Module Loader has several hooks that can be customized by the platform.
-// For example, the [[Fetch]] hook can be provided by the JavaScriptCore shell
-// as fetching the payload from the local file system.
-// Currently, there are 4 hooks.
-//    1. Loader.resolve
-//    2. Loader.fetch
-//    3. Loader.translate
-//    4. Loader.instantiate
-
-function setStateToMax(entry, newState)
-{
-    // https://whatwg.github.io/loader/#set-state-to-max
-
-    &quot;use strict&quot;;
-
-    if (entry.state &lt; newState)
-        entry.state = newState;
-}
-
-function newRegistryEntry(key)
-{
-    // https://whatwg.github.io/loader/#registry
-    //
-    // Each registry entry becomes one of the 5 states.
-    // 1. Fetch
-    //     Ready to fetch (or now fetching) the resource of this module.
-    //     Typically, we fetch the source code over the network or from the file system.
-    //     a. If the status is Fetch and there is no entry.fetch promise, the entry is ready to fetch.
-    //     b. If the status is Fetch and there is the entry.fetch promise, the entry is just fetching the resource.
-    //
-    // 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)
-    //     source code.
-    //     Typically, we parse the module code, extract the dependencies and binding information.
-    //     a. If the status is Instantiate and there is no entry.instantiate promise, the entry is ready to instantiate.
-    //     b. If the status is Instantiate and there is the entry.translate promise, the entry is just instantiating
-    //        the module record.
-    //
-    // 4. ResolveDependencies (not in the draft) https://github.com/whatwg/loader/issues/68
-    //     Ready to request the dependent modules (or now requesting &amp; resolving).
-    //     Without this state, the current draft causes infinite recursion when there is circular dependency.
-    //     a. If the status is ResolveDependencies and there is no entry.resolveDependencies promise, the entry is ready to resolve the dependencies.
-    //     b. If the status is ResolveDependencies and there is the entry.resolveDependencies promise, the entry is just resolving
-    //        the dependencies.
-    //
-    // 5. Link
-    //     Ready to link the module with the other modules.
-    //     Linking means that the module imports and exports the bindings from/to the other modules.
-    //
-    // 6. Ready
-    //     The module is linked, so the module is ready to be executed.
-    //
-    // Each registry entry has the 4 promises; &quot;fetch&quot;, &quot;translate&quot;, &quot;instantiate&quot; and &quot;resolveDependencies&quot;.
-    // They are assigned when starting the each phase. And they are fulfilled when the each phase is completed.
-    //
-    // In the current module draft, linking will be performed after the whole modules are instantiated and the dependencies are resolved.
-    // And execution is also done after the all modules are linked.
-    //
-    // TODO: We need to exploit the way to execute the module while fetching non-related modules.
-    // One solution; introducing the ready promise chain to execute the modules concurrently while keeping
-    // the execution order.
-
-    &quot;use strict&quot;;
-
-    return {
-        key: key,
-        state: @ModuleFetch,
-        metadata: @undefined,
-        fetch: @undefined,
-        translate: @undefined,
-        instantiate: @undefined,
-        resolveDependencies: @undefined,
-        dependencies: [], // To keep the module order, we store the module keys in the array.
-        dependenciesMap: @undefined,
-        module: @undefined, // JSModuleRecord
-        error: @undefined,
-    };
-}
-
-function ensureRegistered(key)
-{
-    // https://whatwg.github.io/loader/#ensure-registered
-
-    &quot;use strict&quot;;
-
-    var entry = this.registry.@get(key);
-    if (entry)
-        return entry;
-
-    entry = this.newRegistryEntry(key);
-    this.registry.@set(key, entry);
-
-    return entry;
-}
-
-function forceFulfillPromise(promise, value)
-{
-    &quot;use strict&quot;;
-
-    if (promise.@promiseState === @promiseStatePending)
-        @fulfillPromise(promise, value);
-}
-
-function fulfillFetch(entry, payload)
-{
-    // https://whatwg.github.io/loader/#fulfill-fetch
-
-    &quot;use strict&quot;;
-
-    if (!entry.fetch)
-        entry.fetch = @newPromiseCapability(@InternalPromise).@promise;
-    this.forceFulfillPromise(entry.fetch, payload);
-    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);
-    this.setStateToMax(entry, @ModuleInstantiate);
-}
-
-function fulfillInstantiate(entry, optionalInstance, source)
-{
-    // https://whatwg.github.io/loader/#fulfill-instantiate
-
-    &quot;use strict&quot;;
-
-    if (!entry.instantiate)
-        entry.instantiate = @newPromiseCapability(@InternalPromise).@promise;
-    this.commitInstantiated(entry, optionalInstance, source);
-
-    // FIXME: The draft fulfills the promise in the CommitInstantiated operation.
-    // But it CommitInstantiated is also used in the requestInstantiate and
-    // we should not &quot;force fulfill&quot; there.
-    // So we separate &quot;force fulfill&quot; operation from the CommitInstantiated operation.
-    // https://github.com/whatwg/loader/pull/67
-    this.forceFulfillPromise(entry.instantiate, entry);
-}
-
-function commitInstantiated(entry, optionalInstance, source)
-{
-    // https://whatwg.github.io/loader/#commit-instantiated
-
-    &quot;use strict&quot;;
-
-    var moduleRecord = this.instantiation(optionalInstance, source, entry);
-
-    // FIXME: Described in the draft,
-    //   4. Fulfill entry.[[Instantiate]] with instance.
-    // But, instantiate promise should be fulfilled with the entry.
-    // We remove this statement because instantiate promise will be
-    // fulfilled without this &quot;force fulfill&quot; operation.
-    // https://github.com/whatwg/loader/pull/67
-
-    var dependencies = [];
-    var dependenciesMap = moduleRecord.dependenciesMap;
-    moduleRecord.registryEntry = entry;
-    var requestedModules = this.requestedModules(moduleRecord);
-    for (var i = 0, length = requestedModules.length; i &lt; length; ++i) {
-        var depKey = requestedModules[i];
-        var pair = {
-            key: depKey,
-            value: @undefined
-        };
-        @putByValDirect(dependencies, i, pair);
-        dependenciesMap.@set(depKey, pair);
-    }
-    entry.dependencies = dependencies;
-    entry.dependenciesMap = dependenciesMap;
-    entry.module = moduleRecord;
-    this.setStateToMax(entry, @ModuleResolveDependencies);
-}
-
-function instantiation(result, source, entry)
-{
-    // https://whatwg.github.io/loader/#instantiation
-    // FIXME: Current implementation does not support optionalInstance.
-    // https://bugs.webkit.org/show_bug.cgi?id=148171
-
-    &quot;use strict&quot;;
-
-    return this.parseModule(entry.key, source);
-}
-
-// Loader.
-
-function requestFetch(key)
-{
-    // https://whatwg.github.io/loader/#request-fetch
-
-    &quot;use strict&quot;;
-
-    var entry = this.ensureRegistered(key);
-    if (entry.state &gt; @ModuleLink) {
-        var deferred = @newPromiseCapability(@InternalPromise);
-        deferred.@reject.@call(@undefined, new @TypeError(&quot;Requested module is already ready to be executed.&quot;));
-        return deferred.@promise;
-    }
-
-    if (entry.fetch)
-        return entry.fetch;
-
-    var loader = this;
-
-    // Hook point.
-    // 2. Loader.fetch
-    //     https://whatwg.github.io/loader/#browser-fetch
-    //     Take the key and fetch the resource actually.
-    //     For example, JavaScriptCore shell can provide the hook fetching the resource
-    //     from the local file system.
-    var fetchPromise = this.fetch(key).then(function (payload) {
-        loader.setStateToMax(entry, @ModuleTranslate);
-        return payload;
-    });
-    entry.fetch = fetchPromise;
-    return fetchPromise;
-}
-
-function requestTranslate(key)
-{
-    // https://whatwg.github.io/loader/#request-translate
-
-    &quot;use strict&quot;;
-
-    var entry = this.ensureRegistered(key);
-    if (entry.state &gt; @ModuleLink) {
-        var deferred = @newPromiseCapability(@InternalPromise);
-        deferred.@reject.@call(@undefined, new @TypeError(&quot;Requested module is already ready to be executed.&quot;));
-        return deferred.@promise;
-    }
-
-    if (entry.translate)
-        return entry.translate;
-
-    var loader = this;
-    var translatePromise = this.requestFetch(key).then(function (payload) {
-        // 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 loader.translate(key, payload).then(function (source) {
-            loader.setStateToMax(entry, @ModuleInstantiate);
-            return source;
-        });
-    });
-    entry.translate = translatePromise;
-    return translatePromise;
-}
-
-function requestInstantiate(key)
-{
-    // https://whatwg.github.io/loader/#request-instantiate
-
-    &quot;use strict&quot;;
-
-    var entry = this.ensureRegistered(key);
-    if (entry.state &gt; @ModuleLink) {
-        var deferred = @newPromiseCapability(@InternalPromise);
-        deferred.@reject.@call(@undefined, new @TypeError(&quot;Requested module is already ready to be executed.&quot;));
-        return deferred.@promise;
-    }
-
-    if (entry.instantiate)
-        return entry.instantiate;
-
-    var loader = this;
-    var instantiatePromise = this.requestTranslate(key).then(function (source) {
-        // Hook point.
-        // 4. Loader.instantiate
-        //     https://whatwg.github.io/loader/#browser-instantiate
-        //     Take the key and the translated source code, and instantiate the module record
-        //     by parsing the module source code.
-        //     It has the chance to provide the optional module instance that is different from
-        //     the ordinary one.
-        return loader.instantiate(key, source).then(function (optionalInstance) {
-            loader.commitInstantiated(entry, optionalInstance, source);
-            return entry;
-        });
-    });
-    entry.instantiate = instantiatePromise;
-    return instantiatePromise;
-}
-
-function requestResolveDependencies(key)
-{
-    // FIXME: In the spec, after requesting instantiation, we will resolve
-    // the dependencies without any status change. As a result, when there
-    // is circular dependencies, instantiation is done only once, but
-    // repeatedly resolving the dependencies. This means that infinite
-    // recursion occur when the given modules have circular dependency. To
-    // avoid this situation, we introduce new state, &quot;ResolveDependencies&quot;. This means
-    // &quot;Now the module is instantiated, so ready to resolve the dependencies
-    // or now resolving them&quot;.
-    // https://github.com/whatwg/loader/issues/68
-
-    &quot;use strict&quot;;
-
-    var entry = this.ensureRegistered(key);
-    if (entry.state &gt; @ModuleLink) {
-        var deferred = @newPromiseCapability(@InternalPromise);
-        deferred.@reject.@call(@undefined, new @TypeError(&quot;Requested module is already ready to be executed.&quot;));
-        return deferred.@promise;
-    }
-
-    if (entry.resolveDependencies)
-        return entry.resolveDependencies;
-
-    var loader = this;
-    var resolveDependenciesPromise = this.requestInstantiate(key).then(function (entry) {
-        var depLoads = [];
-        for (var i = 0, length = entry.dependencies.length; i &lt; length; ++i) {
-            let pair = entry.dependencies[i];
-
-            // Hook point.
-            // 1. Loader.resolve.
-            //     https://whatwg.github.io/loader/#browser-resolve
-            //     Take the name and resolve it to the unique identifier for the resource location.
-            //     For example, take the &quot;jquery&quot; and return the URL for the resource.
-            var promise = loader.resolve(pair.key, key).then(function (depKey) {
-                var depEntry = loader.ensureRegistered(depKey);
-
-                // Recursive resolving. The dependencies of this entry is being resolved or already resolved.
-                // Stop tracing the circular dependencies.
-                // But to retrieve the instantiated module record correctly,
-                // we need to wait for the instantiation for the dependent module.
-                // For example, reaching here, the module is starting resolving the dependencies.
-                // But the module may or may not reach the instantiation phase in the loader's pipeline.
-                // If we wait for the ResolveDependencies for this module, it construct the circular promise chain and
-                // rejected by the Promises runtime. Since only we need is the instantiated module, instead of waiting
-                // the ResolveDependencies for this module, we just wait Instantiate for this.
-                if (depEntry.resolveDependencies) {
-                    return depEntry.instantiate.then(function (entry) {
-                        pair.value = entry.module;
-                        return entry;
-                    });
-                }
-
-                return loader.requestResolveDependencies(depKey).then(function (entry) {
-                    pair.value = entry.module;
-                    return entry;
-                });
-            });
-            @putByValDirect(depLoads, i, promise);
-        }
-
-        return @InternalPromise.internalAll(depLoads).then(function (modules) {
-            loader.setStateToMax(entry, @ModuleLink);
-            return entry;
-        });
-    });
-
-    entry.resolveDependencies = resolveDependenciesPromise;
-    return resolveDependenciesPromise;
-}
-
-function requestInstantiateAll(key)
-{
-    // https://whatwg.github.io/loader/#request-instantiate-all
-
-    &quot;use strict&quot;;
-
-    return this.requestResolveDependencies(key);
-}
-
-function requestLink(key)
-{
-    // https://whatwg.github.io/loader/#request-link
-
-    &quot;use strict&quot;;
-
-    var entry = this.ensureRegistered(key);
-    if (entry.state &gt; @ModuleLink) {
-        var deferred = @newPromiseCapability(@InternalPromise);
-        deferred.@resolve.@call(@undefined, entry.module);
-        return deferred.@promise;
-    }
-
-    var loader = this;
-    return this.requestInstantiateAll(key).then(function (entry) {
-        loader.link(entry);
-        return entry;
-    });
-}
-
-function requestReady(key)
-{
-    // https://whatwg.github.io/loader/#request-ready
-
-    &quot;use strict&quot;;
-
-    var loader = this;
-    return this.requestLink(key).then(function (entry) {
-        loader.moduleEvaluation(entry.module);
-    });
-}
-
-// Linking semantics.
-
-function link(entry)
-{
-    // https://whatwg.github.io/loader/#link
-
-    &quot;use strict&quot;;
-
-    // FIXME: Current implementation does not support optionalInstance.
-    // So Link's step 3 is skipped.
-    // https://bugs.webkit.org/show_bug.cgi?id=148171
-
-    if (entry.state === @ModuleReady)
-        return;
-    this.setStateToMax(entry, @ModuleReady);
-
-    // Since we already have the &quot;dependencies&quot; field,
-    // we can call moduleDeclarationInstantiation with the correct order
-    // without constructing the dependency graph by calling dependencyGraph.
-    var dependencies = entry.dependencies;
-    for (var i = 0, length = dependencies.length; i &lt; length; ++i) {
-        var pair = dependencies[i];
-        this.link(pair.value.registryEntry);
-    }
-
-    this.moduleDeclarationInstantiation(entry.module);
-}
-
-// Module semantics.
-
-function moduleEvaluation(moduleRecord)
-{
-    // http://www.ecma-international.org/ecma-262/6.0/#sec-moduleevaluation
-
-    &quot;use strict&quot;;
-
-    if (moduleRecord.evaluated)
-        return;
-    moduleRecord.evaluated = true;
-
-    var entry = moduleRecord.registryEntry;
-
-    // The contents of the [[RequestedModules]] is cloned into entry.dependencies.
-    var dependencies = entry.dependencies;
-    for (var i = 0, length = dependencies.length; i &lt; length; ++i) {
-        var pair = dependencies[i];
-        var requiredModuleRecord = pair.value;
-        this.moduleEvaluation(requiredModuleRecord);
-    }
-    this.evaluate(entry.key, moduleRecord);
-}
-
-// APIs to control the module loader.
-
-function provide(key, stage, value)
-{
-    &quot;use strict&quot;;
-
-    var entry = this.ensureRegistered(key);
-
-    if (stage === @ModuleFetch) {
-        if (entry.status &gt; @ModuleFetch)
-            throw new @TypeError(&quot;Requested module is already fetched.&quot;);
-        this.fulfillFetch(entry, value);
-        return;
-    }
-
-    if (stage === @ModuleTranslate) {
-        if (entry.status &gt; @ModuleTranslate)
-            throw new @TypeError(&quot;Requested module is already translated.&quot;);
-        this.fulfillFetch(entry, @undefined);
-        this.fulfillTranslate(entry, value);
-        return;
-    }
-
-    if (stage === @ModuleInstantiate) {
-        if (entry.status &gt; @ModuleInstantiate)
-            throw new @TypeError(&quot;Requested module is already instantiated.&quot;);
-        this.fulfillFetch(entry, @undefined);
-        this.fulfillTranslate(entry, value);
-        var loader = this;
-        entry.translate.then(function (source) {
-            loader.fulfillInstantiate(entry, value, source);
-        });
-        return;
-    }
-
-    throw new @TypeError(&quot;Requested module is already ready to be executed.&quot;);
-}
-
-function loadAndEvaluateModule(moduleName, referrer)
-{
-    &quot;use strict&quot;;
-
-    var loader = this;
-    // Loader.resolve hook point.
-    // resolve: moduleName =&gt; Promise(moduleKey)
-    // Take the name and resolve it to the unique identifier for the resource location.
-    // For example, take the &quot;jquery&quot; and return the URL for the resource.
-    return this.resolve(moduleName, referrer).then(function (key) {
-        return loader.requestReady(key);
-    });
-}
-
-function loadModule(moduleName, referrer)
-{
-    &quot;use strict&quot;;
-
-    var loader = this;
-    // Loader.resolve hook point.
-    // resolve: moduleName =&gt; Promise(moduleKey)
-    // Take the name and resolve it to the unique identifier for the resource location.
-    // For example, take the &quot;jquery&quot; and return the URL for the resource.
-    return this.resolve(moduleName, referrer).then(function (key) {
-        return loader.requestInstantiateAll(key);
-    }).then(function (entry) {
-        return entry.key;
-    });
-}
-
-function linkAndEvaluateModule(key)
-{
-    &quot;use strict&quot;;
-
-    return this.requestReady(key);
-}
</del></span></pre></div>
<a id="trunkSourceJavaScriptCorebuiltinsModuleLoaderPrototypejsfromrev204329trunkSourceJavaScriptCorebuiltinsModuleLoaderObjectjs"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/builtins/ModuleLoaderPrototype.js (from rev 204329, trunk/Source/JavaScriptCore/builtins/ModuleLoaderObject.js) (0 => 204330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/builtins/ModuleLoaderPrototype.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/builtins/ModuleLoaderPrototype.js        2016-08-10 08:37:06 UTC (rev 204330)
</span><span class="lines">@@ -0,0 +1,562 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// https://whatwg.github.io/loader/#loader-object
+// Module Loader has several hooks that can be customized by the platform.
+// For example, the [[Fetch]] hook can be provided by the JavaScriptCore shell
+// as fetching the payload from the local file system.
+// Currently, there are 4 hooks.
+//    1. Loader.resolve
+//    2. Loader.fetch
+//    3. Loader.translate
+//    4. Loader.instantiate
+
+function setStateToMax(entry, newState)
+{
+    // https://whatwg.github.io/loader/#set-state-to-max
+
+    &quot;use strict&quot;;
+
+    if (entry.state &lt; newState)
+        entry.state = newState;
+}
+
+function newRegistryEntry(key)
+{
+    // https://whatwg.github.io/loader/#registry
+    //
+    // Each registry entry becomes one of the 5 states.
+    // 1. Fetch
+    //     Ready to fetch (or now fetching) the resource of this module.
+    //     Typically, we fetch the source code over the network or from the file system.
+    //     a. If the status is Fetch and there is no entry.fetch promise, the entry is ready to fetch.
+    //     b. If the status is Fetch and there is the entry.fetch promise, the entry is just fetching the resource.
+    //
+    // 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)
+    //     source code.
+    //     Typically, we parse the module code, extract the dependencies and binding information.
+    //     a. If the status is Instantiate and there is no entry.instantiate promise, the entry is ready to instantiate.
+    //     b. If the status is Instantiate and there is the entry.translate promise, the entry is just instantiating
+    //        the module record.
+    //
+    // 4. ResolveDependencies (not in the draft) https://github.com/whatwg/loader/issues/68
+    //     Ready to request the dependent modules (or now requesting &amp; resolving).
+    //     Without this state, the current draft causes infinite recursion when there is circular dependency.
+    //     a. If the status is ResolveDependencies and there is no entry.resolveDependencies promise, the entry is ready to resolve the dependencies.
+    //     b. If the status is ResolveDependencies and there is the entry.resolveDependencies promise, the entry is just resolving
+    //        the dependencies.
+    //
+    // 5. Link
+    //     Ready to link the module with the other modules.
+    //     Linking means that the module imports and exports the bindings from/to the other modules.
+    //
+    // 6. Ready
+    //     The module is linked, so the module is ready to be executed.
+    //
+    // Each registry entry has the 4 promises; &quot;fetch&quot;, &quot;translate&quot;, &quot;instantiate&quot; and &quot;resolveDependencies&quot;.
+    // They are assigned when starting the each phase. And they are fulfilled when the each phase is completed.
+    //
+    // In the current module draft, linking will be performed after the whole modules are instantiated and the dependencies are resolved.
+    // And execution is also done after the all modules are linked.
+    //
+    // TODO: We need to exploit the way to execute the module while fetching non-related modules.
+    // One solution; introducing the ready promise chain to execute the modules concurrently while keeping
+    // the execution order.
+
+    &quot;use strict&quot;;
+
+    return {
+        key: key,
+        state: @ModuleFetch,
+        metadata: @undefined,
+        fetch: @undefined,
+        translate: @undefined,
+        instantiate: @undefined,
+        resolveDependencies: @undefined,
+        dependencies: [], // To keep the module order, we store the module keys in the array.
+        dependenciesMap: @undefined,
+        module: @undefined, // JSModuleRecord
+        error: @undefined,
+    };
+}
+
+function ensureRegistered(key)
+{
+    // https://whatwg.github.io/loader/#ensure-registered
+
+    &quot;use strict&quot;;
+
+    var entry = this.registry.@get(key);
+    if (entry)
+        return entry;
+
+    entry = this.newRegistryEntry(key);
+    this.registry.@set(key, entry);
+
+    return entry;
+}
+
+function forceFulfillPromise(promise, value)
+{
+    &quot;use strict&quot;;
+
+    if (promise.@promiseState === @promiseStatePending)
+        @fulfillPromise(promise, value);
+}
+
+function fulfillFetch(entry, payload)
+{
+    // https://whatwg.github.io/loader/#fulfill-fetch
+
+    &quot;use strict&quot;;
+
+    if (!entry.fetch)
+        entry.fetch = @newPromiseCapability(@InternalPromise).@promise;
+    this.forceFulfillPromise(entry.fetch, payload);
+    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);
+    this.setStateToMax(entry, @ModuleInstantiate);
+}
+
+function fulfillInstantiate(entry, optionalInstance, source)
+{
+    // https://whatwg.github.io/loader/#fulfill-instantiate
+
+    &quot;use strict&quot;;
+
+    if (!entry.instantiate)
+        entry.instantiate = @newPromiseCapability(@InternalPromise).@promise;
+    this.commitInstantiated(entry, optionalInstance, source);
+
+    // FIXME: The draft fulfills the promise in the CommitInstantiated operation.
+    // But it CommitInstantiated is also used in the requestInstantiate and
+    // we should not &quot;force fulfill&quot; there.
+    // So we separate &quot;force fulfill&quot; operation from the CommitInstantiated operation.
+    // https://github.com/whatwg/loader/pull/67
+    this.forceFulfillPromise(entry.instantiate, entry);
+}
+
+function commitInstantiated(entry, optionalInstance, source)
+{
+    // https://whatwg.github.io/loader/#commit-instantiated
+
+    &quot;use strict&quot;;
+
+    var moduleRecord = this.instantiation(optionalInstance, source, entry);
+
+    // FIXME: Described in the draft,
+    //   4. Fulfill entry.[[Instantiate]] with instance.
+    // But, instantiate promise should be fulfilled with the entry.
+    // We remove this statement because instantiate promise will be
+    // fulfilled without this &quot;force fulfill&quot; operation.
+    // https://github.com/whatwg/loader/pull/67
+
+    var dependencies = [];
+    var dependenciesMap = moduleRecord.dependenciesMap;
+    moduleRecord.registryEntry = entry;
+    var requestedModules = this.requestedModules(moduleRecord);
+    for (var i = 0, length = requestedModules.length; i &lt; length; ++i) {
+        var depKey = requestedModules[i];
+        var pair = {
+            key: depKey,
+            value: @undefined
+        };
+        @putByValDirect(dependencies, i, pair);
+        dependenciesMap.@set(depKey, pair);
+    }
+    entry.dependencies = dependencies;
+    entry.dependenciesMap = dependenciesMap;
+    entry.module = moduleRecord;
+    this.setStateToMax(entry, @ModuleResolveDependencies);
+}
+
+function instantiation(result, source, entry)
+{
+    // https://whatwg.github.io/loader/#instantiation
+    // FIXME: Current implementation does not support optionalInstance.
+    // https://bugs.webkit.org/show_bug.cgi?id=148171
+
+    &quot;use strict&quot;;
+
+    return this.parseModule(entry.key, source);
+}
+
+// Loader.
+
+function requestFetch(key)
+{
+    // https://whatwg.github.io/loader/#request-fetch
+
+    &quot;use strict&quot;;
+
+    var entry = this.ensureRegistered(key);
+    if (entry.state &gt; @ModuleLink) {
+        var deferred = @newPromiseCapability(@InternalPromise);
+        deferred.@reject.@call(@undefined, new @TypeError(&quot;Requested module is already ready to be executed.&quot;));
+        return deferred.@promise;
+    }
+
+    if (entry.fetch)
+        return entry.fetch;
+
+    var loader = this;
+
+    // Hook point.
+    // 2. Loader.fetch
+    //     https://whatwg.github.io/loader/#browser-fetch
+    //     Take the key and fetch the resource actually.
+    //     For example, JavaScriptCore shell can provide the hook fetching the resource
+    //     from the local file system.
+    var fetchPromise = this.fetch(key).then(function (payload) {
+        loader.setStateToMax(entry, @ModuleTranslate);
+        return payload;
+    });
+    entry.fetch = fetchPromise;
+    return fetchPromise;
+}
+
+function requestTranslate(key)
+{
+    // https://whatwg.github.io/loader/#request-translate
+
+    &quot;use strict&quot;;
+
+    var entry = this.ensureRegistered(key);
+    if (entry.state &gt; @ModuleLink) {
+        var deferred = @newPromiseCapability(@InternalPromise);
+        deferred.@reject.@call(@undefined, new @TypeError(&quot;Requested module is already ready to be executed.&quot;));
+        return deferred.@promise;
+    }
+
+    if (entry.translate)
+        return entry.translate;
+
+    var loader = this;
+    var translatePromise = this.requestFetch(key).then(function (payload) {
+        // 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 loader.translate(key, payload).then(function (source) {
+            loader.setStateToMax(entry, @ModuleInstantiate);
+            return source;
+        });
+    });
+    entry.translate = translatePromise;
+    return translatePromise;
+}
+
+function requestInstantiate(key)
+{
+    // https://whatwg.github.io/loader/#request-instantiate
+
+    &quot;use strict&quot;;
+
+    var entry = this.ensureRegistered(key);
+    if (entry.state &gt; @ModuleLink) {
+        var deferred = @newPromiseCapability(@InternalPromise);
+        deferred.@reject.@call(@undefined, new @TypeError(&quot;Requested module is already ready to be executed.&quot;));
+        return deferred.@promise;
+    }
+
+    if (entry.instantiate)
+        return entry.instantiate;
+
+    var loader = this;
+    var instantiatePromise = this.requestTranslate(key).then(function (source) {
+        // Hook point.
+        // 4. Loader.instantiate
+        //     https://whatwg.github.io/loader/#browser-instantiate
+        //     Take the key and the translated source code, and instantiate the module record
+        //     by parsing the module source code.
+        //     It has the chance to provide the optional module instance that is different from
+        //     the ordinary one.
+        return loader.instantiate(key, source).then(function (optionalInstance) {
+            loader.commitInstantiated(entry, optionalInstance, source);
+            return entry;
+        });
+    });
+    entry.instantiate = instantiatePromise;
+    return instantiatePromise;
+}
+
+function requestResolveDependencies(key)
+{
+    // FIXME: In the spec, after requesting instantiation, we will resolve
+    // the dependencies without any status change. As a result, when there
+    // is circular dependencies, instantiation is done only once, but
+    // repeatedly resolving the dependencies. This means that infinite
+    // recursion occur when the given modules have circular dependency. To
+    // avoid this situation, we introduce new state, &quot;ResolveDependencies&quot;. This means
+    // &quot;Now the module is instantiated, so ready to resolve the dependencies
+    // or now resolving them&quot;.
+    // https://github.com/whatwg/loader/issues/68
+
+    &quot;use strict&quot;;
+
+    var entry = this.ensureRegistered(key);
+    if (entry.state &gt; @ModuleLink) {
+        var deferred = @newPromiseCapability(@InternalPromise);
+        deferred.@reject.@call(@undefined, new @TypeError(&quot;Requested module is already ready to be executed.&quot;));
+        return deferred.@promise;
+    }
+
+    if (entry.resolveDependencies)
+        return entry.resolveDependencies;
+
+    var loader = this;
+    var resolveDependenciesPromise = this.requestInstantiate(key).then(function (entry) {
+        var depLoads = [];
+        for (var i = 0, length = entry.dependencies.length; i &lt; length; ++i) {
+            let pair = entry.dependencies[i];
+
+            // Hook point.
+            // 1. Loader.resolve.
+            //     https://whatwg.github.io/loader/#browser-resolve
+            //     Take the name and resolve it to the unique identifier for the resource location.
+            //     For example, take the &quot;jquery&quot; and return the URL for the resource.
+            var promise = loader.resolve(pair.key, key).then(function (depKey) {
+                var depEntry = loader.ensureRegistered(depKey);
+
+                // Recursive resolving. The dependencies of this entry is being resolved or already resolved.
+                // Stop tracing the circular dependencies.
+                // But to retrieve the instantiated module record correctly,
+                // we need to wait for the instantiation for the dependent module.
+                // For example, reaching here, the module is starting resolving the dependencies.
+                // But the module may or may not reach the instantiation phase in the loader's pipeline.
+                // If we wait for the ResolveDependencies for this module, it construct the circular promise chain and
+                // rejected by the Promises runtime. Since only we need is the instantiated module, instead of waiting
+                // the ResolveDependencies for this module, we just wait Instantiate for this.
+                if (depEntry.resolveDependencies) {
+                    return depEntry.instantiate.then(function (entry) {
+                        pair.value = entry.module;
+                        return entry;
+                    });
+                }
+
+                return loader.requestResolveDependencies(depKey).then(function (entry) {
+                    pair.value = entry.module;
+                    return entry;
+                });
+            });
+            @putByValDirect(depLoads, i, promise);
+        }
+
+        return @InternalPromise.internalAll(depLoads).then(function (modules) {
+            loader.setStateToMax(entry, @ModuleLink);
+            return entry;
+        });
+    });
+
+    entry.resolveDependencies = resolveDependenciesPromise;
+    return resolveDependenciesPromise;
+}
+
+function requestInstantiateAll(key)
+{
+    // https://whatwg.github.io/loader/#request-instantiate-all
+
+    &quot;use strict&quot;;
+
+    return this.requestResolveDependencies(key);
+}
+
+function requestLink(key)
+{
+    // https://whatwg.github.io/loader/#request-link
+
+    &quot;use strict&quot;;
+
+    var entry = this.ensureRegistered(key);
+    if (entry.state &gt; @ModuleLink) {
+        var deferred = @newPromiseCapability(@InternalPromise);
+        deferred.@resolve.@call(@undefined, entry.module);
+        return deferred.@promise;
+    }
+
+    var loader = this;
+    return this.requestInstantiateAll(key).then(function (entry) {
+        loader.link(entry);
+        return entry;
+    });
+}
+
+function requestReady(key)
+{
+    // https://whatwg.github.io/loader/#request-ready
+
+    &quot;use strict&quot;;
+
+    var loader = this;
+    return this.requestLink(key).then(function (entry) {
+        loader.moduleEvaluation(entry.module);
+    });
+}
+
+// Linking semantics.
+
+function link(entry)
+{
+    // https://whatwg.github.io/loader/#link
+
+    &quot;use strict&quot;;
+
+    // FIXME: Current implementation does not support optionalInstance.
+    // So Link's step 3 is skipped.
+    // https://bugs.webkit.org/show_bug.cgi?id=148171
+
+    if (entry.state === @ModuleReady)
+        return;
+    this.setStateToMax(entry, @ModuleReady);
+
+    // Since we already have the &quot;dependencies&quot; field,
+    // we can call moduleDeclarationInstantiation with the correct order
+    // without constructing the dependency graph by calling dependencyGraph.
+    var dependencies = entry.dependencies;
+    for (var i = 0, length = dependencies.length; i &lt; length; ++i) {
+        var pair = dependencies[i];
+        this.link(pair.value.registryEntry);
+    }
+
+    this.moduleDeclarationInstantiation(entry.module);
+}
+
+// Module semantics.
+
+function moduleEvaluation(moduleRecord)
+{
+    // http://www.ecma-international.org/ecma-262/6.0/#sec-moduleevaluation
+
+    &quot;use strict&quot;;
+
+    if (moduleRecord.evaluated)
+        return;
+    moduleRecord.evaluated = true;
+
+    var entry = moduleRecord.registryEntry;
+
+    // The contents of the [[RequestedModules]] is cloned into entry.dependencies.
+    var dependencies = entry.dependencies;
+    for (var i = 0, length = dependencies.length; i &lt; length; ++i) {
+        var pair = dependencies[i];
+        var requiredModuleRecord = pair.value;
+        this.moduleEvaluation(requiredModuleRecord);
+    }
+    this.evaluate(entry.key, moduleRecord);
+}
+
+// APIs to control the module loader.
+
+function provide(key, stage, value)
+{
+    &quot;use strict&quot;;
+
+    var entry = this.ensureRegistered(key);
+
+    if (stage === @ModuleFetch) {
+        if (entry.status &gt; @ModuleFetch)
+            throw new @TypeError(&quot;Requested module is already fetched.&quot;);
+        this.fulfillFetch(entry, value);
+        return;
+    }
+
+    if (stage === @ModuleTranslate) {
+        if (entry.status &gt; @ModuleTranslate)
+            throw new @TypeError(&quot;Requested module is already translated.&quot;);
+        this.fulfillFetch(entry, @undefined);
+        this.fulfillTranslate(entry, value);
+        return;
+    }
+
+    if (stage === @ModuleInstantiate) {
+        if (entry.status &gt; @ModuleInstantiate)
+            throw new @TypeError(&quot;Requested module is already instantiated.&quot;);
+        this.fulfillFetch(entry, @undefined);
+        this.fulfillTranslate(entry, value);
+        var loader = this;
+        entry.translate.then(function (source) {
+            loader.fulfillInstantiate(entry, value, source);
+        });
+        return;
+    }
+
+    throw new @TypeError(&quot;Requested module is already ready to be executed.&quot;);
+}
+
+function loadAndEvaluateModule(moduleName, referrer)
+{
+    &quot;use strict&quot;;
+
+    var loader = this;
+    // Loader.resolve hook point.
+    // resolve: moduleName =&gt; Promise(moduleKey)
+    // Take the name and resolve it to the unique identifier for the resource location.
+    // For example, take the &quot;jquery&quot; and return the URL for the resource.
+    return this.resolve(moduleName, referrer).then(function (key) {
+        return loader.requestReady(key);
+    });
+}
+
+function loadModule(moduleName, referrer)
+{
+    &quot;use strict&quot;;
+
+    var loader = this;
+    // Loader.resolve hook point.
+    // resolve: moduleName =&gt; Promise(moduleKey)
+    // Take the name and resolve it to the unique identifier for the resource location.
+    // For example, take the &quot;jquery&quot; and return the URL for the resource.
+    return this.resolve(moduleName, referrer).then(function (key) {
+        return loader.requestInstantiateAll(key);
+    }).then(function (entry) {
+        return entry.key;
+    });
+}
+
+function linkAndEvaluateModule(key)
+{
+    &quot;use strict&quot;;
+
+    return this.requestReady(key);
+}
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeBytecodeIntrinsicRegistrycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.cpp (204329 => 204330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.cpp        2016-08-10 08:18:03 UTC (rev 204329)
+++ trunk/Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.cpp        2016-08-10 08:37:06 UTC (rev 204330)
</span><span class="lines">@@ -32,8 +32,8 @@
</span><span class="cx"> #include &quot;BytecodeGenerator.h&quot;
</span><span class="cx"> #include &quot;JSCJSValueInlines.h&quot;
</span><span class="cx"> #include &quot;JSGeneratorFunction.h&quot;
</span><ins>+#include &quot;JSModuleLoader.h&quot;
</ins><span class="cx"> #include &quot;JSPromise.h&quot;
</span><del>-#include &quot;ModuleLoaderObject.h&quot;
</del><span class="cx"> #include &quot;Nodes.h&quot;
</span><span class="cx"> #include &quot;StrongInlines.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -55,12 +55,12 @@
</span><span class="cx">     m_arrayIterationKindKeyValue.set(m_vm, jsNumber(ArrayIterateKeyValue));
</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><del>-    m_ModuleFetch.set(m_vm, jsNumber(static_cast&lt;unsigned&gt;(ModuleLoaderObject::Status::Fetch)));
-    m_ModuleTranslate.set(m_vm, jsNumber(static_cast&lt;unsigned&gt;(ModuleLoaderObject::Status::Translate)));
-    m_ModuleInstantiate.set(m_vm, jsNumber(static_cast&lt;unsigned&gt;(ModuleLoaderObject::Status::Instantiate)));
-    m_ModuleResolveDependencies.set(m_vm, jsNumber(static_cast&lt;unsigned&gt;(ModuleLoaderObject::Status::ResolveDependencies)));
-    m_ModuleLink.set(m_vm, jsNumber(static_cast&lt;unsigned&gt;(ModuleLoaderObject::Status::Link)));
-    m_ModuleReady.set(m_vm, jsNumber(static_cast&lt;unsigned&gt;(ModuleLoaderObject::Status::Ready)));
</del><ins>+    m_ModuleFetch.set(m_vm, jsNumber(static_cast&lt;unsigned&gt;(JSModuleLoader::Status::Fetch)));
+    m_ModuleTranslate.set(m_vm, jsNumber(static_cast&lt;unsigned&gt;(JSModuleLoader::Status::Translate)));
+    m_ModuleInstantiate.set(m_vm, jsNumber(static_cast&lt;unsigned&gt;(JSModuleLoader::Status::Instantiate)));
+    m_ModuleResolveDependencies.set(m_vm, jsNumber(static_cast&lt;unsigned&gt;(JSModuleLoader::Status::ResolveDependencies)));
+    m_ModuleLink.set(m_vm, jsNumber(static_cast&lt;unsigned&gt;(JSModuleLoader::Status::Link)));
+    m_ModuleReady.set(m_vm, jsNumber(static_cast&lt;unsigned&gt;(JSModuleLoader::Status::Ready)));
</ins><span class="cx">     m_promiseStatePending.set(m_vm, jsNumber(static_cast&lt;unsigned&gt;(JSPromise::Status::Pending)));
</span><span class="cx">     m_promiseStateFulfilled.set(m_vm, jsNumber(static_cast&lt;unsigned&gt;(JSPromise::Status::Fulfilled)));
</span><span class="cx">     m_promiseStateRejected.set(m_vm, jsNumber(static_cast&lt;unsigned&gt;(JSPromise::Status::Rejected)));
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejsccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jsc.cpp (204329 => 204330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jsc.cpp        2016-08-10 08:18:03 UTC (rev 204329)
+++ trunk/Source/JavaScriptCore/jsc.cpp        2016-08-10 08:37:06 UTC (rev 204330)
</span><span class="lines">@@ -881,8 +881,8 @@
</span><span class="cx">         putDirect(vm, identifier, JSFunction::create(vm, this, arguments, identifier.string(), function, NoIntrinsic, function));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static JSInternalPromise* moduleLoaderResolve(JSGlobalObject*, ExecState*, JSValue, JSValue);
-    static JSInternalPromise* moduleLoaderFetch(JSGlobalObject*, ExecState*, JSValue);
</del><ins>+    static JSInternalPromise* moduleLoaderResolve(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue);
+    static JSInternalPromise* moduleLoaderFetch(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue);
</ins><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><span class="lines">@@ -1013,7 +1013,7 @@
</span><span class="cx">     return builder.toString();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-JSInternalPromise* GlobalObject::moduleLoaderResolve(JSGlobalObject* globalObject, ExecState* exec, JSValue keyValue, JSValue referrerValue)
</del><ins>+JSInternalPromise* GlobalObject::moduleLoaderResolve(JSGlobalObject* globalObject, ExecState* exec, JSModuleLoader*, JSValue keyValue, JSValue referrerValue)
</ins><span class="cx"> {
</span><span class="cx">     JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject);
</span><span class="cx">     const Identifier key = keyValue.toPropertyKey(exec);
</span><span class="lines">@@ -1118,7 +1118,7 @@
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-JSInternalPromise* GlobalObject::moduleLoaderFetch(JSGlobalObject* globalObject, ExecState* exec, JSValue key)
</del><ins>+JSInternalPromise* GlobalObject::moduleLoaderFetch(JSGlobalObject* globalObject, ExecState* exec, JSModuleLoader*, JSValue key)
</ins><span class="cx"> {
</span><span class="cx">     JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject);
</span><span class="cx">     String moduleKey = key.toWTFString(exec);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeCompletioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Completion.cpp (204329 => 204330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Completion.cpp        2016-08-10 08:18:03 UTC (rev 204329)
+++ trunk/Source/JavaScriptCore/runtime/Completion.cpp        2016-08-10 08:37:06 UTC (rev 204330)
</span><span class="lines">@@ -34,10 +34,10 @@
</span><span class="cx"> #include &quot;JSInternalPromise.h&quot;
</span><span class="cx"> #include &quot;JSInternalPromiseDeferred.h&quot;
</span><span class="cx"> #include &quot;JSLock.h&quot;
</span><ins>+#include &quot;JSModuleLoader.h&quot;
</ins><span class="cx"> #include &quot;JSModuleRecord.h&quot;
</span><span class="cx"> #include &quot;JSWithScope.h&quot;
</span><span class="cx"> #include &quot;ModuleAnalyzer.h&quot;
</span><del>-#include &quot;ModuleLoaderObject.h&quot;
</del><span class="cx"> #include &quot;Parser.h&quot;
</span><span class="cx"> #include &quot;ScriptProfilingScope.h&quot;
</span><span class="cx"> #include &lt;wtf/WTFThreadData.h&gt;
</span><span class="lines">@@ -186,7 +186,7 @@
</span><span class="cx">     JSGlobalObject* globalObject = exec-&gt;vmEntryGlobalObject();
</span><span class="cx"> 
</span><span class="cx">     // Insert the given source code to the ModuleLoader registry as the fetched registry entry.
</span><del>-    globalObject-&gt;moduleLoader()-&gt;provide(exec, key, ModuleLoaderObject::Status::Fetch, source.view().toString());
</del><ins>+    globalObject-&gt;moduleLoader()-&gt;provide(exec, key, JSModuleLoader::Status::Fetch, source.view().toString());
</ins><span class="cx">     if (exec-&gt;hadException())
</span><span class="cx">         return rejectPromise(exec, globalObject);
</span><span class="cx"> 
</span><span class="lines">@@ -223,7 +223,7 @@
</span><span class="cx">     JSGlobalObject* globalObject = exec-&gt;vmEntryGlobalObject();
</span><span class="cx"> 
</span><span class="cx">     // Insert the given source code to the ModuleLoader registry as the fetched registry entry.
</span><del>-    globalObject-&gt;moduleLoader()-&gt;provide(exec, key, ModuleLoaderObject::Status::Fetch, source.view().toString());
</del><ins>+    globalObject-&gt;moduleLoader()-&gt;provide(exec, key, JSModuleLoader::Status::Fetch, source.view().toString());
</ins><span class="cx">     if (exec-&gt;hadException())
</span><span class="cx">         return rejectPromise(exec, globalObject);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp (204329 => 204330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2016-08-10 08:18:03 UTC (rev 204329)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2016-08-10 08:37:06 UTC (rev 204330)
</span><span class="lines">@@ -88,6 +88,7 @@
</span><span class="cx"> #include &quot;JSMap.h&quot;
</span><span class="cx"> #include &quot;JSMapIterator.h&quot;
</span><span class="cx"> #include &quot;JSModuleEnvironment.h&quot;
</span><ins>+#include &quot;JSModuleLoader.h&quot;
</ins><span class="cx"> #include &quot;JSModuleNamespaceObject.h&quot;
</span><span class="cx"> #include &quot;JSModuleRecord.h&quot;
</span><span class="cx"> #include &quot;JSNativeStdFunction.h&quot;
</span><span class="lines">@@ -117,7 +118,7 @@
</span><span class="cx"> #include &quot;MapPrototype.h&quot;
</span><span class="cx"> #include &quot;MathObject.h&quot;
</span><span class="cx"> #include &quot;Microtask.h&quot;
</span><del>-#include &quot;ModuleLoaderObject.h&quot;
</del><ins>+#include &quot;ModuleLoaderPrototype.h&quot;
</ins><span class="cx"> #include &quot;NativeErrorConstructor.h&quot;
</span><span class="cx"> #include &quot;NativeErrorPrototype.h&quot;
</span><span class="cx"> #include &quot;NullGetterFunction.h&quot;
</span><span class="lines">@@ -549,6 +550,7 @@
</span><span class="cx"> 
</span><span class="cx">     m_propertyNameIteratorStructure.set(vm, this, JSPropertyNameIterator::createStructure(vm, this, m_iteratorPrototype.get()));
</span><span class="cx">     m_generatorPrototype.set(vm, this, GeneratorPrototype::create(vm, this, GeneratorPrototype::createStructure(vm, this, m_iteratorPrototype.get())));
</span><ins>+    m_moduleLoaderPrototype.set(vm, this, ModuleLoaderPrototype::create(vm, this, ModuleLoaderPrototype::createStructure(vm, this, m_objectPrototype.get())));
</ins><span class="cx">     
</span><span class="cx">     // Constructors
</span><span class="cx"> 
</span><span class="lines">@@ -638,7 +640,8 @@
</span><span class="cx">     ReflectObject* reflectObject = ReflectObject::create(vm, this, ReflectObject::createStructure(vm, this, m_objectPrototype.get()));
</span><span class="cx">     putDirectWithoutTransition(vm, vm.propertyNames-&gt;Reflect, reflectObject, DontEnum);
</span><span class="cx"> 
</span><del>-    m_moduleLoader.set(vm, this, ModuleLoaderObject::create(vm, this, ModuleLoaderObject::createStructure(vm, this, m_objectPrototype.get())));
</del><ins>+    m_moduleLoaderStructure.set(vm, this, JSModuleLoader::createStructure(vm, this, m_moduleLoaderPrototype.get()));
+    m_moduleLoader.set(vm, this, JSModuleLoader::create(vm, this, m_moduleLoaderStructure.get()));
</ins><span class="cx">     if (Options::exposeInternalModuleLoader())
</span><span class="cx">         putDirectWithoutTransition(vm, vm.propertyNames-&gt;Loader, m_moduleLoader.get(), DontEnum);
</span><span class="cx"> 
</span><span class="lines">@@ -1053,6 +1056,7 @@
</span><span class="cx">     visitor.append(&amp;thisObject-&gt;m_iteratorPrototype);
</span><span class="cx">     visitor.append(&amp;thisObject-&gt;m_generatorFunctionPrototype);
</span><span class="cx">     visitor.append(&amp;thisObject-&gt;m_generatorPrototype);
</span><ins>+    visitor.append(&amp;thisObject-&gt;m_moduleLoaderPrototype);
</ins><span class="cx"> 
</span><span class="cx">     thisObject-&gt;m_debuggerScopeStructure.visit(visitor);
</span><span class="cx">     thisObject-&gt;m_withScopeStructure.visit(visitor);
</span><span class="lines">@@ -1096,6 +1100,7 @@
</span><span class="cx">     visitor.append(&amp;thisObject-&gt;m_proxyObjectStructure);
</span><span class="cx">     visitor.append(&amp;thisObject-&gt;m_callableProxyObjectStructure);
</span><span class="cx">     visitor.append(&amp;thisObject-&gt;m_proxyRevokeStructure);
</span><ins>+    visitor.append(&amp;thisObject-&gt;m_moduleLoaderStructure);
</ins><span class="cx"> 
</span><span class="cx"> #define VISIT_SIMPLE_TYPE(CapitalName, lowerName, properName, instanceType, jsName) \
</span><span class="cx">     visitor.append(&amp;thisObject-&gt;m_ ## lowerName ## Prototype); \
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h (204329 => 204330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h        2016-08-10 08:18:03 UTC (rev 204329)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h        2016-08-10 08:37:06 UTC (rev 204330)
</span><span class="lines">@@ -74,6 +74,7 @@
</span><span class="cx"> class InputCursor;
</span><span class="cx"> class JSGlobalObjectDebuggable;
</span><span class="cx"> class JSInternalPromise;
</span><ins>+class JSModuleLoader;
</ins><span class="cx"> class JSPromise;
</span><span class="cx"> class JSPromiseConstructor;
</span><span class="cx"> class JSPromisePrototype;
</span><span class="lines">@@ -81,7 +82,7 @@
</span><span class="cx"> class JSTypedArrayViewPrototype;
</span><span class="cx"> class LLIntOffsetsExtractor;
</span><span class="cx"> class Microtask;
</span><del>-class ModuleLoaderObject;
</del><ins>+class ModuleLoaderPrototype;
</ins><span class="cx"> class ModuleProgramExecutable;
</span><span class="cx"> class NativeErrorConstructor;
</span><span class="cx"> class NullGetterFunction;
</span><span class="lines">@@ -165,19 +166,19 @@
</span><span class="cx">     typedef bool (*ShouldInterruptScriptBeforeTimeoutPtr)(const JSGlobalObject*);
</span><span class="cx">     ShouldInterruptScriptBeforeTimeoutPtr shouldInterruptScriptBeforeTimeout;
</span><span class="cx"> 
</span><del>-    typedef JSInternalPromise* (*ModuleLoaderResolvePtr)(JSGlobalObject*, ExecState*, JSValue, JSValue);
</del><ins>+    typedef JSInternalPromise* (*ModuleLoaderResolvePtr)(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue);
</ins><span class="cx">     ModuleLoaderResolvePtr moduleLoaderResolve;
</span><span class="cx"> 
</span><del>-    typedef JSInternalPromise* (*ModuleLoaderFetchPtr)(JSGlobalObject*, ExecState*, JSValue);
</del><ins>+    typedef JSInternalPromise* (*ModuleLoaderFetchPtr)(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue);
</ins><span class="cx">     ModuleLoaderFetchPtr moduleLoaderFetch;
</span><span class="cx"> 
</span><del>-    typedef JSInternalPromise* (*ModuleLoaderTranslatePtr)(JSGlobalObject*, ExecState*, JSValue, JSValue);
</del><ins>+    typedef JSInternalPromise* (*ModuleLoaderTranslatePtr)(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue);
</ins><span class="cx">     ModuleLoaderTranslatePtr moduleLoaderTranslate;
</span><span class="cx"> 
</span><del>-    typedef JSInternalPromise* (*ModuleLoaderInstantiatePtr)(JSGlobalObject*, ExecState*, JSValue, JSValue);
</del><ins>+    typedef JSInternalPromise* (*ModuleLoaderInstantiatePtr)(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue);
</ins><span class="cx">     ModuleLoaderInstantiatePtr moduleLoaderInstantiate;
</span><span class="cx"> 
</span><del>-    typedef JSValue (*ModuleLoaderEvaluatePtr)(JSGlobalObject*, ExecState*, JSValue, JSValue);
</del><ins>+    typedef JSValue (*ModuleLoaderEvaluatePtr)(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue);
</ins><span class="cx">     ModuleLoaderEvaluatePtr moduleLoaderEvaluate;
</span><span class="cx"> 
</span><span class="cx">     typedef String (*DefaultLanguageFunctionPtr)();
</span><span class="lines">@@ -251,7 +252,7 @@
</span><span class="cx">     WriteBarrier&lt;JSObject&gt; m_regExpProtoUnicodeGetter;
</span><span class="cx">     LazyProperty&lt;JSGlobalObject, GetterSetter&gt; m_throwTypeErrorArgumentsCalleeAndCallerGetterSetter;
</span><span class="cx"> 
</span><del>-    WriteBarrier&lt;ModuleLoaderObject&gt; m_moduleLoader;
</del><ins>+    WriteBarrier&lt;JSModuleLoader&gt; m_moduleLoader;
</ins><span class="cx"> 
</span><span class="cx">     WriteBarrier&lt;ObjectPrototype&gt; m_objectPrototype;
</span><span class="cx">     WriteBarrier&lt;FunctionPrototype&gt; m_functionPrototype;
</span><span class="lines">@@ -260,6 +261,7 @@
</span><span class="cx">     WriteBarrier&lt;IteratorPrototype&gt; m_iteratorPrototype;
</span><span class="cx">     WriteBarrier&lt;GeneratorFunctionPrototype&gt; m_generatorFunctionPrototype;
</span><span class="cx">     WriteBarrier&lt;GeneratorPrototype&gt; m_generatorPrototype;
</span><ins>+    WriteBarrier&lt;ModuleLoaderPrototype&gt; m_moduleLoaderPrototype;
</ins><span class="cx"> 
</span><span class="cx">     LazyProperty&lt;JSGlobalObject, Structure&gt; m_debuggerScopeStructure;
</span><span class="cx">     LazyProperty&lt;JSGlobalObject, Structure&gt; m_withScopeStructure;
</span><span class="lines">@@ -307,6 +309,7 @@
</span><span class="cx">     WriteBarrier&lt;Structure&gt; m_proxyObjectStructure;
</span><span class="cx">     WriteBarrier&lt;Structure&gt; m_callableProxyObjectStructure;
</span><span class="cx">     WriteBarrier&lt;Structure&gt; m_proxyRevokeStructure;
</span><ins>+    WriteBarrier&lt;Structure&gt; m_moduleLoaderStructure;
</ins><span class="cx"> 
</span><span class="cx"> #define DEFINE_STORAGE_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName) \
</span><span class="cx">     WriteBarrier&lt;capitalName ## Prototype&gt; m_ ## lowerName ## Prototype; \
</span><span class="lines">@@ -496,7 +499,7 @@
</span><span class="cx">         return m_throwTypeErrorArgumentsCalleeAndCallerGetterSetter.get(this);
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    ModuleLoaderObject* moduleLoader() const { return m_moduleLoader.get(); }
</del><ins>+    JSModuleLoader* moduleLoader() const { return m_moduleLoader.get(); }
</ins><span class="cx"> 
</span><span class="cx">     ObjectPrototype* objectPrototype() const { return m_objectPrototype.get(); }
</span><span class="cx">     FunctionPrototype* functionPrototype() const { return m_functionPrototype.get(); }
</span><span class="lines">@@ -580,6 +583,7 @@
</span><span class="cx">     Structure* proxyObjectStructure() const { return m_proxyObjectStructure.get(); }
</span><span class="cx">     Structure* callableProxyObjectStructure() const { return m_callableProxyObjectStructure.get(); }
</span><span class="cx">     Structure* proxyRevokeStructure() const { return m_proxyRevokeStructure.get(); }
</span><ins>+    Structure* moduleLoaderStructure() const { return m_moduleLoaderStructure.get(); }
</ins><span class="cx"> 
</span><span class="cx">     JS_EXPORT_PRIVATE void setRemoteDebuggingEnabled(bool);
</span><span class="cx">     JS_EXPORT_PRIVATE bool remoteDebuggingEnabled() const;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSModuleLoadercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/runtime/JSModuleLoader.cpp (0 => 204330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSModuleLoader.cpp                                (rev 0)
+++ trunk/Source/JavaScriptCore/runtime/JSModuleLoader.cpp        2016-08-10 08:37:06 UTC (rev 204330)
</span><span class="lines">@@ -0,0 +1,204 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2016 Yusuke Suzuki &lt;utatane.tea@gmail.com&gt;.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;JSModuleLoader.h&quot;
+
+#include &quot;BuiltinNames.h&quot;
+#include &quot;CodeProfiling.h&quot;
+#include &quot;Error.h&quot;
+#include &quot;Exception.h&quot;
+#include &quot;JSCInlines.h&quot;
+#include &quot;JSGlobalObjectFunctions.h&quot;
+#include &quot;JSInternalPromise.h&quot;
+#include &quot;JSInternalPromiseDeferred.h&quot;
+#include &quot;JSMap.h&quot;
+#include &quot;JSModuleEnvironment.h&quot;
+#include &quot;JSModuleRecord.h&quot;
+#include &quot;ModuleAnalyzer.h&quot;
+#include &quot;ModuleLoaderPrototype.h&quot;
+#include &quot;Nodes.h&quot;
+#include &quot;Parser.h&quot;
+#include &quot;ParserError.h&quot;
+
+namespace JSC {
+
+STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(JSModuleLoader);
+
+const ClassInfo JSModuleLoader::s_info = { &quot;ModuleLoader&quot;, &amp;Base::s_info, nullptr, CREATE_METHOD_TABLE(JSModuleLoader) };
+
+JSModuleLoader::JSModuleLoader(VM&amp; vm, Structure* structure)
+    : JSNonFinalObject(vm, structure)
+{
+}
+
+void JSModuleLoader::finishCreation(VM&amp; vm, JSGlobalObject* globalObject)
+{
+    Base::finishCreation(vm);
+    ASSERT(inherits(info()));
+    putDirect(vm, Identifier::fromString(&amp;vm, &quot;registry&quot;), JSMap::create(vm, globalObject-&gt;mapStructure()));
+}
+
+// ------------------------------ Functions --------------------------------
+
+static String printableModuleKey(ExecState* exec, JSValue key)
+{
+    if (key.isString() || key.isSymbol())
+        return key.toPropertyKey(exec).impl();
+    return exec-&gt;propertyNames().emptyIdentifier.impl();
+}
+
+JSValue JSModuleLoader::provide(ExecState* exec, JSValue key, Status status, const String&amp; source)
+{
+    JSObject* function = jsCast&lt;JSObject*&gt;(get(exec, exec-&gt;propertyNames().builtinNames().providePublicName()));
+    CallData callData;
+    CallType callType = JSC::getCallData(function, callData);
+    ASSERT(callType != CallType::None);
+
+    MarkedArgumentBuffer arguments;
+    arguments.append(key);
+    arguments.append(jsNumber(status));
+    arguments.append(jsString(exec, source));
+
+    return call(exec, function, callType, callData, this, arguments);
+}
+
+JSInternalPromise* JSModuleLoader::loadAndEvaluateModule(ExecState* exec, JSValue moduleName, JSValue referrer)
+{
+    JSObject* function = jsCast&lt;JSObject*&gt;(get(exec, exec-&gt;propertyNames().builtinNames().loadAndEvaluateModulePublicName()));
+    CallData callData;
+    CallType callType = JSC::getCallData(function, callData);
+    ASSERT(callType != CallType::None);
+
+    MarkedArgumentBuffer arguments;
+    arguments.append(moduleName);
+    arguments.append(referrer);
+
+    return jsCast&lt;JSInternalPromise*&gt;(call(exec, function, callType, callData, this, arguments));
+}
+
+JSInternalPromise* JSModuleLoader::loadModule(ExecState* exec, JSValue moduleName, JSValue referrer)
+{
+    JSObject* function = jsCast&lt;JSObject*&gt;(get(exec, exec-&gt;propertyNames().builtinNames().loadModulePublicName()));
+    CallData callData;
+    CallType callType = JSC::getCallData(function, callData);
+    ASSERT(callType != CallType::None);
+
+    MarkedArgumentBuffer arguments;
+    arguments.append(moduleName);
+    arguments.append(referrer);
+
+    return jsCast&lt;JSInternalPromise*&gt;(call(exec, function, callType, callData, this, arguments));
+}
+
+JSInternalPromise* JSModuleLoader::linkAndEvaluateModule(ExecState* exec, JSValue moduleKey)
+{
+    JSObject* function = jsCast&lt;JSObject*&gt;(get(exec, exec-&gt;propertyNames().builtinNames().linkAndEvaluateModulePublicName()));
+    CallData callData;
+    CallType callType = JSC::getCallData(function, callData);
+    ASSERT(callType != CallType::None);
+
+    MarkedArgumentBuffer arguments;
+    arguments.append(moduleKey);
+
+    return jsCast&lt;JSInternalPromise*&gt;(call(exec, function, callType, callData, this, arguments));
+}
+
+JSInternalPromise* JSModuleLoader::resolve(ExecState* exec, JSValue name, JSValue referrer)
+{
+    if (Options::dumpModuleLoadingState())
+        dataLog(&quot;Loader [resolve] &quot;, printableModuleKey(exec, name), &quot;\n&quot;);
+
+    JSGlobalObject* globalObject = exec-&gt;lexicalGlobalObject();
+    if (globalObject-&gt;globalObjectMethodTable()-&gt;moduleLoaderResolve)
+        return globalObject-&gt;globalObjectMethodTable()-&gt;moduleLoaderResolve(globalObject, exec, this, name, referrer);
+    JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject);
+    deferred-&gt;resolve(exec, name);
+    return deferred-&gt;promise();
+}
+
+JSInternalPromise* JSModuleLoader::fetch(ExecState* exec, JSValue key)
+{
+    if (Options::dumpModuleLoadingState())
+        dataLog(&quot;Loader [fetch] &quot;, printableModuleKey(exec, key), &quot;\n&quot;);
+
+    JSGlobalObject* globalObject = exec-&gt;lexicalGlobalObject();
+    if (globalObject-&gt;globalObjectMethodTable()-&gt;moduleLoaderFetch)
+        return globalObject-&gt;globalObjectMethodTable()-&gt;moduleLoaderFetch(globalObject, exec, this, key);
+    JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject);
+    String moduleKey = key.toString(exec)-&gt;value(exec);
+    if (exec-&gt;hadException()) {
+        JSValue exception = exec-&gt;exception()-&gt;value();
+        exec-&gt;clearException();
+        deferred-&gt;reject(exec, exception);
+        return deferred-&gt;promise();
+    }
+    deferred-&gt;reject(exec, createError(exec, makeString(&quot;Could not open the module '&quot;, moduleKey, &quot;'.&quot;)));
+    return deferred-&gt;promise();
+}
+
+JSInternalPromise* JSModuleLoader::translate(ExecState* exec, JSValue key, JSValue payload)
+{
+    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);
+    JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject);
+    deferred-&gt;resolve(exec, payload);
+    return deferred-&gt;promise();
+}
+
+JSInternalPromise* JSModuleLoader::instantiate(ExecState* exec, JSValue key, JSValue source)
+{
+    if (Options::dumpModuleLoadingState())
+        dataLog(&quot;Loader [instantiate] &quot;, printableModuleKey(exec, key), &quot;\n&quot;);
+
+    JSGlobalObject* globalObject = exec-&gt;lexicalGlobalObject();
+    if (globalObject-&gt;globalObjectMethodTable()-&gt;moduleLoaderInstantiate)
+        return globalObject-&gt;globalObjectMethodTable()-&gt;moduleLoaderInstantiate(globalObject, exec, this, key, source);
+    JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject);
+    deferred-&gt;resolve(exec, jsUndefined());
+    return deferred-&gt;promise();
+}
+
+JSValue JSModuleLoader::evaluate(ExecState* exec, JSValue key, JSValue moduleRecordValue)
+{
+    if (Options::dumpModuleLoadingState())
+        dataLog(&quot;Loader [evaluate] &quot;, printableModuleKey(exec, key), &quot;\n&quot;);
+
+    JSGlobalObject* globalObject = exec-&gt;lexicalGlobalObject();
+    if (globalObject-&gt;globalObjectMethodTable()-&gt;moduleLoaderEvaluate)
+        return globalObject-&gt;globalObjectMethodTable()-&gt;moduleLoaderEvaluate(globalObject, exec, this, key, moduleRecordValue);
+
+    JSModuleRecord* moduleRecord = jsDynamicCast&lt;JSModuleRecord*&gt;(moduleRecordValue);
+    if (!moduleRecord)
+        return jsUndefined();
+    return moduleRecord-&gt;evaluate(exec);
+}
+
+} // namespace JSC
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSModuleLoaderhfromrev204329trunkSourceJavaScriptCoreruntimeModuleLoaderObjecth"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/runtime/JSModuleLoader.h (from rev 204329, trunk/Source/JavaScriptCore/runtime/ModuleLoaderObject.h) (0 => 204330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSModuleLoader.h                                (rev 0)
+++ trunk/Source/JavaScriptCore/runtime/JSModuleLoader.h        2016-08-10 08:37:06 UTC (rev 204330)
</span><span class="lines">@@ -0,0 +1,83 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2016 Yusuke Suzuki &lt;utatane.tea@gmail.com&gt;.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include &quot;JSObject.h&quot;
+
+namespace JSC {
+
+class JSInternalPromise;
+
+class JSModuleLoader : public JSNonFinalObject {
+private:
+    JSModuleLoader(VM&amp;, Structure*);
+public:
+    typedef JSNonFinalObject Base;
+
+    enum Status {
+        Fetch = 1,
+        Translate = 2,
+        Instantiate = 3,
+        ResolveDependencies = 4,
+        Link = 5,
+        Ready = 6,
+    };
+
+    static JSModuleLoader* create(VM&amp; vm, JSGlobalObject* globalObject, Structure* structure)
+    {
+        JSModuleLoader* object = new (NotNull, allocateCell&lt;JSModuleLoader&gt;(vm.heap)) JSModuleLoader(vm, structure);
+        object-&gt;finishCreation(vm, globalObject);
+        return object;
+    }
+
+    DECLARE_INFO;
+
+    static Structure* createStructure(VM&amp; vm, JSGlobalObject* globalObject, JSValue prototype)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
+    }
+
+    // APIs to control the module loader.
+    JSValue provide(ExecState*, JSValue key, Status, const String&amp;);
+    JSInternalPromise* loadAndEvaluateModule(ExecState*, JSValue moduleName, JSValue referrer);
+    JSInternalPromise* loadModule(ExecState*, JSValue moduleName, JSValue referrer);
+    JSInternalPromise* linkAndEvaluateModule(ExecState*, JSValue moduleKey);
+
+    // Platform dependent hooked APIs.
+    JSInternalPromise* resolve(ExecState*, JSValue name, JSValue referrer);
+    JSInternalPromise* fetch(ExecState*, JSValue key);
+    JSInternalPromise* translate(ExecState*, JSValue key, JSValue payload);
+    JSInternalPromise* instantiate(ExecState*, JSValue key, JSValue source);
+
+    // Additional platform dependent hooked APIs.
+    JSValue evaluate(ExecState*, JSValue key, JSValue moduleRecord);
+
+protected:
+    void finishCreation(VM&amp;, JSGlobalObject*);
+};
+
+} // namespace JSC
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSModuleRecordh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSModuleRecord.h (204329 => 204330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSModuleRecord.h        2016-08-10 08:18:03 UTC (rev 204329)
+++ trunk/Source/JavaScriptCore/runtime/JSModuleRecord.h        2016-08-10 08:37:06 UTC (rev 204330)
</span><span class="lines">@@ -206,7 +206,7 @@
</span><span class="cx">     WriteBarrier&lt;JSModuleEnvironment&gt; m_moduleEnvironment;
</span><span class="cx">     WriteBarrier&lt;JSModuleNamespaceObject&gt; m_moduleNamespaceObject;
</span><span class="cx"> 
</span><del>-    // We assume that all the JSModuleRecord are retained by ModuleLoaderObject's registry.
</del><ins>+    // We assume that all the JSModuleRecord are retained by JSModuleLoader's registry.
</ins><span class="cx">     // So here, we don't visit each object for GC. The resolution cache map caches the once
</span><span class="cx">     // looked up correctly resolved resolution, since (1) we rarely looked up the non-resolved one,
</span><span class="cx">     // and (2) if we cache all the attempts the size of the map becomes infinitely large.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeModuleLoaderObjectcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/runtime/ModuleLoaderObject.cpp (204329 => 204330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ModuleLoaderObject.cpp        2016-08-10 08:18:03 UTC (rev 204329)
+++ trunk/Source/JavaScriptCore/runtime/ModuleLoaderObject.cpp        2016-08-10 08:37:06 UTC (rev 204330)
</span><span class="lines">@@ -1,382 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include &quot;config.h&quot;
-#include &quot;ModuleLoaderObject.h&quot;
-
-#include &quot;BuiltinNames.h&quot;
-#include &quot;CodeProfiling.h&quot;
-#include &quot;Error.h&quot;
-#include &quot;Exception.h&quot;
-#include &quot;JSCInlines.h&quot;
-#include &quot;JSGlobalObjectFunctions.h&quot;
-#include &quot;JSInternalPromise.h&quot;
-#include &quot;JSInternalPromiseDeferred.h&quot;
-#include &quot;JSMap.h&quot;
-#include &quot;JSModuleEnvironment.h&quot;
-#include &quot;JSModuleRecord.h&quot;
-#include &quot;ModuleAnalyzer.h&quot;
-#include &quot;Nodes.h&quot;
-#include &quot;Parser.h&quot;
-#include &quot;ParserError.h&quot;
-
-namespace JSC {
-
-static EncodedJSValue JSC_HOST_CALL moduleLoaderObjectParseModule(ExecState*);
-static EncodedJSValue JSC_HOST_CALL moduleLoaderObjectRequestedModules(ExecState*);
-static EncodedJSValue JSC_HOST_CALL moduleLoaderObjectEvaluate(ExecState*);
-static EncodedJSValue JSC_HOST_CALL moduleLoaderObjectModuleDeclarationInstantiation(ExecState*);
-static EncodedJSValue JSC_HOST_CALL moduleLoaderObjectResolve(ExecState*);
-static EncodedJSValue JSC_HOST_CALL moduleLoaderObjectFetch(ExecState*);
-static EncodedJSValue JSC_HOST_CALL moduleLoaderObjectTranslate(ExecState*);
-static EncodedJSValue JSC_HOST_CALL moduleLoaderObjectInstantiate(ExecState*);
-
-}
-
-#include &quot;ModuleLoaderObject.lut.h&quot;
-
-namespace JSC {
-
-STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(ModuleLoaderObject);
-
-const ClassInfo ModuleLoaderObject::s_info = { &quot;ModuleLoader&quot;, &amp;Base::s_info, &amp;moduleLoaderObjectTable, CREATE_METHOD_TABLE(ModuleLoaderObject) };
-
-/* Source for ModuleLoaderObject.lut.h
-@begin moduleLoaderObjectTable
-    setStateToMax                  JSBuiltin                                        DontEnum|Function 2
-    newRegistryEntry               JSBuiltin                                        DontEnum|Function 1
-    ensureRegistered               JSBuiltin                                        DontEnum|Function 1
-    forceFulfillPromise            JSBuiltin                                        DontEnum|Function 2
-    fulfillFetch                   JSBuiltin                                        DontEnum|Function 2
-    fulfillTranslate               JSBuiltin                                        DontEnum|Function 2
-    fulfillInstantiate             JSBuiltin                                        DontEnum|Function 2
-    commitInstantiated             JSBuiltin                                        DontEnum|Function 3
-    instantiation                  JSBuiltin                                        DontEnum|Function 3
-    requestFetch                   JSBuiltin                                        DontEnum|Function 1
-    requestTranslate               JSBuiltin                                        DontEnum|Function 1
-    requestInstantiate             JSBuiltin                                        DontEnum|Function 1
-    requestResolveDependencies     JSBuiltin                                        DontEnum|Function 1
-    requestInstantiateAll          JSBuiltin                                        DontEnum|Function 1
-    requestLink                    JSBuiltin                                        DontEnum|Function 1
-    requestReady                   JSBuiltin                                        DontEnum|Function 1
-    link                           JSBuiltin                                        DontEnum|Function 1
-    moduleDeclarationInstantiation moduleLoaderObjectModuleDeclarationInstantiation DontEnum|Function 2
-    moduleEvaluation               JSBuiltin                                        DontEnum|Function 2
-    evaluate                       moduleLoaderObjectEvaluate                       DontEnum|Function 2
-    provide                        JSBuiltin                                        DontEnum|Function 3
-    loadAndEvaluateModule          JSBuiltin                                        DontEnum|Function 2
-    loadModule                     JSBuiltin                                        DontEnum|Function 2
-    linkAndEvaluateModule          JSBuiltin                                        DontEnum|Function 1
-    parseModule                    moduleLoaderObjectParseModule                    DontEnum|Function 2
-    requestedModules               moduleLoaderObjectRequestedModules               DontEnum|Function 1
-    resolve                        moduleLoaderObjectResolve                        DontEnum|Function 1
-    fetch                          moduleLoaderObjectFetch                          DontEnum|Function 1
-    translate                      moduleLoaderObjectTranslate                      DontEnum|Function 2
-    instantiate                    moduleLoaderObjectInstantiate                    DontEnum|Function 2
-@end
-*/
-
-ModuleLoaderObject::ModuleLoaderObject(VM&amp; vm, Structure* structure)
-    : JSNonFinalObject(vm, structure)
-{
-}
-
-void ModuleLoaderObject::finishCreation(VM&amp; vm, JSGlobalObject* globalObject)
-{
-    Base::finishCreation(vm);
-    ASSERT(inherits(info()));
-    putDirectWithoutTransition(vm, Identifier::fromString(&amp;vm, &quot;registry&quot;), JSMap::create(vm, globalObject-&gt;mapStructure()));
-}
-
-// ------------------------------ Functions --------------------------------
-
-static String printableModuleKey(ExecState* exec, JSValue key)
-{
-    if (key.isString() || key.isSymbol())
-        return key.toPropertyKey(exec).impl();
-    return exec-&gt;propertyNames().emptyIdentifier.impl();
-}
-
-JSValue ModuleLoaderObject::provide(ExecState* exec, JSValue key, Status status, const String&amp; source)
-{
-    JSObject* function = jsCast&lt;JSObject*&gt;(get(exec, exec-&gt;propertyNames().builtinNames().providePublicName()));
-    CallData callData;
-    CallType callType = JSC::getCallData(function, callData);
-    ASSERT(callType != CallType::None);
-
-    MarkedArgumentBuffer arguments;
-    arguments.append(key);
-    arguments.append(jsNumber(status));
-    arguments.append(jsString(exec, source));
-
-    return call(exec, function, callType, callData, this, arguments);
-}
-
-JSInternalPromise* ModuleLoaderObject::loadAndEvaluateModule(ExecState* exec, JSValue moduleName, JSValue referrer)
-{
-    JSObject* function = jsCast&lt;JSObject*&gt;(get(exec, exec-&gt;propertyNames().builtinNames().loadAndEvaluateModulePublicName()));
-    CallData callData;
-    CallType callType = JSC::getCallData(function, callData);
-    ASSERT(callType != CallType::None);
-
-    MarkedArgumentBuffer arguments;
-    arguments.append(moduleName);
-    arguments.append(referrer);
-
-    return jsCast&lt;JSInternalPromise*&gt;(call(exec, function, callType, callData, this, arguments));
-}
-
-JSInternalPromise* ModuleLoaderObject::loadModule(ExecState* exec, JSValue moduleName, JSValue referrer)
-{
-    JSObject* function = jsCast&lt;JSObject*&gt;(get(exec, exec-&gt;propertyNames().builtinNames().loadModulePublicName()));
-    CallData callData;
-    CallType callType = JSC::getCallData(function, callData);
-    ASSERT(callType != CallType::None);
-
-    MarkedArgumentBuffer arguments;
-    arguments.append(moduleName);
-    arguments.append(referrer);
-
-    return jsCast&lt;JSInternalPromise*&gt;(call(exec, function, callType, callData, this, arguments));
-}
-
-JSInternalPromise* ModuleLoaderObject::linkAndEvaluateModule(ExecState* exec, JSValue moduleKey)
-{
-    JSObject* function = jsCast&lt;JSObject*&gt;(get(exec, exec-&gt;propertyNames().builtinNames().linkAndEvaluateModulePublicName()));
-    CallData callData;
-    CallType callType = JSC::getCallData(function, callData);
-    ASSERT(callType != CallType::None);
-
-    MarkedArgumentBuffer arguments;
-    arguments.append(moduleKey);
-
-    return jsCast&lt;JSInternalPromise*&gt;(call(exec, function, callType, callData, this, arguments));
-}
-
-JSInternalPromise* ModuleLoaderObject::resolve(ExecState* exec, JSValue name, JSValue referrer)
-{
-    if (Options::dumpModuleLoadingState())
-        dataLog(&quot;Loader [resolve] &quot;, printableModuleKey(exec, name), &quot;\n&quot;);
-
-    JSGlobalObject* globalObject = exec-&gt;lexicalGlobalObject();
-    if (globalObject-&gt;globalObjectMethodTable()-&gt;moduleLoaderResolve)
-        return globalObject-&gt;globalObjectMethodTable()-&gt;moduleLoaderResolve(globalObject, exec, name, referrer);
-    JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject);
-    deferred-&gt;resolve(exec, name);
-    return deferred-&gt;promise();
-}
-
-JSInternalPromise* ModuleLoaderObject::fetch(ExecState* exec, JSValue key)
-{
-    if (Options::dumpModuleLoadingState())
-        dataLog(&quot;Loader [fetch] &quot;, printableModuleKey(exec, key), &quot;\n&quot;);
-
-    JSGlobalObject* globalObject = exec-&gt;lexicalGlobalObject();
-    if (globalObject-&gt;globalObjectMethodTable()-&gt;moduleLoaderFetch)
-        return globalObject-&gt;globalObjectMethodTable()-&gt;moduleLoaderFetch(globalObject, exec, key);
-    JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject);
-    String moduleKey = key.toString(exec)-&gt;value(exec);
-    if (exec-&gt;hadException()) {
-        JSValue exception = exec-&gt;exception()-&gt;value();
-        exec-&gt;clearException();
-        deferred-&gt;reject(exec, exception);
-        return deferred-&gt;promise();
-    }
-    deferred-&gt;reject(exec, createError(exec, makeString(&quot;Could not open the module '&quot;, moduleKey, &quot;'.&quot;)));
-    return deferred-&gt;promise();
-}
-
-JSInternalPromise* ModuleLoaderObject::translate(ExecState* exec, JSValue key, JSValue payload)
-{
-    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, key, payload);
-    JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject);
-    deferred-&gt;resolve(exec, payload);
-    return deferred-&gt;promise();
-}
-
-JSInternalPromise* ModuleLoaderObject::instantiate(ExecState* exec, JSValue key, JSValue source)
-{
-    if (Options::dumpModuleLoadingState())
-        dataLog(&quot;Loader [instantiate] &quot;, printableModuleKey(exec, key), &quot;\n&quot;);
-
-    JSGlobalObject* globalObject = exec-&gt;lexicalGlobalObject();
-    if (globalObject-&gt;globalObjectMethodTable()-&gt;moduleLoaderInstantiate)
-        return globalObject-&gt;globalObjectMethodTable()-&gt;moduleLoaderInstantiate(globalObject, exec, key, source);
-    JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject);
-    deferred-&gt;resolve(exec, jsUndefined());
-    return deferred-&gt;promise();
-}
-
-JSValue ModuleLoaderObject::evaluate(ExecState* exec, JSValue key, JSValue moduleRecordValue)
-{
-    if (Options::dumpModuleLoadingState())
-        dataLog(&quot;Loader [evaluate] &quot;, printableModuleKey(exec, key), &quot;\n&quot;);
-
-    JSGlobalObject* globalObject = exec-&gt;lexicalGlobalObject();
-    if (globalObject-&gt;globalObjectMethodTable()-&gt;moduleLoaderEvaluate)
-        return globalObject-&gt;globalObjectMethodTable()-&gt;moduleLoaderEvaluate(globalObject, exec, key, moduleRecordValue);
-
-    JSModuleRecord* moduleRecord = jsDynamicCast&lt;JSModuleRecord*&gt;(moduleRecordValue);
-    if (!moduleRecord)
-        return jsUndefined();
-    return moduleRecord-&gt;evaluate(exec);
-}
-
-EncodedJSValue JSC_HOST_CALL moduleLoaderObjectParseModule(ExecState* exec)
-{
-    VM&amp; vm = exec-&gt;vm();
-    const Identifier moduleKey = exec-&gt;argument(0).toPropertyKey(exec);
-    if (exec-&gt;hadException())
-        return JSValue::encode(jsUndefined());
-
-    String source = exec-&gt;argument(1).toString(exec)-&gt;value(exec);
-    if (exec-&gt;hadException())
-        return JSValue::encode(jsUndefined());
-
-    SourceCode sourceCode = makeSource(source, moduleKey.impl());
-
-    CodeProfiling profile(sourceCode);
-
-    ParserError error;
-    std::unique_ptr&lt;ModuleProgramNode&gt; moduleProgramNode = parse&lt;ModuleProgramNode&gt;(
-        &amp;vm, sourceCode, Identifier(), JSParserBuiltinMode::NotBuiltin,
-        JSParserStrictMode::Strict, SourceParseMode::ModuleAnalyzeMode, SuperBinding::NotNeeded, error);
-
-    if (error.isValid()) {
-        throwVMError(exec, error.toErrorObject(exec-&gt;lexicalGlobalObject(), sourceCode));
-        return JSValue::encode(jsUndefined());
-    }
-    ASSERT(moduleProgramNode);
-
-    ModuleAnalyzer moduleAnalyzer(exec, moduleKey, sourceCode, moduleProgramNode-&gt;varDeclarations(), moduleProgramNode-&gt;lexicalVariables());
-    JSModuleRecord* moduleRecord = moduleAnalyzer.analyze(*moduleProgramNode);
-
-    return JSValue::encode(moduleRecord);
-}
-
-EncodedJSValue JSC_HOST_CALL moduleLoaderObjectRequestedModules(ExecState* exec)
-{
-    JSModuleRecord* moduleRecord = jsDynamicCast&lt;JSModuleRecord*&gt;(exec-&gt;argument(0));
-    if (!moduleRecord)
-        return JSValue::encode(constructEmptyArray(exec, nullptr));
-
-    JSArray* result = constructEmptyArray(exec, nullptr, moduleRecord-&gt;requestedModules().size());
-    if (UNLIKELY(exec-&gt;hadException()))
-        JSValue::encode(jsUndefined());
-    size_t i = 0;
-    for (auto&amp; key : moduleRecord-&gt;requestedModules())
-        result-&gt;putDirectIndex(exec, i++, jsString(exec, key.get()));
-
-    return JSValue::encode(result);
-}
-
-EncodedJSValue JSC_HOST_CALL moduleLoaderObjectModuleDeclarationInstantiation(ExecState* exec)
-{
-    JSModuleRecord* moduleRecord = jsDynamicCast&lt;JSModuleRecord*&gt;(exec-&gt;argument(0));
-    if (!moduleRecord)
-        return JSValue::encode(jsUndefined());
-
-    if (Options::dumpModuleLoadingState())
-        dataLog(&quot;Loader [link] &quot;, moduleRecord-&gt;moduleKey(), &quot;\n&quot;);
-
-    moduleRecord-&gt;link(exec);
-    if (exec-&gt;hadException())
-        return JSValue::encode(jsUndefined());
-
-    return JSValue::encode(jsUndefined());
-}
-
-// ------------------------------ Hook Functions ---------------------------
-
-EncodedJSValue JSC_HOST_CALL moduleLoaderObjectResolve(ExecState* exec)
-{
-    // Hook point, Loader.resolve.
-    // https://whatwg.github.io/loader/#browser-resolve
-    // Take the name and resolve it to the unique identifier for the resource location.
-    // For example, take the &quot;jquery&quot; and return the URL for the resource.
-    ModuleLoaderObject* loader = jsDynamicCast&lt;ModuleLoaderObject*&gt;(exec-&gt;thisValue());
-    if (!loader)
-        return JSValue::encode(jsUndefined());
-    return JSValue::encode(loader-&gt;resolve(exec, exec-&gt;argument(0), exec-&gt;argument(1)));
-}
-
-EncodedJSValue JSC_HOST_CALL moduleLoaderObjectFetch(ExecState* exec)
-{
-    // Hook point, Loader.fetch
-    // https://whatwg.github.io/loader/#browser-fetch
-    // Take the key and fetch the resource actually.
-    // For example, JavaScriptCore shell can provide the hook fetching the resource
-    // from the local file system.
-    ModuleLoaderObject* loader = jsDynamicCast&lt;ModuleLoaderObject*&gt;(exec-&gt;thisValue());
-    if (!loader)
-        return JSValue::encode(jsUndefined());
-    return JSValue::encode(loader-&gt;fetch(exec, exec-&gt;argument(0)));
-}
-
-EncodedJSValue JSC_HOST_CALL moduleLoaderObjectTranslate(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.
-    ModuleLoaderObject* loader = jsDynamicCast&lt;ModuleLoaderObject*&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)));
-}
-
-EncodedJSValue JSC_HOST_CALL moduleLoaderObjectInstantiate(ExecState* exec)
-{
-    // Hook point, Loader.instantiate
-    // https://whatwg.github.io/loader/#browser-instantiate
-    // Take the key and the translated source code, and instantiate the module record
-    // by parsing the module source code.
-    // It has the chance to provide the optional module instance that is different from
-    // the ordinary one.
-    ModuleLoaderObject* loader = jsDynamicCast&lt;ModuleLoaderObject*&gt;(exec-&gt;thisValue());
-    if (!loader)
-        return JSValue::encode(jsUndefined());
-    return JSValue::encode(loader-&gt;instantiate(exec, exec-&gt;argument(0), exec-&gt;argument(1)));
-}
-
-// ------------------- Additional Hook Functions ---------------------------
-
-EncodedJSValue JSC_HOST_CALL moduleLoaderObjectEvaluate(ExecState* exec)
-{
-    // To instrument and retrieve the errors raised from the module execution,
-    // we inserted the hook point here.
-
-    ModuleLoaderObject* loader = jsDynamicCast&lt;ModuleLoaderObject*&gt;(exec-&gt;thisValue());
-    if (!loader)
-        return JSValue::encode(jsUndefined());
-    return JSValue::encode(loader-&gt;evaluate(exec, exec-&gt;argument(0), exec-&gt;argument(1)));
-}
-
-} // namespace JSC
</del></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeModuleLoaderObjecth"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/runtime/ModuleLoaderObject.h (204329 => 204330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ModuleLoaderObject.h        2016-08-10 08:18:03 UTC (rev 204329)
+++ trunk/Source/JavaScriptCore/runtime/ModuleLoaderObject.h        2016-08-10 08:37:06 UTC (rev 204330)
</span><span class="lines">@@ -1,86 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ModuleLoaderObject_h
-#define ModuleLoaderObject_h
-
-#include &quot;JSObject.h&quot;
-
-namespace JSC {
-
-class JSInternalPromise;
-
-class ModuleLoaderObject : public JSNonFinalObject {
-private:
-    ModuleLoaderObject(VM&amp;, Structure*);
-public:
-    typedef JSNonFinalObject Base;
-    static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable;
-
-    enum Status {
-        Fetch = 1,
-        Translate = 2,
-        Instantiate = 3,
-        ResolveDependencies = 4,
-        Link = 5,
-        Ready = 6,
-    };
-
-    static ModuleLoaderObject* create(VM&amp; vm, JSGlobalObject* globalObject, Structure* structure)
-    {
-        ModuleLoaderObject* object = new (NotNull, allocateCell&lt;ModuleLoaderObject&gt;(vm.heap)) ModuleLoaderObject(vm, structure);
-        object-&gt;finishCreation(vm, globalObject);
-        return object;
-    }
-
-    DECLARE_INFO;
-
-    static Structure* createStructure(VM&amp; vm, JSGlobalObject* globalObject, JSValue prototype)
-    {
-        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
-    }
-
-    // APIs to control the module loader.
-    JSValue provide(ExecState*, JSValue key, Status, const String&amp;);
-    JSInternalPromise* loadAndEvaluateModule(ExecState*, JSValue moduleName, JSValue referrer);
-    JSInternalPromise* loadModule(ExecState*, JSValue moduleName, JSValue referrer);
-    JSInternalPromise* linkAndEvaluateModule(ExecState*, JSValue moduleKey);
-
-    // Platform dependent hooked APIs.
-    JSInternalPromise* resolve(ExecState*, JSValue name, JSValue referrer);
-    JSInternalPromise* fetch(ExecState*, JSValue key);
-    JSInternalPromise* translate(ExecState*, JSValue key, JSValue payload);
-    JSInternalPromise* instantiate(ExecState*, JSValue key, JSValue source);
-
-    // Additional platform dependent hooked APIs.
-    JSValue evaluate(ExecState*, JSValue key, JSValue moduleRecord);
-
-protected:
-    void finishCreation(VM&amp;, JSGlobalObject*);
-};
-
-} // namespace JSC
-
-#endif // ModuleLoaderObject_h
</del></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeModuleLoaderPrototypecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/runtime/ModuleLoaderPrototype.cpp (0 => 204330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ModuleLoaderPrototype.cpp                                (rev 0)
+++ trunk/Source/JavaScriptCore/runtime/ModuleLoaderPrototype.cpp        2016-08-10 08:37:06 UTC (rev 204330)
</span><span class="lines">@@ -0,0 +1,239 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;ModuleLoaderPrototype.h&quot;
+
+#include &quot;BuiltinNames.h&quot;
+#include &quot;CodeProfiling.h&quot;
+#include &quot;Error.h&quot;
+#include &quot;Exception.h&quot;
+#include &quot;JSCInlines.h&quot;
+#include &quot;JSGlobalObjectFunctions.h&quot;
+#include &quot;JSInternalPromise.h&quot;
+#include &quot;JSInternalPromiseDeferred.h&quot;
+#include &quot;JSMap.h&quot;
+#include &quot;JSModuleEnvironment.h&quot;
+#include &quot;JSModuleLoader.h&quot;
+#include &quot;JSModuleRecord.h&quot;
+#include &quot;ModuleAnalyzer.h&quot;
+#include &quot;Nodes.h&quot;
+#include &quot;Parser.h&quot;
+#include &quot;ParserError.h&quot;
+
+namespace JSC {
+
+static EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeParseModule(ExecState*);
+static EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeRequestedModules(ExecState*);
+static EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeEvaluate(ExecState*);
+static EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeModuleDeclarationInstantiation(ExecState*);
+static EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeResolve(ExecState*);
+static EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeFetch(ExecState*);
+static EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeTranslate(ExecState*);
+static EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeInstantiate(ExecState*);
+
+}
+
+#include &quot;ModuleLoaderPrototype.lut.h&quot;
+
+namespace JSC {
+
+STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(ModuleLoaderPrototype);
+
+const ClassInfo ModuleLoaderPrototype::s_info = { &quot;ModuleLoader&quot;, &amp;Base::s_info, &amp;moduleLoaderPrototypeTable, CREATE_METHOD_TABLE(ModuleLoaderPrototype) };
+
+/* Source for ModuleLoaderPrototype.lut.h
+@begin moduleLoaderPrototypeTable
+    setStateToMax                  JSBuiltin                                        DontEnum|Function 2
+    newRegistryEntry               JSBuiltin                                        DontEnum|Function 1
+    ensureRegistered               JSBuiltin                                        DontEnum|Function 1
+    forceFulfillPromise            JSBuiltin                                        DontEnum|Function 2
+    fulfillFetch                   JSBuiltin                                        DontEnum|Function 2
+    fulfillTranslate               JSBuiltin                                        DontEnum|Function 2
+    fulfillInstantiate             JSBuiltin                                        DontEnum|Function 2
+    commitInstantiated             JSBuiltin                                        DontEnum|Function 3
+    instantiation                  JSBuiltin                                        DontEnum|Function 3
+    requestFetch                   JSBuiltin                                        DontEnum|Function 1
+    requestTranslate               JSBuiltin                                        DontEnum|Function 1
+    requestInstantiate             JSBuiltin                                        DontEnum|Function 1
+    requestResolveDependencies     JSBuiltin                                        DontEnum|Function 1
+    requestInstantiateAll          JSBuiltin                                        DontEnum|Function 1
+    requestLink                    JSBuiltin                                        DontEnum|Function 1
+    requestReady                   JSBuiltin                                        DontEnum|Function 1
+    link                           JSBuiltin                                        DontEnum|Function 1
+    moduleDeclarationInstantiation moduleLoaderPrototypeModuleDeclarationInstantiation DontEnum|Function 2
+    moduleEvaluation               JSBuiltin                                        DontEnum|Function 2
+    evaluate                       moduleLoaderPrototypeEvaluate                       DontEnum|Function 2
+    provide                        JSBuiltin                                        DontEnum|Function 3
+    loadAndEvaluateModule          JSBuiltin                                        DontEnum|Function 2
+    loadModule                     JSBuiltin                                        DontEnum|Function 2
+    linkAndEvaluateModule          JSBuiltin                                        DontEnum|Function 1
+    parseModule                    moduleLoaderPrototypeParseModule                    DontEnum|Function 2
+    requestedModules               moduleLoaderPrototypeRequestedModules               DontEnum|Function 1
+    resolve                        moduleLoaderPrototypeResolve                        DontEnum|Function 1
+    fetch                          moduleLoaderPrototypeFetch                          DontEnum|Function 1
+    translate                      moduleLoaderPrototypeTranslate                      DontEnum|Function 2
+    instantiate                    moduleLoaderPrototypeInstantiate                    DontEnum|Function 2
+@end
+*/
+
+ModuleLoaderPrototype::ModuleLoaderPrototype(VM&amp; vm, Structure* structure)
+    : JSNonFinalObject(vm, structure)
+{
+}
+
+// ------------------------------ Functions --------------------------------
+
+EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeParseModule(ExecState* exec)
+{
+    VM&amp; vm = exec-&gt;vm();
+    const Identifier moduleKey = exec-&gt;argument(0).toPropertyKey(exec);
+    if (exec-&gt;hadException())
+        return JSValue::encode(jsUndefined());
+
+    String source = exec-&gt;argument(1).toString(exec)-&gt;value(exec);
+    if (exec-&gt;hadException())
+        return JSValue::encode(jsUndefined());
+
+    SourceCode sourceCode = makeSource(source, moduleKey.impl());
+
+    CodeProfiling profile(sourceCode);
+
+    ParserError error;
+    std::unique_ptr&lt;ModuleProgramNode&gt; moduleProgramNode = parse&lt;ModuleProgramNode&gt;(
+        &amp;vm, sourceCode, Identifier(), JSParserBuiltinMode::NotBuiltin,
+        JSParserStrictMode::Strict, SourceParseMode::ModuleAnalyzeMode, SuperBinding::NotNeeded, error);
+
+    if (error.isValid()) {
+        throwVMError(exec, error.toErrorObject(exec-&gt;lexicalGlobalObject(), sourceCode));
+        return JSValue::encode(jsUndefined());
+    }
+    ASSERT(moduleProgramNode);
+
+    ModuleAnalyzer moduleAnalyzer(exec, moduleKey, sourceCode, moduleProgramNode-&gt;varDeclarations(), moduleProgramNode-&gt;lexicalVariables());
+    JSModuleRecord* moduleRecord = moduleAnalyzer.analyze(*moduleProgramNode);
+
+    return JSValue::encode(moduleRecord);
+}
+
+EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeRequestedModules(ExecState* exec)
+{
+    JSModuleRecord* moduleRecord = jsDynamicCast&lt;JSModuleRecord*&gt;(exec-&gt;argument(0));
+    if (!moduleRecord)
+        return JSValue::encode(constructEmptyArray(exec, nullptr));
+
+    JSArray* result = constructEmptyArray(exec, nullptr, moduleRecord-&gt;requestedModules().size());
+    if (UNLIKELY(exec-&gt;hadException()))
+        JSValue::encode(jsUndefined());
+    size_t i = 0;
+    for (auto&amp; key : moduleRecord-&gt;requestedModules())
+        result-&gt;putDirectIndex(exec, i++, jsString(exec, key.get()));
+
+    return JSValue::encode(result);
+}
+
+EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeModuleDeclarationInstantiation(ExecState* exec)
+{
+    JSModuleRecord* moduleRecord = jsDynamicCast&lt;JSModuleRecord*&gt;(exec-&gt;argument(0));
+    if (!moduleRecord)
+        return JSValue::encode(jsUndefined());
+
+    if (Options::dumpModuleLoadingState())
+        dataLog(&quot;Loader [link] &quot;, moduleRecord-&gt;moduleKey(), &quot;\n&quot;);
+
+    moduleRecord-&gt;link(exec);
+    if (exec-&gt;hadException())
+        return JSValue::encode(jsUndefined());
+
+    return JSValue::encode(jsUndefined());
+}
+
+// ------------------------------ Hook Functions ---------------------------
+
+EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeResolve(ExecState* exec)
+{
+    // Hook point, Loader.resolve.
+    // https://whatwg.github.io/loader/#browser-resolve
+    // Take the name and resolve it to the unique identifier for the resource location.
+    // For example, take the &quot;jquery&quot; and return the URL for the resource.
+    JSModuleLoader* loader = jsDynamicCast&lt;JSModuleLoader*&gt;(exec-&gt;thisValue());
+    if (!loader)
+        return JSValue::encode(jsUndefined());
+    return JSValue::encode(loader-&gt;resolve(exec, exec-&gt;argument(0), exec-&gt;argument(1)));
+}
+
+EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeFetch(ExecState* exec)
+{
+    // Hook point, Loader.fetch
+    // https://whatwg.github.io/loader/#browser-fetch
+    // Take the key and fetch the resource actually.
+    // For example, JavaScriptCore shell can provide the hook fetching the resource
+    // from the local file system.
+    JSModuleLoader* loader = jsDynamicCast&lt;JSModuleLoader*&gt;(exec-&gt;thisValue());
+    if (!loader)
+        return JSValue::encode(jsUndefined());
+    return JSValue::encode(loader-&gt;fetch(exec, exec-&gt;argument(0)));
+}
+
+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)));
+}
+
+EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeInstantiate(ExecState* exec)
+{
+    // Hook point, Loader.instantiate
+    // https://whatwg.github.io/loader/#browser-instantiate
+    // Take the key and the translated source code, and instantiate the module record
+    // by parsing the module source code.
+    // It has the chance to provide the optional module instance that is different from
+    // the ordinary one.
+    JSModuleLoader* loader = jsDynamicCast&lt;JSModuleLoader*&gt;(exec-&gt;thisValue());
+    if (!loader)
+        return JSValue::encode(jsUndefined());
+    return JSValue::encode(loader-&gt;instantiate(exec, exec-&gt;argument(0), exec-&gt;argument(1)));
+}
+
+// ------------------- Additional Hook Functions ---------------------------
+
+EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeEvaluate(ExecState* exec)
+{
+    // To instrument and retrieve the errors raised from the module execution,
+    // we inserted the hook point here.
+
+    JSModuleLoader* loader = jsDynamicCast&lt;JSModuleLoader*&gt;(exec-&gt;thisValue());
+    if (!loader)
+        return JSValue::encode(jsUndefined());
+    return JSValue::encode(loader-&gt;evaluate(exec, exec-&gt;argument(0), exec-&gt;argument(1)));
+}
+
+} // namespace JSC
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeModuleLoaderPrototypehfromrev204329trunkSourceJavaScriptCoreruntimeModuleLoaderObjecth"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/runtime/ModuleLoaderPrototype.h (from rev 204329, trunk/Source/JavaScriptCore/runtime/ModuleLoaderObject.h) (0 => 204330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ModuleLoaderPrototype.h                                (rev 0)
+++ trunk/Source/JavaScriptCore/runtime/ModuleLoaderPrototype.h        2016-08-10 08:37:06 UTC (rev 204330)
</span><span class="lines">@@ -0,0 +1,57 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2016 Yusuke Suzuki &lt;utatane.tea@gmail.com&gt;.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include &quot;JSObject.h&quot;
+
+namespace JSC {
+
+class JSInternalPromise;
+
+class ModuleLoaderPrototype : public JSNonFinalObject {
+private:
+    ModuleLoaderPrototype(VM&amp;, Structure*);
+public:
+    typedef JSNonFinalObject Base;
+    static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable;
+
+    static ModuleLoaderPrototype* create(VM&amp; vm, JSGlobalObject*, Structure* structure)
+    {
+        ModuleLoaderPrototype* object = new (NotNull, allocateCell&lt;ModuleLoaderPrototype&gt;(vm.heap)) ModuleLoaderPrototype(vm, structure);
+        object-&gt;finishCreation(vm);
+        return object;
+    }
+
+    DECLARE_INFO;
+
+    static Structure* createStructure(VM&amp; vm, JSGlobalObject* globalObject, JSValue prototype)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
+    }
+};
+
+} // namespace JSC
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (204329 => 204330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-08-10 08:18:03 UTC (rev 204329)
+++ trunk/Source/WebCore/ChangeLog        2016-08-10 08:37:06 UTC (rev 204330)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2016-08-10  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
+
+        [ES6] Add ModuleLoaderPrototype and move methods to it
+        https://bugs.webkit.org/show_bug.cgi?id=160633
+
+        Reviewed by Saam Barati.
+
+        No behavior change.
+
+        * ForwardingHeaders/runtime/JSModuleLoader.h: Added.
+        * bindings/js/JSDOMWindowBase.cpp:
+        (WebCore::JSDOMWindowBase::moduleLoaderResolve):
+        (WebCore::JSDOMWindowBase::moduleLoaderFetch):
+        (WebCore::JSDOMWindowBase::moduleLoaderEvaluate):
+        * bindings/js/JSDOMWindowBase.h:
+        * bindings/js/JSModuleLoader.cpp:
+        (WebCore::JSModuleLoader::resolve):
+        (WebCore::JSModuleLoader::fetch):
+        (WebCore::JSModuleLoader::evaluate):
+        * bindings/js/JSModuleLoader.h:
+
</ins><span class="cx"> 2016-08-10  Per Arne Vollan  &lt;pvollan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Win] Warning fix.
</span></span></pre></div>
<a id="trunkSourceWebCoreForwardingHeadersruntimeJSModuleLoaderh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/ForwardingHeaders/runtime/JSModuleLoader.h (0 => 204330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ForwardingHeaders/runtime/JSModuleLoader.h                                (rev 0)
+++ trunk/Source/WebCore/ForwardingHeaders/runtime/JSModuleLoader.h        2016-08-10 08:37:06 UTC (rev 204330)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+#pragma once
+#include &lt;JavaScriptCore/JSModuleLoader.h&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMWindowBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp (204329 => 204330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp        2016-08-10 08:18:03 UTC (rev 204329)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp        2016-08-10 08:37:06 UTC (rev 204330)
</span><span class="lines">@@ -323,29 +323,29 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-JSC::JSInternalPromise* JSDOMWindowBase::moduleLoaderResolve(JSC::JSGlobalObject* globalObject, JSC::ExecState* exec, JSC::JSValue moduleName, JSC::JSValue importerModuleKey)
</del><ins>+JSC::JSInternalPromise* JSDOMWindowBase::moduleLoaderResolve(JSC::JSGlobalObject* globalObject, JSC::ExecState* exec, JSC::JSModuleLoader* moduleLoader, JSC::JSValue moduleName, JSC::JSValue importerModuleKey)
</ins><span class="cx"> {
</span><span class="cx">     JSDOMWindowBase* thisObject = JSC::jsCast&lt;JSDOMWindowBase*&gt;(globalObject);
</span><span class="cx">     if (RefPtr&lt;Document&gt; document = thisObject-&gt;wrapped().document())
</span><del>-        return document-&gt;moduleLoader()-&gt;resolve(globalObject, exec, moduleName, importerModuleKey);
</del><ins>+        return document-&gt;moduleLoader()-&gt;resolve(globalObject, exec, moduleLoader, moduleName, importerModuleKey);
</ins><span class="cx">     JSC::JSInternalPromiseDeferred* deferred = JSC::JSInternalPromiseDeferred::create(exec, globalObject);
</span><span class="cx">     return deferred-&gt;reject(exec, jsUndefined());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-JSC::JSInternalPromise* JSDOMWindowBase::moduleLoaderFetch(JSC::JSGlobalObject* globalObject, JSC::ExecState* exec, JSC::JSValue moduleKey)
</del><ins>+JSC::JSInternalPromise* JSDOMWindowBase::moduleLoaderFetch(JSC::JSGlobalObject* globalObject, JSC::ExecState* exec, JSC::JSModuleLoader* moduleLoader, JSC::JSValue moduleKey)
</ins><span class="cx"> {
</span><span class="cx">     JSDOMWindowBase* thisObject = JSC::jsCast&lt;JSDOMWindowBase*&gt;(globalObject);
</span><span class="cx">     if (RefPtr&lt;Document&gt; document = thisObject-&gt;wrapped().document())
</span><del>-        return document-&gt;moduleLoader()-&gt;fetch(globalObject, exec, moduleKey);
</del><ins>+        return document-&gt;moduleLoader()-&gt;fetch(globalObject, exec, moduleLoader, moduleKey);
</ins><span class="cx">     JSC::JSInternalPromiseDeferred* deferred = JSC::JSInternalPromiseDeferred::create(exec, globalObject);
</span><span class="cx">     return deferred-&gt;reject(exec, jsUndefined());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-JSC::JSValue JSDOMWindowBase::moduleLoaderEvaluate(JSC::JSGlobalObject* globalObject, JSC::ExecState* exec, JSC::JSValue moduleKey, JSC::JSValue moduleRecord)
</del><ins>+JSC::JSValue JSDOMWindowBase::moduleLoaderEvaluate(JSC::JSGlobalObject* globalObject, JSC::ExecState* exec, JSC::JSModuleLoader* moduleLoader, JSC::JSValue moduleKey, JSC::JSValue moduleRecord)
</ins><span class="cx"> {
</span><span class="cx">     JSDOMWindowBase* thisObject = JSC::jsCast&lt;JSDOMWindowBase*&gt;(globalObject);
</span><span class="cx">     if (RefPtr&lt;Document&gt; document = thisObject-&gt;wrapped().document())
</span><del>-        return document-&gt;moduleLoader()-&gt;evaluate(globalObject, exec, moduleKey, moduleRecord);
</del><ins>+        return document-&gt;moduleLoader()-&gt;evaluate(globalObject, exec, moduleLoader, moduleKey, moduleRecord);
</ins><span class="cx">     return JSC::jsUndefined();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMWindowBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h (204329 => 204330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h        2016-08-10 08:18:03 UTC (rev 204329)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h        2016-08-10 08:37:06 UTC (rev 204330)
</span><span class="lines">@@ -78,9 +78,9 @@
</span><span class="cx">         JSC::WatchpointSet m_windowCloseWatchpoints;
</span><span class="cx"> 
</span><span class="cx">     private:
</span><del>-        static JSC::JSInternalPromise* moduleLoaderResolve(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSValue, JSC::JSValue);
-        static JSC::JSInternalPromise* moduleLoaderFetch(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSValue);
-        static JSC::JSValue moduleLoaderEvaluate(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSValue, JSC::JSValue);
</del><ins>+        static JSC::JSInternalPromise* moduleLoaderResolve(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue, JSC::JSValue);
+        static JSC::JSInternalPromise* moduleLoaderFetch(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue);
+        static JSC::JSValue moduleLoaderEvaluate(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue, JSC::JSValue);
</ins><span class="cx"> 
</span><span class="cx">         RefPtr&lt;DOMWindow&gt; m_wrapped;
</span><span class="cx">         JSDOMWindowShell* m_shell;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSModuleLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSModuleLoader.cpp (204329 => 204330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSModuleLoader.cpp        2016-08-10 08:18:03 UTC (rev 204329)
+++ trunk/Source/WebCore/bindings/js/JSModuleLoader.cpp        2016-08-10 08:37:06 UTC (rev 204330)
</span><span class="lines">@@ -42,7 +42,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-JSC::JSInternalPromise* JSModuleLoader::resolve(JSC::JSGlobalObject* globalObject, JSC::ExecState* exec, JSC::JSValue moduleNameValue, JSC::JSValue importerModuleKey)
</del><ins>+JSC::JSInternalPromise* JSModuleLoader::resolve(JSC::JSGlobalObject* globalObject, JSC::ExecState* exec, JSC::JSModuleLoader*, JSC::JSValue moduleNameValue, JSC::JSValue importerModuleKey)
</ins><span class="cx"> {
</span><span class="cx">     JSC::JSInternalPromiseDeferred* deferred = JSC::JSInternalPromiseDeferred::create(exec, globalObject);
</span><span class="cx"> 
</span><span class="lines">@@ -82,7 +82,7 @@
</span><span class="cx">     return deferred-&gt;resolve(exec, jsString(exec, completedUrl.string()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-JSC::JSInternalPromise* JSModuleLoader::fetch(JSC::JSGlobalObject* globalObject, JSC::ExecState* exec, JSC::JSValue moduleKeyValue)
</del><ins>+JSC::JSInternalPromise* JSModuleLoader::fetch(JSC::JSGlobalObject* globalObject, JSC::ExecState* exec, JSC::JSModuleLoader*, JSC::JSValue moduleKeyValue)
</ins><span class="cx"> {
</span><span class="cx">     JSC::JSInternalPromiseDeferred* deferred = JSC::JSInternalPromiseDeferred::create(exec, globalObject);
</span><span class="cx"> 
</span><span class="lines">@@ -101,7 +101,7 @@
</span><span class="cx">     return deferred-&gt;promise();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-JSC::JSValue JSModuleLoader::evaluate(JSC::JSGlobalObject*, JSC::ExecState* exec, JSC::JSValue moduleKeyValue, JSC::JSValue moduleRecordValue)
</del><ins>+JSC::JSValue JSModuleLoader::evaluate(JSC::JSGlobalObject*, JSC::ExecState* exec, JSC::JSModuleLoader*, JSC::JSValue moduleKeyValue, JSC::JSValue moduleRecordValue)
</ins><span class="cx"> {
</span><span class="cx">     // FIXME: Currently, we only support JSModuleRecord.
</span><span class="cx">     // Once the reflective part of the module loader is supported, we will handle arbitrary values.
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSModuleLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSModuleLoader.h (204329 => 204330)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSModuleLoader.h        2016-08-10 08:18:03 UTC (rev 204329)
+++ trunk/Source/WebCore/bindings/js/JSModuleLoader.h        2016-08-10 08:37:06 UTC (rev 204330)
</span><span class="lines">@@ -23,8 +23,7 @@
</span><span class="cx">  * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef JSModuleLoader_h
-#define JSModuleLoader_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #include &lt;runtime/JSCJSValue.h&gt;
</span><span class="cx"> #include &lt;wtf/Noncopyable.h&gt;
</span><span class="lines">@@ -34,6 +33,7 @@
</span><span class="cx"> class ExecState;
</span><span class="cx"> class JSGlobalObject;
</span><span class="cx"> class JSInternalPromise;
</span><ins>+class JSModuleLoader;
</ins><span class="cx"> 
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -48,9 +48,9 @@
</span><span class="cx"> 
</span><span class="cx">     Document&amp; document() { return m_document; }
</span><span class="cx"> 
</span><del>-    JSC::JSInternalPromise* resolve(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSValue moduleName, JSC::JSValue importerModuleKey);
-    JSC::JSInternalPromise* fetch(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSValue moduleKey);
-    JSC::JSValue evaluate(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSValue moduleKey, JSC::JSValue moduleRecord);
</del><ins>+    JSC::JSInternalPromise* resolve(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue moduleName, JSC::JSValue importerModuleKey);
+    JSC::JSInternalPromise* fetch(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue moduleKey);
+    JSC::JSValue evaluate(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue moduleKey, JSC::JSValue moduleRecord);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     Document&amp; m_document;
</span><span class="lines">@@ -57,5 +57,3 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // JSModuleLoader_h
</del></span></pre>
</div>
</div>

</body>
</html>