Title: [222895] trunk
Revision
222895
Author
[email protected]
Date
2017-10-04 20:57:38 -0700 (Wed, 04 Oct 2017)

Log Message

[JSC] Introduce import.meta
https://bugs.webkit.org/show_bug.cgi?id=177703

Reviewed by Filip Pizlo.

JSTests:

* modules/import-meta-syntax.js: Added.
(shouldThrow):
(shouldNotThrow):
* modules/import-meta.js: Added.
* modules/import-meta/cocoa.js: Added.
* modules/resources/assert.js:
(export.shouldNotThrow):
* stress/import-syntax.js:

Source/_javascript_Core:

This patch adds stage 3 `import.meta`[1].
We add a new hook function moduleLoaderCreateImportMetaProperties, which creates
import meta properties object to this module. And we set this object as @meta
private variable in module environments. So module code can access this by accessing
@meta private variable.

[1]: https://github.com/tc39/proposal-import-meta

* builtins/BuiltinNames.h:
* builtins/ModuleLoaderPrototype.js:
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
* jsc.cpp:
(GlobalObject::moduleLoaderCreateImportMetaProperties):
* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseModuleSourceElements):
(JSC::Parser<LexerType>::parseMemberExpression):
* runtime/JSGlobalObject.cpp:
* runtime/JSGlobalObject.h:
* runtime/JSModuleLoader.cpp:
(JSC::JSModuleLoader::createImportMetaProperties):
* runtime/JSModuleLoader.h:
* runtime/JSModuleRecord.cpp:
(JSC::JSModuleRecord::link):
(JSC::JSModuleRecord::instantiateDeclarations):
* runtime/JSModuleRecord.h:
* runtime/ModuleLoaderPrototype.cpp:
(JSC::moduleLoaderPrototypeModuleDeclarationInstantiation):

Source/WebCore:

* bindings/js/JSDOMWindowBase.cpp:
* bindings/js/JSWorkerGlobalScopeBase.cpp:

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (222894 => 222895)


--- trunk/JSTests/ChangeLog	2017-10-05 03:54:39 UTC (rev 222894)
+++ trunk/JSTests/ChangeLog	2017-10-05 03:57:38 UTC (rev 222895)
@@ -1,3 +1,19 @@
+2017-09-30  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Introduce import.meta
+        https://bugs.webkit.org/show_bug.cgi?id=177703
+
+        Reviewed by Filip Pizlo.
+
+        * modules/import-meta-syntax.js: Added.
+        (shouldThrow):
+        (shouldNotThrow):
+        * modules/import-meta.js: Added.
+        * modules/import-meta/cocoa.js: Added.
+        * modules/resources/assert.js:
+        (export.shouldNotThrow):
+        * stress/import-syntax.js:
+
 2017-10-04  Saam Barati  <[email protected]>
 
         Make pertinent AccessCases watch the poly proto watchpoint

Added: trunk/JSTests/modules/import-meta/cocoa.js (0 => 222895)


--- trunk/JSTests/modules/import-meta/cocoa.js	                        (rev 0)
+++ trunk/JSTests/modules/import-meta/cocoa.js	2017-10-05 03:57:38 UTC (rev 222895)
@@ -0,0 +1,4 @@
+let meta = import.meta;
+export {
+    meta as cocoa
+}

Added: trunk/JSTests/modules/import-meta-syntax.js (0 => 222895)


