Ignore:
Timestamp:
Oct 4, 2017, 8:57:38 PM (8 years ago)
Author:
Yusuke Suzuki
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/JavaScriptCore:

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:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSModuleLoader.h

    r211018 r222895  
    7575    JSInternalPromise* fetch(ExecState*, JSValue key, JSValue scriptFetcher);
    7676    JSInternalPromise* instantiate(ExecState*, JSValue key, JSValue source, JSValue scriptFetcher);
     77    JSObject* createImportMetaProperties(ExecState*, JSValue key, JSModuleRecord*, JSValue scriptFetcher);
    7778
    7879    // Additional platform dependent hooked APIs.
Note: See TracChangeset for help on using the changeset viewer.