[JSC] Remove ModuleLoaderPrototype
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 22 Apr 2018 13:44:58 +0000 (13:44 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 22 Apr 2018 13:44:58 +0000 (13:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=184784

Reviewed by Mark Lam.

When we introduce ModuleLoaderPrototype, ModuleLoader may be created by users and exposed to users.
However, the loader spec is abandoned. So we do not need to have ModuleLoaderPrototype and JSModuleLoader.
This patch merges ModuleLoaderPrototype's functionality into JSModuleLoader.

* CMakeLists.txt:
* DerivedSources.make:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Sources.txt:
* builtins/ModuleLoader.js: Renamed from Source/JavaScriptCore/builtins/ModuleLoaderPrototype.js.
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::visitChildren):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::proxyRevokeStructure const):
(JSC::JSGlobalObject::moduleLoaderStructure const): Deleted.
* runtime/JSModuleLoader.cpp:
(JSC::moduleLoaderParseModule):
(JSC::moduleLoaderRequestedModules):
(JSC::moduleLoaderModuleDeclarationInstantiation):
(JSC::moduleLoaderResolve):
(JSC::moduleLoaderResolveSync):
(JSC::moduleLoaderFetch):
(JSC::moduleLoaderGetModuleNamespaceObject):
(JSC::moduleLoaderEvaluate):
* runtime/JSModuleLoader.h:
* runtime/ModuleLoaderPrototype.cpp: Removed.
* runtime/ModuleLoaderPrototype.h: Removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230900 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
Source/JavaScriptCore/CMakeLists.txt
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/DerivedSources.make
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/Sources.txt
Source/JavaScriptCore/builtins/ModuleLoader.js [moved from Source/JavaScriptCore/builtins/ModuleLoaderPrototype.js with 100% similarity]
Source/JavaScriptCore/runtime/JSGlobalObject.cpp
Source/JavaScriptCore/runtime/JSGlobalObject.h
Source/JavaScriptCore/runtime/JSModuleLoader.cpp
Source/JavaScriptCore/runtime/JSModuleLoader.h
Source/JavaScriptCore/runtime/ModuleLoaderPrototype.cpp [deleted file]
Source/JavaScriptCore/runtime/ModuleLoaderPrototype.h [deleted file]

index 9207da6..5cc6a7b 100644 (file)
@@ -75,11 +75,11 @@ set(JavaScriptCore_OBJECT_LUT_SOURCES
     runtime/JSDataViewPrototype.cpp
     runtime/JSGlobalObject.cpp
     runtime/JSInternalPromiseConstructor.cpp
+    runtime/JSModuleLoader.cpp
     runtime/JSONObject.cpp
     runtime/JSPromiseConstructor.cpp
     runtime/JSPromisePrototype.cpp
     runtime/MapPrototype.cpp
-    runtime/ModuleLoaderPrototype.cpp
     runtime/NumberConstructor.cpp
     runtime/NumberPrototype.cpp
     runtime/ObjectConstructor.cpp
@@ -1103,7 +1103,7 @@ set(JavaScriptCore_BUILTINS_SOURCES
     ${JAVASCRIPTCORE_DIR}/builtins/IteratorPrototype.js
     ${JAVASCRIPTCORE_DIR}/builtins/MapIteratorPrototype.js
     ${JAVASCRIPTCORE_DIR}/builtins/MapPrototype.js
-    ${JAVASCRIPTCORE_DIR}/builtins/ModuleLoaderPrototype.js
+    ${JAVASCRIPTCORE_DIR}/builtins/ModuleLoader.js
     ${JAVASCRIPTCORE_DIR}/builtins/NumberConstructor.js
     ${JAVASCRIPTCORE_DIR}/builtins/NumberPrototype.js
     ${JAVASCRIPTCORE_DIR}/builtins/ObjectConstructor.js
index 908b342..504a8aa 100644 (file)
@@ -1,3 +1,38 @@
+2018-04-22  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        [JSC] Remove ModuleLoaderPrototype
+        https://bugs.webkit.org/show_bug.cgi?id=184784
+
+        Reviewed by Mark Lam.
+
+        When we introduce ModuleLoaderPrototype, ModuleLoader may be created by users and exposed to users.
+        However, the loader spec is abandoned. So we do not need to have ModuleLoaderPrototype and JSModuleLoader.
+        This patch merges ModuleLoaderPrototype's functionality into JSModuleLoader.
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * Sources.txt:
+        * builtins/ModuleLoader.js: Renamed from Source/JavaScriptCore/builtins/ModuleLoaderPrototype.js.
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::init):
+        (JSC::JSGlobalObject::visitChildren):
+        * runtime/JSGlobalObject.h:
+        (JSC::JSGlobalObject::proxyRevokeStructure const):
+        (JSC::JSGlobalObject::moduleLoaderStructure const): Deleted.
+        * runtime/JSModuleLoader.cpp:
+        (JSC::moduleLoaderParseModule):
+        (JSC::moduleLoaderRequestedModules):
+        (JSC::moduleLoaderModuleDeclarationInstantiation):
+        (JSC::moduleLoaderResolve):
+        (JSC::moduleLoaderResolveSync):
+        (JSC::moduleLoaderFetch):
+        (JSC::moduleLoaderGetModuleNamespaceObject):
+        (JSC::moduleLoaderEvaluate):
+        * runtime/JSModuleLoader.h:
+        * runtime/ModuleLoaderPrototype.cpp: Removed.
+        * runtime/ModuleLoaderPrototype.h: Removed.
+
 2018-04-20  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GLIB] All API tests fail in debug builds