--- trunk/JSTests/modules/import-meta-syntax.js	                        (rev 0)
+++ trunk/JSTests/modules/import-meta-syntax.js	2017-10-05 03:57:38 UTC (rev 222895)
@@ -0,0 +1,25 @@
+import { shouldThrow, shouldNotThrow } from "./resources/assert.js";
+
+shouldThrow(() => {
+    new Function(`import.meta`);
+}, `SyntaxError: import.meta is only valid inside modules.`);
+
+shouldNotThrow(() => {
+    checkModuleSyntax(`import.meta`);
+});
+
+shouldThrow(() => {
+    checkModuleSyntax(`(import.cocoa)`);
+}, `SyntaxError: Unexpected identifier 'cocoa'. "import." can only followed with meta.:1`);
+
+shouldThrow(() => {
+    checkModuleSyntax(`(import["Cocoa"])`);
+}, `SyntaxError: Unexpected token '['. import call expects exactly one argument.:1`);
+
+shouldThrow(() => {
+    checkModuleSyntax(`import.cocoa`);
+}, `SyntaxError: Unexpected identifier 'cocoa'. "import." can only followed with meta.:1`);
+
+shouldThrow(() => {
+    checkModuleSyntax(`import["Cocoa"]`);
+}, `SyntaxError: Unexpected token '['. Expected namespace import or import list.:1`);

Added: trunk/JSTests/modules/import-meta.js (0 => 222895)


--- trunk/JSTests/modules/import-meta.js	                        (rev 0)
+++ trunk/JSTests/modules/import-meta.js	2017-10-05 03:57:38 UTC (rev 222895)
@@ -0,0 +1,11 @@
+import { shouldBe, shouldNotBe } from "./resources/assert.js";
+import { cocoa } from "./import-meta/cocoa.js"
+
+shouldNotBe(cocoa, import.meta);
+shouldBe(typeof cocoa, "object");
+shouldBe(typeof import.meta, "object");
+shouldBe(import.meta.filename.endsWith("import-meta.js"), true);
+shouldBe(cocoa.filename.endsWith("cocoa.js"), true);
+
+shouldBe(Reflect.getPrototypeOf(cocoa), null);
+shouldBe(Reflect.getPrototypeOf(import.meta), null);

Modified: trunk/JSTests/modules/resources/assert.js (222894 => 222895)


--- trunk/JSTests/modules/resources/assert.js	2017-10-05 03:54:39 UTC (rev 222894)
+++ trunk/JSTests/modules/resources/assert.js	2017-10-05 03:57:38 UTC (rev 222895)
@@ -22,3 +22,7 @@
     if (String(error) !== errorMessage)
         throw new Error(`bad error: ${String(error)}`);
 }
+
+export function shouldNotThrow(func) {
+    func();
+}

Modified: trunk/JSTests/stress/import-syntax.js (222894 => 222895)


--- trunk/JSTests/stress/import-syntax.js	2017-10-05 03:54:39 UTC (rev 222894)
+++ trunk/JSTests/stress/import-syntax.js	2017-10-05 03:57:38 UTC (rev 222895)
@@ -27,7 +27,7 @@
 
 testSyntaxError(`import)`, `SyntaxError: Unexpected token ')'. import call expects exactly one argument.`);
 testSyntaxError(`new import(`, `SyntaxError: Cannot use new with import.`);
-testSyntaxError(`import.hello()`, `SyntaxError: Unexpected token '.'. import call expects exactly one argument.`);
+testSyntaxError(`import.hello()`, `SyntaxError: Unexpected identifier 'hello'. "import." can only followed with meta.`);
 testSyntaxError(`import[`, `SyntaxError: Unexpected token '['. import call expects exactly one argument.`);
 testSyntaxError(`import<`, `SyntaxError: Unexpected token '<'. import call expects exactly one argument.`);
 

Modified: trunk/Source/_javascript_Core/ChangeLog (222894 => 222895)


--- trunk/Source/_javascript_Core/ChangeLog	2017-10-05 03:54:39 UTC (rev 222894)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-10-05 03:57:38 UTC (rev 222895)
@@ -1,3 +1,39 @@
+2017-09-30  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Introduce import.meta
+        https://bugs.webkit.org/show_bug.cgi?id=177703
+
+        Reviewed by Filip Pizlo.
+
+        This patch adds stage 3 `import.meta`[1].
+        We add a new hook function moduleLoaderCreateImportMetaProperties, which creates
+        import meta properties object to this module. And we set this object as @meta
+        private variable in module environments. So module code can access this by accessing
+        @meta private variable.
+
+        [1]: https://github.com/tc39/proposal-import-meta
+
+        * builtins/BuiltinNames.h:
+        * builtins/ModuleLoaderPrototype.js:
+        * bytecompiler/BytecodeGenerator.cpp:
+        (JSC::BytecodeGenerator::BytecodeGenerator):
+        * jsc.cpp:
+        (GlobalObject::moduleLoaderCreateImportMetaProperties):
+        * parser/Parser.cpp:
+        (JSC::Parser<LexerType>::parseModuleSourceElements):
+        (JSC::Parser<LexerType>::parseMemberExpression):
+        * runtime/JSGlobalObject.cpp:
+        * runtime/JSGlobalObject.h:
+        * runtime/JSModuleLoader.cpp:
+        (JSC::JSModuleLoader::createImportMetaProperties):
+        * runtime/JSModuleLoader.h:
+        * runtime/JSModuleRecord.cpp:
+        (JSC::JSModuleRecord::link):
+        (JSC::JSModuleRecord::instantiateDeclarations):
+        * runtime/JSModuleRecord.h:
+        * runtime/ModuleLoaderPrototype.cpp:
+        (JSC::moduleLoaderPrototypeModuleDeclarationInstantiation):
+
 2017-10-04  Saam Barati  <[email protected]>
 
         Make pertinent AccessCases watch the poly proto watchpoint

Modified: trunk/Source/_javascript_Core/builtins/BuiltinNames.h (222894 => 222895)


--- trunk/Source/_javascript_Core/builtins/BuiltinNames.h	2017-10-05 03:54:39 UTC (rev 222894)
+++ trunk/Source/_javascript_Core/builtins/BuiltinNames.h	2017-10-05 03:57:38 UTC (rev 222895)
@@ -194,6 +194,7 @@
     macro(CompileError) \
     macro(LinkError) \
     macro(RuntimeError) \
+    macro(meta) \
 
 namespace Symbols {
 #define DECLARE_BUILTIN_STATIC_SYMBOLS(name) extern SymbolImpl::StaticSymbolImpl name##Symbol;

Modified: trunk/Source/_javascript_Core/builtins/ModuleLoaderPrototype.js (222894 => 222895)


--- trunk/Source/_javascript_Core/builtins/ModuleLoaderPrototype.js	2017-10-05 03:54:39 UTC (rev 222894)
+++ trunk/Source/_javascript_Core/builtins/ModuleLoaderPrototype.js	2017-10-05 03:57:38 UTC (rev 222895)
@@ -366,7 +366,7 @@
             this.link(pair.value.registryEntry, fetcher);
         }
 
-        this.moduleDeclarationInstantiation(entry.module, fetcher);
+        this.moduleDeclarationInstantiation(entry.module, entry.key, fetcher);
     } catch (error) {
         entry.linkSucceeded = false;
         entry.linkError = error;

Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp (222894 => 222895)


--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2017-10-05 03:54:39 UTC (rev 222894)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2017-10-05 03:57:38 UTC (rev 222895)
@@ -889,6 +889,8 @@
 
     // Now declare all variables.
 
+    createVariable(m_vm->propertyNames->builtinNames().metaPrivateName(), VarKind::Scope, moduleEnvironmentSymbolTable, VerifyExisting);
+
     for (auto& entry : moduleProgramNode->varDeclarations()) {
         ASSERT(!entry.value.isLet() && !entry.value.isConst());
         if (!entry.value.isVar()) // This is either a parameter or callee.

Modified: trunk/Source/_javascript_Core/jsc.cpp (222894 => 222895)


--- trunk/Source/_javascript_Core/jsc.cpp	2017-10-05 03:54:39 UTC (rev 222894)
+++ trunk/Source/_javascript_Core/jsc.cpp	2017-10-05 03:57:38 UTC (rev 222895)
@@ -1660,6 +1660,7 @@
     static JSInternalPromise* moduleLoaderImportModule(JSGlobalObject*, ExecState*, JSModuleLoader*, JSString*, const SourceOrigin&);
     static JSInternalPromise* moduleLoaderResolve(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue, JSValue);
     static JSInternalPromise* moduleLoaderFetch(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue);
+    static JSObject* moduleLoaderCreateImportMetaProperties(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSModuleRecord*, JSValue);
 };
 
 const ClassInfo GlobalObject::s_info = { "global", &JSGlobalObject::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(GlobalObject) };
@@ -1673,6 +1674,7 @@
     &moduleLoaderResolve,
     &moduleLoaderFetch,
     nullptr, // moduleLoaderInstantiate
+    &moduleLoaderCreateImportMetaProperties,
     nullptr, // moduleLoaderEvaluate
     nullptr, // promiseRejectionTracker
     nullptr, // defaultLanguage
@@ -2006,7 +2008,20 @@
     return result;
 }
 