index 0fddc3a..8295690 100644 (file)
@@ -108,7 +108,7 @@ JavaScriptCore_BUILTINS_SOURCES = \
     $(JavaScriptCore)/builtins/IteratorPrototype.js \
     $(JavaScriptCore)/builtins/MapIteratorPrototype.js \
     $(JavaScriptCore)/builtins/MapPrototype.js \
-    $(JavaScriptCore)/builtins/ModuleLoaderPrototype.js \
+    $(JavaScriptCore)/builtins/ModuleLoader.js \
     $(JavaScriptCore)/builtins/NumberConstructor.js \
     $(JavaScriptCore)/builtins/NumberPrototype.js \
     $(JavaScriptCore)/builtins/ObjectConstructor.js \
@@ -158,11 +158,11 @@ OBJECT_LUT_HEADERS = \
     JSDataViewPrototype.lut.h \
     JSGlobalObject.lut.h \
     JSInternalPromiseConstructor.lut.h \
+    JSModuleLoader.lut.h \
     JSONObject.lut.h \
     JSPromisePrototype.lut.h \
     JSPromiseConstructor.lut.h \
     MapPrototype.lut.h \
-    ModuleLoaderPrototype.lut.h \
     NumberConstructor.lut.h \
     NumberPrototype.lut.h \
     ObjectConstructor.lut.h \
index db16ca5..488e5b3 100644 (file)
                996B731D1BDA08EF00331B84 /* JSGlobalObject.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B730B1BD9FA2C00331B84 /* JSGlobalObject.lut.h */; };
                996B731E1BDA08EF00331B84 /* JSPromiseConstructor.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C184E2417BFFA36007CB63A /* JSPromiseConstructor.lut.h */; };
                996B731F1BDA08EF00331B84 /* JSPromisePrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C184E2517BFFA36007CB63A /* JSPromisePrototype.lut.h */; };