+JSObject* GlobalObject::moduleLoaderCreateImportMetaProperties(JSGlobalObject* globalObject, ExecState* exec, JSModuleLoader*, JSValue key, JSModuleRecord*, JSValue)
+{
+    VM& vm = exec->vm();
+    auto scope = DECLARE_THROW_SCOPE(vm);
 
+    JSObject* metaProperties = constructEmptyObject(exec, globalObject->nullPrototypeObjectStructure());
+    RETURN_IF_EXCEPTION(scope, nullptr);
+
+    metaProperties->putDirect(vm, Identifier::fromString(&vm, "filename"), key);
+    RETURN_IF_EXCEPTION(scope, nullptr);
+
+    return metaProperties;
+}
+
 static EncodedJSValue printInternal(ExecState* exec, FILE* out)
 {
     VM& vm = exec->vm();

Modified: trunk/Source/_javascript_Core/parser/Parser.cpp (222894 => 222895)


--- trunk/Source/_javascript_Core/parser/Parser.cpp	2017-10-05 03:54:39 UTC (rev 222894)
+++ trunk/Source/_javascript_Core/parser/Parser.cpp	2017-10-05 03:57:38 UTC (rev 222895)
@@ -419,7 +419,7 @@
         case IMPORT: {
             SavePoint savePoint = createSavePoint();
             next();
-            bool isImportDeclaration = !match(OPENPAREN);
+            bool isImportDeclaration = !match(OPENPAREN) && !match(DOT);
             restoreSavePoint(savePoint);
             if (isImportDeclaration) {
                 statement = parseImportDeclaration(context);
@@ -428,7 +428,7 @@
                 break;
             }
 
-            // This is `import("...")` call case.
+            // This is `import("...")` call or `import.meta` meta property case.
             FALLTHROUGH;
         }
 
@@ -4687,11 +4687,25 @@
     } else if (baseIsImport) {
         next();
         JSTextPosition expressionEnd = lastTokenEndPosition();
-        consumeOrFail(OPENPAREN, "import call expects exactly one argument");
-        TreeExpression expr = parseAssignmentExpression(context);
-        failIfFalse(expr, "Cannot parse _expression_");
-        consumeOrFail(CLOSEPAREN, "import call expects exactly one argument");
-        base = context.createImportExpr(location, expr, expressionStart, expressionEnd, lastTokenEndPosition());
+        if (consume(DOT)) {
+            if (!match(IDENT))
+                failDueToUnexpectedToken();
+            const Identifier* ident = m_token.m_data.ident;
+            if (m_vm->propertyNames->builtinNames().metaPublicName() != *ident)
+                failWithMessage("\"import.\" can only followed with meta");
+
+            semanticFailIfFalse(m_scriptMode == JSParserScriptMode::Module, "import.meta is only valid inside modules");
+
+            JSTokenLocation location(tokenLocation());
+            base = createResolveAndUseVariable(context, &m_vm->propertyNames->builtinNames().metaPrivateName(), false, expressionStart, location);
+            next();
+        } else {
+            consumeOrFail(OPENPAREN, "import call expects exactly one argument");
+            TreeExpression expr = parseAssignmentExpression(context);
+            failIfFalse(expr, "Cannot parse _expression_");
+            consumeOrFail(CLOSEPAREN, "import call expects exactly one argument");
+            base = context.createImportExpr(location, expr, expressionStart, expressionEnd, lastTokenEndPosition());
+        }
     } else if (!baseIsNewTarget) {
         const bool isAsync = match(ASYNC);
 

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (222894 => 222895)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp	2017-10-05 03:54:39 UTC (rev 222894)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp	2017-10-05 03:57:38 UTC (rev 222895)
@@ -255,6 +255,7 @@
     nullptr, // moduleLoaderResolve
     nullptr, // moduleLoaderFetch
     nullptr, // moduleLoaderInstantiate
+    nullptr, // moduleLoaderCreateImportMetaProperties
     nullptr, // moduleLoaderEvaluate
     nullptr, // promiseRejectionTracker
     nullptr, // defaultLanguage

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.h (222894 => 222895)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.h	2017-10-05 03:54:39 UTC (rev 222894)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.h	2017-10-05 03:57:38 UTC (rev 222895)
@@ -82,6 +82,7 @@
 class JSGlobalObjectDebuggable;
 class JSInternalPromise;
 class JSModuleLoader;
+class JSModuleRecord;
 class JSPromise;
 class JSPromiseConstructor;
 class JSPromisePrototype;
@@ -197,6 +198,9 @@
     typedef JSInternalPromise* (*ModuleLoaderInstantiatePtr)(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue, JSValue);
     ModuleLoaderInstantiatePtr moduleLoaderInstantiate;
 
+    typedef JSObject* (*ModuleLoaderCreateImportMetaPropertiesPtr)(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSModuleRecord*, JSValue);
+    ModuleLoaderCreateImportMetaPropertiesPtr moduleLoaderCreateImportMetaProperties;
+
     typedef JSValue (*ModuleLoaderEvaluatePtr)(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue, JSValue);
     ModuleLoaderEvaluatePtr moduleLoaderEvaluate;
 

Modified: trunk/Source/_javascript_Core/runtime/JSModuleLoader.cpp (222894 => 222895)


--- trunk/Source/_javascript_Core/runtime/JSModuleLoader.cpp	2017-10-05 03:54:39 UTC (rev 222894)
+++ trunk/Source/_javascript_Core/runtime/JSModuleLoader.cpp	2017-10-05 03:57:38 UTC (rev 222895)
@@ -43,6 +43,7 @@
 #include "ModuleAnalyzer.h"
 #include "ModuleLoaderPrototype.h"
 #include "Nodes.h"
+#include "ObjectConstructor.h"
 #include "Parser.h"
 #include "ParserError.h"
 
@@ -249,6 +250,14 @@
     return deferred->promise();
 }
 
+JSObject* JSModuleLoader::createImportMetaProperties(ExecState* exec, JSValue key, JSModuleRecord* moduleRecord, JSValue scriptFetcher)
+{
+    JSGlobalObject* globalObject = exec->lexicalGlobalObject();
+    if (globalObject->globalObjectMethodTable()->moduleLoaderCreateImportMetaProperties)
+        return globalObject->globalObjectMethodTable()->moduleLoaderCreateImportMetaProperties(globalObject, exec, this, key, moduleRecord, scriptFetcher);
+    return constructEmptyObject(exec, exec->lexicalGlobalObject()->nullPrototypeObjectStructure());
+}
+
 JSValue JSModuleLoader::evaluate(ExecState* exec, JSValue key, JSValue moduleRecordValue, JSValue scriptFetcher)
 {
     if (Options::dumpModuleLoadingState())

Modified: trunk/Source/_javascript_Core/runtime/JSModuleLoader.h (222894 => 222895)


--- trunk/Source/_javascript_Core/runtime/JSModuleLoader.h	2017-10-05 03:54:39 UTC (rev 222894)
+++ trunk/Source/_javascript_Core/runtime/JSModuleLoader.h	2017-10-05 03:57:38 UTC (rev 222895)
@@ -74,6 +74,7 @@
     JSInternalPromise* resolve(ExecState*, JSValue name, JSValue referrer, JSValue scriptFetcher);
     JSInternalPromise* fetch(ExecState*, JSValue key, JSValue scriptFetcher);
     JSInternalPromise* instantiate(ExecState*, JSValue key, JSValue source, JSValue scriptFetcher);
+    JSObject* createImportMetaProperties(ExecState*, JSValue key, JSModuleRecord*, JSValue scriptFetcher);
 
     // Additional platform dependent hooked APIs.
     JSValue evaluate(ExecState*, JSValue key, JSValue moduleRecord, JSValue scriptFetcher);

Modified: trunk/Source/_javascript_Core/runtime/JSModuleRecord.cpp (222894 => 222895)


--- trunk/Source/_javascript_Core/runtime/JSModuleRecord.cpp	2017-10-05 03:54:39 UTC (rev 222894)
+++ trunk/Source/_javascript_Core/runtime/JSModuleRecord.cpp	2017-10-05 03:57:38 UTC (rev 222895)
@@ -76,7 +76,7 @@
     visitor.append(thisObject->m_moduleProgramExecutable);
 }
 