-               996B73201BDA08EF00331B84 /* ModuleLoaderPrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B730C1BD9FA2C00331B84 /* ModuleLoaderPrototype.lut.h */; };
+               996B73201BDA08EF00331B84 /* JSModuleLoader.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B730C1BD9FA2C00331B84 /* JSModuleLoader.lut.h */; };
                996B73211BDA08EF00331B84 /* NumberPrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B730D1BD9FA2C00331B84 /* NumberPrototype.lut.h */; };
                996B73221BDA08EF00331B84 /* ObjectConstructor.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B730E1BD9FA2C00331B84 /* ObjectConstructor.lut.h */; };
                996B73231BDA08EF00331B84 /* ReflectObject.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B730F1BD9FA2C00331B84 /* ReflectObject.lut.h */; };
                E350708A1DC49BBF0089BCD6 /* DOMJITSignature.h in Headers */ = {isa = PBXBuildFile; fileRef = E35070891DC49BB60089BCD6 /* DOMJITSignature.h */; settings = {ATTRIBUTES = (Private, ); }; };
                E354622B1B6065D100545386 /* ConstructAbility.h in Headers */ = {isa = PBXBuildFile; fileRef = E354622A1B6065D100545386 /* ConstructAbility.h */; settings = {ATTRIBUTES = (Private, ); }; };
                E3555B8A1DAE03A500F36921 /* DOMJITCallDOMGetterSnippet.h in Headers */ = {isa = PBXBuildFile; fileRef = E3555B891DAE03A200F36921 /* DOMJITCallDOMGetterSnippet.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               E355F3531B7DC85300C50DC5 /* ModuleLoaderPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = E355F3511B7DC85300C50DC5 /* ModuleLoaderPrototype.h */; };
                E35CA1541DBC3A5C00F83516 /* DOMJITHeapRange.h in Headers */ = {isa = PBXBuildFile; fileRef = E35CA1521DBC3A5600F83516 /* DOMJITHeapRange.h */; settings = {ATTRIBUTES = (Private, ); }; };
                E35CA1561DBC3A5F00F83516 /* DOMJITAbstractHeap.h in Headers */ = {isa = PBXBuildFile; fileRef = E35CA1501DBC3A5600F83516 /* DOMJITAbstractHeap.h */; settings = {ATTRIBUTES = (Private, ); }; };
                E35E03601B7AB43E0073AD2A /* InspectorInstrumentationObject.h in Headers */ = {isa = PBXBuildFile; fileRef = E35E035E1B7AB43E0073AD2A /* InspectorInstrumentationObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
                996B73091BD9FA2C00331B84 /* ErrorPrototype.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ErrorPrototype.lut.h; sourceTree = "<group>"; };
                996B730A1BD9FA2C00331B84 /* JSDataViewPrototype.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDataViewPrototype.lut.h; sourceTree = "<group>"; };
                996B730B1BD9FA2C00331B84 /* JSGlobalObject.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalObject.lut.h; sourceTree = "<group>"; };
-               996B730C1BD9FA2C00331B84 /* ModuleLoaderPrototype.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModuleLoaderPrototype.lut.h; sourceTree = "<group>"; };
+               996B730C1BD9FA2C00331B84 /* JSModuleLoader.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSModuleLoader.lut.h; sourceTree = "<group>"; };
                996B730D1BD9FA2C00331B84 /* NumberPrototype.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NumberPrototype.lut.h; sourceTree = "<group>"; };
                996B730E1BD9FA2C00331B84 /* ObjectConstructor.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjectConstructor.lut.h; sourceTree = "<group>"; };
                996B730F1BD9FA2C00331B84 /* ReflectObject.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReflectObject.lut.h; sourceTree = "<group>"; };
                E178636C0D9BEEC300D74E75 /* InitializeThreading.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InitializeThreading.cpp; sourceTree = "<group>"; };
                E18E3A560DF9278C00D90B34 /* VM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = VM.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
                E18E3A570DF9278C00D90B34 /* VM.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = VM.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
-               E30677971B8BC6F5003F87F0 /* ModuleLoaderPrototype.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = ModuleLoaderPrototype.js; sourceTree = "<group>"; };
+               E30677971B8BC6F5003F87F0 /* ModuleLoader.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = ModuleLoader.js; sourceTree = "<group>"; };
                E31618101EC5FE080006A218 /* DOMAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMAnnotation.h; sourceTree = "<group>"; };
                E31618111EC5FE080006A218 /* DOMAttributeGetterSetter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMAttributeGetterSetter.cpp; sourceTree = "<group>"; };
                E31618121EC5FE080006A218 /* DOMAttributeGetterSetter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMAttributeGetterSetter.h; sourceTree = "<group>"; };
                E35070891DC49BB60089BCD6 /* DOMJITSignature.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMJITSignature.h; sourceTree = "<group>"; };
                E354622A1B6065D100545386 /* ConstructAbility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConstructAbility.h; sourceTree = "<group>"; };
                E3555B891DAE03A200F36921 /* DOMJITCallDOMGetterSnippet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMJITCallDOMGetterSnippet.h; sourceTree = "<group>"; };
-               E355F3501B7DC85300C50DC5 /* ModuleLoaderPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ModuleLoaderPrototype.cpp; sourceTree = "<group>"; };
-               E355F3511B7DC85300C50DC5 /* ModuleLoaderPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModuleLoaderPrototype.h; sourceTree = "<group>"; };
                E35CA14F1DBC3A5600F83516 /* DOMJITAbstractHeap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMJITAbstractHeap.cpp; sourceTree = "<group>"; };
                E35CA1501DBC3A5600F83516 /* DOMJITAbstractHeap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMJITAbstractHeap.h; sourceTree = "<group>"; };
                E35CA1511DBC3A5600F83516 /* DOMJITHeapRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMJITHeapRange.cpp; sourceTree = "<group>"; };
                                BC18C52D0E16FCE100B34460 /* Lexer.lut.h */,
                                70DE9A081BE7D670005D89D9 /* LLIntAssembly.h */,
                                7035587E1C418458004BD7BF /* MapPrototype.lut.h */,
-                               996B730C1BD9FA2C00331B84 /* ModuleLoaderPrototype.lut.h */,
+                               996B730C1BD9FA2C00331B84 /* ModuleLoader.lut.h */,
                                BC2680E60E16D52300A06E92 /* NumberConstructor.lut.h */,
                                996B730D1BD9FA2C00331B84 /* NumberPrototype.lut.h */,
                                996B730E1BD9FA2C00331B84 /* ObjectConstructor.lut.h */,
                                90213E3C123A40C200D422F3 /* MemoryStatistics.h */,
                                7C008CE5187631B600955C24 /* Microtask.h */,
                                FE2A875F1F02381600EB31B2 /* MinimumReservedZoneSize.h */,
-                               E355F3501B7DC85300C50DC5 /* ModuleLoaderPrototype.cpp */,
-                               E355F3511B7DC85300C50DC5 /* ModuleLoaderPrototype.h */,
                                147341DD1DC2CE9600AA29BA /* ModuleProgramExecutable.cpp */,
                                147341D51DC02EB900AA29BA /* ModuleProgramExecutable.h */,
                                BC02E9080E1839DB000F9297 /* NativeErrorConstructor.cpp */,
                                E33F50881B844A1A00413856 /* InternalPromiseConstructor.js */,
                                7CF9BC5B1B65D9A3009DB1EF /* IteratorPrototype.js */,
                                7035587C1C418419004BD7BF /* MapPrototype.js */,
-                               E30677971B8BC6F5003F87F0 /* ModuleLoaderPrototype.js */,
+                               E30677971B8BC6F5003F87F0 /* ModuleLoader.js */,
                                A52704861D027C8800354C37 /* NumberConstructor.js */,
                                A15DE5C51C0FBF8D0089133D /* NumberPrototype.js */,
                                7CF9BC5C1B65D9B1009DB1EF /* ObjectConstructor.js */,
                                86C568E211A213EE0007F7F0 /* MIPSAssembler.h in Headers */,
                                C4703CD7192844CC0013FBEA /* models.py in Headers */,
                                E3794E761B77EB97005543AE /* ModuleAnalyzer.h in Headers */,
-                               E355F3531B7DC85300C50DC5 /* ModuleLoaderPrototype.h in Headers */,
-                               996B73201BDA08EF00331B84 /* ModuleLoaderPrototype.lut.h in Headers */,
+                               996B73201BDA08EF00331B84 /* ModuleLoader.lut.h in Headers */,
                                9F63434577274FAFB9336C38 /* ModuleNamespaceAccessCase.h in Headers */,
                                14AD910F1DCA92940014F9FE /* ModuleProgramCodeBlock.h in Headers */,
                                147341D61DC02EB900AA29BA /* ModuleProgramExecutable.h in Headers */,
index f372d5d..57f5d7b 100644 (file)
@@ -858,7 +858,6 @@ runtime/MatchResult.cpp
 runtime/MathCommon.cpp
 runtime/MathObject.cpp
 runtime/MemoryStatistics.cpp
-runtime/ModuleLoaderPrototype.cpp
 runtime/ModuleProgramExecutable.cpp
 runtime/NativeErrorConstructor.cpp
 runtime/NativeErrorPrototype.cpp
index a483177..d4674c0 100644 (file)
 #include "MarkedSpaceInlines.h"
 #include "MathObject.h"
 #include "Microtask.h"
-#include "ModuleLoaderPrototype.h"
 #include "NativeErrorConstructor.h"
 #include "NativeErrorPrototype.h"
 #include "NullGetterFunction.h"
@@ -650,8 +649,6 @@ m_ ## properName ## Structure.set(vm, this, instanceType::createStructure(vm, th
     
 #undef CREATE_PROTOTYPE_FOR_LAZY_TYPE
     
-    m_moduleLoaderPrototype.set(vm, this, ModuleLoaderPrototype::create(vm, this, ModuleLoaderPrototype::createStructure(vm, this, m_objectPrototype.get())));
-    
     // Constructors
 
     ObjectConstructor* objectConstructor = ObjectConstructor::create(vm, this, ObjectConstructor::createStructure(vm, this, m_functionPrototype.get()), m_objectPrototype.get());
@@ -779,8 +776,7 @@ putDirectWithoutTransition(vm, vm.propertyNames-> jsName, lowerName ## Construct
     ReflectObject* reflectObject = ReflectObject::create(vm, this, ReflectObject::createStructure(vm, this, m_objectPrototype.get()));
     putDirectWithoutTransition(vm, vm.propertyNames->Reflect, reflectObject, static_cast<unsigned>(PropertyAttribute::DontEnum));
 
-    m_moduleLoaderStructure.set(vm, this, JSModuleLoader::createStructure(vm, this, m_moduleLoaderPrototype.get()));
-    m_moduleLoader.set(vm, this, JSModuleLoader::create(globalExec(), vm, this, m_moduleLoaderStructure.get()));
+    m_moduleLoader.set(vm, this, JSModuleLoader::create(globalExec(), vm, this, JSModuleLoader::createStructure(vm, this, jsNull())));
     if (Options::exposeInternalModuleLoader())
         putDirectWithoutTransition(vm, vm.propertyNames->Loader, m_moduleLoader.get(), static_cast<unsigned>(PropertyAttribute::DontEnum));
 
@@ -1374,7 +1370,6 @@ void JSGlobalObject::visitChildren(JSCell* cell, SlotVisitor& visitor)
     visitor.append(thisObject->m_asyncGeneratorPrototype);
     visitor.append(thisObject->m_asyncIteratorPrototype);
     visitor.append(thisObject->m_asyncGeneratorFunctionPrototype);
-    visitor.append(thisObject->m_moduleLoaderPrototype);
 
     thisObject->m_debuggerScopeStructure.visit(visitor);
     thisObject->m_withScopeStructure.visit(visitor);
@@ -1425,7 +1420,6 @@ void JSGlobalObject::visitChildren(JSCell* cell, SlotVisitor& visitor)
     visitor.append(thisObject->m_proxyObjectStructure);
     visitor.append(thisObject->m_callableProxyObjectStructure);
     visitor.append(thisObject->m_proxyRevokeStructure);
-    visitor.append(thisObject->m_moduleLoaderStructure);
     
     visitor.append(thisObject->m_arrayBufferPrototype);
     visitor.append(thisObject->m_arrayBufferStructure);
index 570e4b8..db3f83f 100644 (file)
@@ -98,7 +98,7 @@ class DirectEvalExecutable;
 class LLIntOffsetsExtractor;
 class MapPrototype;
 class Microtask;
-class ModuleLoaderPrototype;
+class ModuleLoader;
 class ModuleProgramExecutable;
 class NativeErrorConstructor;
 class NullGetterFunction;
@@ -302,7 +302,6 @@ public:
     WriteBarrier<GeneratorFunctionPrototype> m_generatorFunctionPrototype;
     WriteBarrier<GeneratorPrototype> m_generatorPrototype;
     WriteBarrier<AsyncGeneratorPrototype> m_asyncGeneratorPrototype;
-    WriteBarrier<ModuleLoaderPrototype> m_moduleLoaderPrototype;
 
     LazyProperty<JSGlobalObject, Structure> m_debuggerScopeStructure;
     LazyProperty<JSGlobalObject, Structure> m_withScopeStructure;
@@ -358,7 +357,6 @@ public:
     WriteBarrier<Structure> m_proxyObjectStructure;
     WriteBarrier<Structure> m_callableProxyObjectStructure;
     WriteBarrier<Structure> m_proxyRevokeStructure;
-    WriteBarrier<Structure> m_moduleLoaderStructure;
     WriteBarrier<JSArrayBufferPrototype> m_arrayBufferPrototype;
     WriteBarrier<Structure> m_arrayBufferStructure;
 #if ENABLE(SHARED_ARRAY_BUFFER)
@@ -677,7 +675,6 @@ public:
     Structure* proxyObjectStructure() const { return m_proxyObjectStructure.get(); }
     Structure* callableProxyObjectStructure() const { return m_callableProxyObjectStructure.get(); }
     Structure* proxyRevokeStructure() const { return m_proxyRevokeStructure.get(); }
-    Structure* moduleLoaderStructure() const { return m_moduleLoaderStructure.get(); }
     Structure* restParameterStructure() const { return arrayStructureForIndexingTypeDuringAllocation(ArrayWithContiguous); }
 #if ENABLE(WEBASSEMBLY)
     Structure* webAssemblyModuleRecordStructure() const { return m_webAssemblyModuleRecordStructure.get(); }
index 908591d..6598d54 100644 (file)
 #include "JSInternalPromiseDeferred.h"
 #include "JSMap.h"
 #include "JSModuleEnvironment.h"
+#include "JSModuleNamespaceObject.h"
 #include "JSModuleRecord.h"
 #include "JSSourceCode.h"
 #include "ModuleAnalyzer.h"
-#include "ModuleLoaderPrototype.h"
 #include "Nodes.h"
 #include "ObjectConstructor.h"
 #include "Parser.h"
 #include "ParserError.h"
+#include "WebAssemblyPrototype.h"
+
+namespace JSC {
+
+static EncodedJSValue JSC_HOST_CALL moduleLoaderParseModule(ExecState*);
+static EncodedJSValue JSC_HOST_CALL moduleLoaderRequestedModules(ExecState*);
+static EncodedJSValue JSC_HOST_CALL moduleLoaderEvaluate(ExecState*);
+static EncodedJSValue JSC_HOST_CALL moduleLoaderModuleDeclarationInstantiation(ExecState*);
+static EncodedJSValue JSC_HOST_CALL moduleLoaderResolve(ExecState*);
+static EncodedJSValue JSC_HOST_CALL moduleLoaderResolveSync(ExecState*);
+static EncodedJSValue JSC_HOST_CALL moduleLoaderFetch(ExecState*);
+static EncodedJSValue JSC_HOST_CALL moduleLoaderGetModuleNamespaceObject(ExecState*);
+
+}
+
+#include "JSModuleLoader.lut.h"
 
 namespace JSC {
 
 STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(JSModuleLoader);
 
-const ClassInfo JSModuleLoader::s_info = { "ModuleLoader", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSModuleLoader) };
+const ClassInfo JSModuleLoader::s_info = { "ModuleLoader", &Base::s_info, &moduleLoaderTable, nullptr, CREATE_METHOD_TABLE(JSModuleLoader) };
+
+/* Source for JSModuleLoader.lut.h
+@begin moduleLoaderTable
+    ensureRegistered               JSBuiltin                                  DontEnum|Function 1
+    forceFulfillPromise            JSBuiltin                                  DontEnum|Function 2
+    fulfillFetch                   JSBuiltin                                  DontEnum|Function 2
+    requestFetch                   JSBuiltin                                  DontEnum|Function 3
+    requestInstantiate             JSBuiltin                                  DontEnum|Function 3
+    requestSatisfy                 JSBuiltin                                  DontEnum|Function 3
+    link                           JSBuiltin                                  DontEnum|Function 2
+    moduleDeclarationInstantiation moduleLoaderModuleDeclarationInstantiation DontEnum|Function 2
+    moduleEvaluation               JSBuiltin                                  DontEnum|Function 2
+    evaluate                       moduleLoaderEvaluate                       DontEnum|Function 3
+    provideFetch                   JSBuiltin                                  DontEnum|Function 2
+    loadAndEvaluateModule          JSBuiltin                                  DontEnum|Function 3
+    loadModule                     JSBuiltin                                  DontEnum|Function 3
+    linkAndEvaluateModule          JSBuiltin                                  DontEnum|Function 2
+    requestImportModule            JSBuiltin                                  DontEnum|Function 3
+    getModuleNamespaceObject       moduleLoaderGetModuleNamespaceObject       DontEnum|Function 1
+    parseModule                    moduleLoaderParseModule                    DontEnum|Function 2
+    requestedModules               moduleLoaderRequestedModules               DontEnum|Function 1
+    resolve                        moduleLoaderResolve                        DontEnum|Function 2
+    resolveSync                    moduleLoaderResolveSync                    DontEnum|Function 2
+    fetch                          moduleLoaderFetch                          DontEnum|Function 3
+@end
+*/
 
 JSModuleLoader::JSModuleLoader(VM& vm, Structure* structure)
     : JSNonFinalObject(vm, structure)
@@ -295,4 +337,163 @@ JSModuleNamespaceObject* JSModuleLoader::getModuleNamespaceObject(ExecState* exe
     return moduleRecord->getModuleNamespace(exec);
 }
 
+// ------------------------------ Functions --------------------------------
+
+EncodedJSValue JSC_HOST_CALL moduleLoaderParseModule(ExecState* exec)
+{
+    VM& vm = exec->vm();
+    auto scope = DECLARE_CATCH_SCOPE(vm);
+
+    JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, exec->lexicalGlobalObject());
+    scope.releaseAssertNoException();
+
+    auto reject = [&] {
+        JSValue exception = scope.exception();
+        scope.clearException();
+        auto result = deferred->reject(exec, exception);
+        scope.releaseAssertNoException();
+        return JSValue::encode(result);
+    };
+
+    const Identifier moduleKey = exec->argument(0).toPropertyKey(exec);
+    if (UNLIKELY(scope.exception()))
+        return reject();
+
+    JSValue source = exec->argument(1);
+    auto* jsSourceCode = jsCast<JSSourceCode*>(source);
+    SourceCode sourceCode = jsSourceCode->sourceCode();
+
+#if ENABLE(WEBASSEMBLY)
+    if (sourceCode.provider()->sourceType() == SourceProviderSourceType::WebAssembly)
+        return JSValue::encode(WebAssemblyPrototype::instantiate(exec, deferred, moduleKey, jsSourceCode));
+#endif
+
+    CodeProfiling profile(sourceCode);
+
+    ParserError error;
+    std::unique_ptr<ModuleProgramNode> moduleProgramNode = parse<ModuleProgramNode>(
+        &vm, sourceCode, Identifier(), JSParserBuiltinMode::NotBuiltin,
+        JSParserStrictMode::Strict, JSParserScriptMode::Module, SourceParseMode::ModuleAnalyzeMode, SuperBinding::NotNeeded, error);
+    if (error.isValid()) {
+        auto result = deferred->reject(exec, error.toErrorObject(exec->lexicalGlobalObject(), sourceCode));
+        scope.releaseAssertNoException();
+        return JSValue::encode(result);
+    }
+    ASSERT(moduleProgramNode);
+
+    ModuleAnalyzer moduleAnalyzer(exec, moduleKey, sourceCode, moduleProgramNode->varDeclarations(), moduleProgramNode->lexicalVariables());
+    if (UNLIKELY(scope.exception()))
+        return reject();
+
+    auto result = deferred->resolve(exec, moduleAnalyzer.analyze(*moduleProgramNode));
+    scope.releaseAssertNoException();
+    return JSValue::encode(result);
+}
+
+EncodedJSValue JSC_HOST_CALL moduleLoaderRequestedModules(ExecState* exec)
+{
+    VM& vm = exec->vm();
+    auto scope = DECLARE_THROW_SCOPE(vm);
+    auto* moduleRecord = jsDynamicCast<AbstractModuleRecord*>(vm, exec->argument(0));
+    if (!moduleRecord) {
+        scope.release();
+        return JSValue::encode(constructEmptyArray(exec, nullptr));
+    }
+
+    JSArray* result = constructEmptyArray(exec, nullptr, moduleRecord->requestedModules().size());
+    RETURN_IF_EXCEPTION(scope, encodedJSValue());
+    size_t i = 0;
+    for (auto& key : moduleRecord->requestedModules()) {
+        result->putDirectIndex(exec, i++, jsString(exec, key.get()));
+        RETURN_IF_EXCEPTION(scope, encodedJSValue());
+    }
+    return JSValue::encode(result);
+}
+
+EncodedJSValue JSC_HOST_CALL moduleLoaderModuleDeclarationInstantiation(ExecState* exec)
+{
+    VM& vm = exec->vm();
+    auto scope = DECLARE_THROW_SCOPE(vm);
+    auto* moduleRecord = jsDynamicCast<AbstractModuleRecord*>(vm, exec->argument(0));
+    if (!moduleRecord)
+        return JSValue::encode(jsUndefined());
+
+    if (Options::dumpModuleLoadingState())
+        dataLog("Loader [link] ", moduleRecord->moduleKey(), "\n");
+
+    moduleRecord->link(exec, exec->argument(1));
+    RETURN_IF_EXCEPTION(scope, encodedJSValue());
+
+    return JSValue::encode(jsUndefined());
+}
+
+// ------------------------------ Hook Functions ---------------------------
+
+EncodedJSValue JSC_HOST_CALL moduleLoaderResolve(ExecState* exec)
+{
+    VM& vm = exec->vm();
+    // 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 "jquery" and return the URL for the resource.
+    JSModuleLoader* loader = jsDynamicCast<JSModuleLoader*>(vm, exec->thisValue());
+    if (!loader)
+        return JSValue::encode(jsUndefined());
+    return JSValue::encode(loader->resolve(exec, exec->argument(0), exec->argument(1), exec->argument(2)));
+}
+
+EncodedJSValue JSC_HOST_CALL moduleLoaderResolveSync(ExecState* exec)
+{
+    VM& vm = exec->vm();
+    auto scope = DECLARE_CATCH_SCOPE(vm);
+
+    JSModuleLoader* loader = jsDynamicCast<JSModuleLoader*>(vm, exec->thisValue());
+    if (!loader)
+        return JSValue::encode(jsUndefined());
+    auto result = loader->resolveSync(exec, exec->argument(0), exec->argument(1), exec->argument(2));
+    RETURN_IF_EXCEPTION(scope, encodedJSValue());
+    return JSValue::encode(identifierToJSValue(vm, result));
+}
+
+EncodedJSValue JSC_HOST_CALL moduleLoaderFetch(ExecState* exec)
+{
+    VM& vm = exec->vm();
+    // 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<JSModuleLoader*>(vm, exec->thisValue());
+    if (!loader)
+        return JSValue::encode(jsUndefined());
+    return JSValue::encode(loader->fetch(exec, exec->argument(0), exec->argument(1), exec->argument(2)));
+}
+
+EncodedJSValue JSC_HOST_CALL moduleLoaderGetModuleNamespaceObject(ExecState* exec)
+{
+    VM& vm = exec->vm();
+    auto scope = DECLARE_THROW_SCOPE(vm);
+
+    auto* loader = jsDynamicCast<JSModuleLoader*>(vm, exec->thisValue());
+    if (!loader)
+        return JSValue::encode(jsUndefined());
+    auto* moduleNamespaceObject = loader->getModuleNamespaceObject(exec, exec->argument(0));
+    RETURN_IF_EXCEPTION(scope, encodedJSValue());
+    return JSValue::encode(moduleNamespaceObject);
+}
+
+// ------------------- Additional Hook Functions ---------------------------
+
+EncodedJSValue JSC_HOST_CALL moduleLoaderEvaluate(ExecState* exec)
+{
+    // To instrument and retrieve the errors raised from the module execution,
+    // we inserted the hook point here.
+
+    VM& vm = exec->vm();
+    JSModuleLoader* loader = jsDynamicCast<JSModuleLoader*>(vm, exec->thisValue());
+    if (!loader)
+        return JSValue::encode(jsUndefined());
+    return JSValue::encode(loader->evaluate(exec, exec->argument(0), exec->argument(1), exec->argument(2)));
+}
+
 } // namespace JSC