-void JSModuleRecord::link(ExecState* exec)
+void JSModuleRecord::link(ExecState* exec, JSValue key, JSValue scriptFetcher)
 {
     VM& vm = exec->vm();
     auto scope = DECLARE_THROW_SCOPE(vm);
@@ -87,12 +87,12 @@
         throwSyntaxError(exec, scope);
         return;
     }
-    instantiateDeclarations(exec, executable);
+    instantiateDeclarations(exec, executable, key, scriptFetcher);
     RETURN_IF_EXCEPTION(scope, void());
     m_moduleProgramExecutable.set(vm, this, executable);
 }
 
-void JSModuleRecord::instantiateDeclarations(ExecState* exec, ModuleProgramExecutable* moduleProgramExecutable)
+void JSModuleRecord::instantiateDeclarations(ExecState* exec, ModuleProgramExecutable* moduleProgramExecutable, JSValue key, JSValue scriptFetcher)
 {
     VM& vm = exec->vm();
     auto scope = DECLARE_THROW_SCOPE(vm);
@@ -205,6 +205,14 @@
         }
     }
 
+    {
+        JSObject* metaProperties = exec->lexicalGlobalObject()->moduleLoader()->createImportMetaProperties(exec, key, this, scriptFetcher);
+        RETURN_IF_EXCEPTION(scope, void());
+        bool putResult = false;
+        symbolTablePutTouchWatchpointSet(moduleEnvironment, exec, vm.propertyNames->builtinNames().metaPrivateName(), metaProperties, /* shouldThrowReadOnlyError */ false, /* ignoreReadOnlyErrors */ true, putResult);
+        RETURN_IF_EXCEPTION(scope, void());
+    }
+
     m_moduleEnvironment.set(vm, this, moduleEnvironment);
 }
 

Modified: trunk/Source/_javascript_Core/runtime/JSModuleRecord.h (222894 => 222895)


--- trunk/Source/_javascript_Core/runtime/JSModuleRecord.h	2017-10-05 03:54:39 UTC (rev 222894)
+++ trunk/Source/_javascript_Core/runtime/JSModuleRecord.h	2017-10-05 03:57:38 UTC (rev 222895)
@@ -45,7 +45,7 @@
     static Structure* createStructure(VM&, JSGlobalObject*, JSValue);
     static JSModuleRecord* create(ExecState*, VM&, Structure*, const Identifier&, const SourceCode&, const VariableEnvironment&, const VariableEnvironment&);
 
-    void link(ExecState*);
+    void link(ExecState*, JSValue key, JSValue scriptFetcher);
     JS_EXPORT_PRIVATE JSValue evaluate(ExecState*);
 
     const SourceCode& sourceCode() const { return m_sourceCode; }
@@ -60,7 +60,7 @@
     static void visitChildren(JSCell*, SlotVisitor&);
     static void destroy(JSCell*);
 
-    void instantiateDeclarations(ExecState*, ModuleProgramExecutable*);
+    void instantiateDeclarations(ExecState*, ModuleProgramExecutable*, JSValue key, JSValue scriptFetcher);
 
     SourceCode m_sourceCode;
     VariableEnvironment m_declaredVariables;

Modified: trunk/Source/_javascript_Core/runtime/ModuleLoaderPrototype.cpp (222894 => 222895)


--- trunk/Source/_javascript_Core/runtime/ModuleLoaderPrototype.cpp	2017-10-05 03:54:39 UTC (rev 222894)
+++ trunk/Source/_javascript_Core/runtime/ModuleLoaderPrototype.cpp	2017-10-05 03:57:38 UTC (rev 222895)
@@ -80,7 +80,7 @@
     requestLink                    JSBuiltin                                           DontEnum|Function 2
     requestReady                   JSBuiltin                                           DontEnum|Function 2
     link                           JSBuiltin                                           DontEnum|Function 2
-    moduleDeclarationInstantiation moduleLoaderPrototypeModuleDeclarationInstantiation DontEnum|Function 2
+    moduleDeclarationInstantiation moduleLoaderPrototypeModuleDeclarationInstantiation DontEnum|Function 3
     moduleEvaluation               JSBuiltin                                           DontEnum|Function 2
     evaluate                       moduleLoaderPrototypeEvaluate                       DontEnum|Function 3
     provide                        JSBuiltin                                           DontEnum|Function 3
@@ -168,7 +168,7 @@
     if (Options::dumpModuleLoadingState())
         dataLog("Loader [link] ", moduleRecord->moduleKey(), "\n");
 
-    moduleRecord->link(exec);
+    moduleRecord->link(exec, exec->argument(1), exec->argument(2));
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
 
     return JSValue::encode(jsUndefined());

Modified: trunk/Source/WebCore/ChangeLog (222894 => 222895)


--- trunk/Source/WebCore/ChangeLog	2017-10-05 03:54:39 UTC (rev 222894)
+++ trunk/Source/WebCore/ChangeLog	2017-10-05 03:57:38 UTC (rev 222895)
@@ -1,3 +1,13 @@
+2017-09-30  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Introduce import.meta
+        https://bugs.webkit.org/show_bug.cgi?id=177703
+
+        Reviewed by Filip Pizlo.
+
+        * bindings/js/JSDOMWindowBase.cpp:
+        * bindings/js/JSWorkerGlobalScopeBase.cpp:
+
 2017-10-04  Tim Horton  <[email protected]>
 
         Link WebCore against CFNetwork in the CMake build

Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp (222894 => 222895)


--- trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp	2017-10-05 03:54:39 UTC (rev 222894)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp	2017-10-05 03:57:38 UTC (rev 222895)
@@ -73,6 +73,7 @@
     &moduleLoaderResolve,
     &moduleLoaderFetch,
     nullptr, // moduleLoaderInstantiate
+    nullptr, // moduleLoaderCreateImportMetaProperties
     &moduleLoaderEvaluate,
     &promiseRejectionTracker,
     &defaultLanguage

Modified: trunk/Source/WebCore/bindings/js/JSWorkerGlobalScopeBase.cpp (222894 => 222895)


--- trunk/Source/WebCore/bindings/js/JSWorkerGlobalScopeBase.cpp	2017-10-05 03:54:39 UTC (rev 222894)
+++ trunk/Source/WebCore/bindings/js/JSWorkerGlobalScopeBase.cpp	2017-10-05 03:57:38 UTC (rev 222895)
@@ -60,6 +60,7 @@
     nullptr, // moduleLoaderResolve
     nullptr, // moduleLoaderFetch
     nullptr, // moduleLoaderInstantiate
+    nullptr, // moduleLoaderCreateImportMetaProperties
     nullptr, // moduleLoaderEvaluate
     nullptr, // promiseRejectionTracker
     &defaultLanguage
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to