index 97fed83..4dcd522 100644 (file)
@@ -38,7 +38,8 @@ class JSModuleLoader final : public JSNonFinalObject {
 private:
     JSModuleLoader(VM&, Structure*);
 public:
-    typedef JSNonFinalObject Base;
+    using Base = JSNonFinalObject;
+    static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable;
 
     enum Status {
         Fetch = 1,
diff --git a/Source/JavaScriptCore/runtime/ModuleLoaderPrototype.cpp b/Source/JavaScriptCore/runtime/ModuleLoaderPrototype.cpp
deleted file mode 100644 (file)
index b8bdc9f..0000000
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * Copyright (C) 2015-2016 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 "config.h"
-#include "ModuleLoaderPrototype.h"
-
-#include "BuiltinNames.h"
-#include "CatchScope.h"
-#include "CodeProfiling.h"
-#include "Error.h"
-#include "Exception.h"
-#include "JSCInlines.h"
-#include "JSGlobalObjectFunctions.h"
-#include "JSInternalPromise.h"
-#include "JSInternalPromiseDeferred.h"
-#include "JSMap.h"
-#include "JSModuleEnvironment.h"
-#include "JSModuleLoader.h"
-#include "JSModuleNamespaceObject.h"
-#include "JSModuleRecord.h"
-#include "JSSourceCode.h"
-#include "ModuleAnalyzer.h"
-#include "Nodes.h"
-#include "Parser.h"
-#include "ParserError.h"
-#include "WebAssemblyPrototype.h"
-
-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 moduleLoaderPrototypeResolveSync(ExecState*);
-static EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeFetch(ExecState*);
-static EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeGetModuleNamespaceObject(ExecState*);
-
-}
-
-#include "ModuleLoaderPrototype.lut.h"
-
-namespace JSC {
-
-STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(ModuleLoaderPrototype);
-
-const ClassInfo ModuleLoaderPrototype::s_info = { "ModuleLoader", &Base::s_info, &moduleLoaderPrototypeTable, nullptr, CREATE_METHOD_TABLE(ModuleLoaderPrototype) };
-
-/* Source for ModuleLoaderPrototype.lut.h
-@begin moduleLoaderPrototypeTable
-    ensureRegistered               JSBuiltin                                           DontEnum|Function 1
-    forceFulfillPromise            JSBuiltin                                           DontEnum|Function 2
-    fulfillFetch                   JSBuiltin                                           DontEnum|Function 2
-    requestFetch                   JSBuiltin                                           DontEnum|Function 3
-    requestInstantiate             JSBuiltin                                           DontEnum|Function 3
-    requestSatisfy                 JSBuiltin                                           DontEnum|Function 3
-    link                           JSBuiltin                                           DontEnum|Function 2
-    moduleDeclarationInstantiation moduleLoaderPrototypeModuleDeclarationInstantiation DontEnum|Function 2
-    moduleEvaluation               JSBuiltin                                           DontEnum|Function 2
-    evaluate                       moduleLoaderPrototypeEvaluate                       DontEnum|Function 3
-    provideFetch                   JSBuiltin                                           DontEnum|Function 2
-    loadAndEvaluateModule          JSBuiltin                                           DontEnum|Function 3
-    loadModule                     JSBuiltin                                           DontEnum|Function 3
-    linkAndEvaluateModule          JSBuiltin                                           DontEnum|Function 2
-    requestImportModule            JSBuiltin                                           DontEnum|Function 3
-    getModuleNamespaceObject       moduleLoaderPrototypeGetModuleNamespaceObject       DontEnum|Function 1
-    parseModule                    moduleLoaderPrototypeParseModule                    DontEnum|Function 2
-    requestedModules               moduleLoaderPrototypeRequestedModules               DontEnum|Function 1
-    resolve                        moduleLoaderPrototypeResolve                        DontEnum|Function 2
-    resolveSync                    moduleLoaderPrototypeResolveSync                    DontEnum|Function 2
-    fetch                          moduleLoaderPrototypeFetch                          DontEnum|Function 3
-@end
-*/
-
-ModuleLoaderPrototype::ModuleLoaderPrototype(VM& vm, Structure* structure)
-    : JSNonFinalObject(vm, structure)
-{
-}
-
-// ------------------------------ Functions --------------------------------
-
-EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeParseModule(ExecState* exec)
-{
-    VM& vm = exec->vm();
-    auto scope = DECLARE_CATCH_SCOPE(vm);
-
-    JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, exec->lexicalGlobalObject());
-    scope.releaseAssertNoException();
-
-    auto reject = [&] {
-        JSValue exception = scope.exception();
-        scope.clearException();
-        auto result = deferred->reject(exec, exception);
-        scope.releaseAssertNoException();
-        return JSValue::encode(result);
-    };
-
-    const Identifier moduleKey = exec->argument(0).toPropertyKey(exec);
-    if (UNLIKELY(scope.exception()))
-        return reject();
-
-    JSValue source = exec->argument(1);
-    auto* jsSourceCode = jsCast<JSSourceCode*>(source);
-    SourceCode sourceCode = jsSourceCode->sourceCode();
-
-#if ENABLE(WEBASSEMBLY)
-    if (sourceCode.provider()->sourceType() == SourceProviderSourceType::WebAssembly)
-        return JSValue::encode(WebAssemblyPrototype::instantiate(exec, deferred, moduleKey, jsSourceCode));
-#endif
-
-    CodeProfiling profile(sourceCode);
-
-    ParserError error;
-    std::unique_ptr<ModuleProgramNode> moduleProgramNode = parse<ModuleProgramNode>(
-        &vm, sourceCode, Identifier(), JSParserBuiltinMode::NotBuiltin,
-        JSParserStrictMode::Strict, JSParserScriptMode::Module, SourceParseMode::ModuleAnalyzeMode, SuperBinding::NotNeeded, error);
-    if (error.isValid()) {
-        auto result = deferred->reject(exec, error.toErrorObject(exec->lexicalGlobalObject(), sourceCode));
-        scope.releaseAssertNoException();
-        return JSValue::encode(result);
-    }
-    ASSERT(moduleProgramNode);
-
-    ModuleAnalyzer moduleAnalyzer(exec, moduleKey, sourceCode, moduleProgramNode->varDeclarations(), moduleProgramNode->lexicalVariables());
-    if (UNLIKELY(scope.exception()))
-        return reject();
-
-    auto result = deferred->resolve(exec, moduleAnalyzer.analyze(*moduleProgramNode));
-    scope.releaseAssertNoException();
-    return JSValue::encode(result);
-}
-
-EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeRequestedModules(ExecState* exec)
-{
-    VM& vm = exec->vm();
-    auto scope = DECLARE_THROW_SCOPE(vm);
-    auto* moduleRecord = jsDynamicCast<AbstractModuleRecord*>(vm, exec->argument(0));
-    if (!moduleRecord) {
-        scope.release();
-        return JSValue::encode(constructEmptyArray(exec, nullptr));
-    }
-
-    JSArray* result = constructEmptyArray(exec, nullptr, moduleRecord->requestedModules().size());
-    RETURN_IF_EXCEPTION(scope, encodedJSValue());
-    size_t i = 0;
-    for (auto& key : moduleRecord->requestedModules()) {
-        result->putDirectIndex(exec, i++, jsString(exec, key.get()));
-        RETURN_IF_EXCEPTION(scope, encodedJSValue());
-    }
-    return JSValue::encode(result);
-}
-
-EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeModuleDeclarationInstantiation(ExecState* exec)
-{
-    VM& vm = exec->vm();
-    auto scope = DECLARE_THROW_SCOPE(vm);
-    auto* moduleRecord = jsDynamicCast<AbstractModuleRecord*>(vm, exec->argument(0));
-    if (!moduleRecord)
-        return JSValue::encode(jsUndefined());
-
-    if (Options::dumpModuleLoadingState())
-        dataLog("Loader [link] ", moduleRecord->moduleKey(), "\n");
-
-    moduleRecord->link(exec, exec->argument(1));
-    RETURN_IF_EXCEPTION(scope, encodedJSValue());
-
-    return JSValue::encode(jsUndefined());
-}
-
-// ------------------------------ Hook Functions ---------------------------
-
-EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeResolve(ExecState* exec)
-{
-    VM& vm = exec->vm();
-    // 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 "jquery" and return the URL for the resource.
-    JSModuleLoader* loader = jsDynamicCast<JSModuleLoader*>(vm, exec->thisValue());
-    if (!loader)
-        return JSValue::encode(jsUndefined());
-    return JSValue::encode(loader->resolve(exec, exec->argument(0), exec->argument(1), exec->argument(2)));
-}
-
-EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeResolveSync(ExecState* exec)
-{
-    VM& vm = exec->vm();
-    auto scope = DECLARE_CATCH_SCOPE(vm);
-
-    JSModuleLoader* loader = jsDynamicCast<JSModuleLoader*>(vm, exec->thisValue());
-    if (!loader)
-        return JSValue::encode(jsUndefined());
-    auto result = loader->resolveSync(exec, exec->argument(0), exec->argument(1), exec->argument(2));
-    RETURN_IF_EXCEPTION(scope, encodedJSValue());
-    return JSValue::encode(identifierToJSValue(vm, result));
-}
-
-EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeFetch(ExecState* exec)
-{
-    VM& vm = exec->vm();
-    // 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<JSModuleLoader*>(vm, exec->thisValue());
-    if (!loader)
-        return JSValue::encode(jsUndefined());
-    return JSValue::encode(loader->fetch(exec, exec->argument(0), exec->argument(1), exec->argument(2)));
-}
-
-EncodedJSValue JSC_HOST_CALL moduleLoaderPrototypeGetModuleNamespaceObject(ExecState* exec)
-{
-    VM& vm = exec->vm();
-    auto scope = DECLARE_THROW_SCOPE(vm);
-
-    auto* loader = jsDynamicCast<JSModuleLoader*>(vm, exec->thisValue());
-    if (!loader)
-        return JSValue::encode(jsUndefined());
-    auto* moduleNamespaceObject = loader->getModuleNamespaceObject(exec, exec->argument(0));
-    RETURN_IF_EXCEPTION(scope, encodedJSValue());
-    return JSValue::encode(moduleNamespaceObject);
-}
-
-// ------------------- 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.
-
-    VM& vm = exec->vm();
-    JSModuleLoader* loader = jsDynamicCast<JSModuleLoader*>(vm, exec->thisValue());
-    if (!loader)
-        return JSValue::encode(jsUndefined());
-    return JSValue::encode(loader->evaluate(exec, exec->argument(0), exec->argument(1), exec->argument(2)));
-}
-
-} // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/ModuleLoaderPrototype.h b/Source/JavaScriptCore/runtime/ModuleLoaderPrototype.h
deleted file mode 100644 (file)
index a66d61d..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2015 Apple Inc. All Rights Reserved.
- * Copyright (C) 2016 Yusuke Suzuki <utatane.tea@gmail.com>.
- *
- * 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 "JSObject.h"
-
-namespace JSC {
-
-class JSInternalPromise;
-
-class ModuleLoaderPrototype final : public JSNonFinalObject {
-private:
-    ModuleLoaderPrototype(VM&, Structure*);
-public:
-    typedef JSNonFinalObject Base;
-    static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable;
-
-    static ModuleLoaderPrototype* create(VM& vm, JSGlobalObject*, Structure* structure)
-    {
-        ModuleLoaderPrototype* object = new (NotNull, allocateCell<ModuleLoaderPrototype>(vm.heap)) ModuleLoaderPrototype(vm, structure);
-        object->finishCreation(vm);
-        return object;
-    }
-
-    DECLARE_INFO;
-
-    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-    {
-        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
-    }
-};
-
-} // namespace JSC