Ignore:
Timestamp:
Aug 27, 2015, 11:22:08 PM (10 years ago)
Author:
Yusuke Suzuki
Message:

[ES6] Implement Module execution and Loader's ready / link phase
https://bugs.webkit.org/show_bug.cgi?id=148172

Reviewed by Saam Barati.

This patch adds the link / ready phases to the existing module loader.
They are just the stubs and the actual implementations will be
forthcoming in the subsequnt patch.

And this patch paves the way to instantiate the module environment and
compile the executable code in the link phase. Move declaredVariables /
lexicalVariables from ModuleAnalyzer to JSModuleRecord to use them when
instantiating the module environment. Hold the source code in
JSModuleRecord to construct the executable in the link phase. And to
use HostResolveImportedModule operation from the C++ side, we expose
the JSMap from C++ to JS and use it in the builtin JS module loader
code.

  • builtins/ModuleLoaderObject.js:

(requestResolveDependencies.resolveDependenciesPromise.this.requestInstantiate.then.):
(requestLink):
(requestReady):
(link):
(moduleEvaluation):
(loadModule):

  • parser/ModuleAnalyzer.cpp:

(JSC::ModuleAnalyzer::ModuleAnalyzer):
(JSC::ModuleAnalyzer::analyze):

  • parser/ModuleAnalyzer.h:
  • runtime/Completion.cpp:

(JSC::checkModuleSyntax):

  • runtime/JSModuleRecord.cpp:

(JSC::JSModuleRecord::finishCreation):
(JSC::JSModuleRecord::visitChildren):
(JSC::identifierToJSValue):
(JSC::JSModuleRecord::hostResolveImportedModule):
(JSC::JSModuleRecord::link):
(JSC::JSModuleRecord::execute):

  • runtime/JSModuleRecord.h:

(JSC::JSModuleRecord::create):
(JSC::JSModuleRecord::sourceCode):
(JSC::JSModuleRecord::moduleKey):
(JSC::JSModuleRecord::exportEntries):
(JSC::JSModuleRecord::importEntries):
(JSC::JSModuleRecord::declaredVariables):
(JSC::JSModuleRecord::lexicalVariables):
(JSC::JSModuleRecord::JSModuleRecord):

  • runtime/ModuleLoaderObject.cpp:

(JSC::moduleLoaderObjectParseModule):
(JSC::moduleLoaderObjectRequestedModules):
(JSC::moduleLoaderObjectModuleDeclarationInstantiation):
(JSC::moduleLoaderObjectEvaluate):
(JSC::ModuleLoaderObject::requestInstantiateAll): Deleted.

  • runtime/ModuleLoaderObject.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/Completion.cpp

    r188894 r189088  
    7979
    8080    PrivateName privateName(PrivateName::Description, "EntryPointModule");
    81     ModuleAnalyzer moduleAnalyzer(exec, Identifier::fromUid(privateName), moduleProgramNode->varDeclarations(), moduleProgramNode->lexicalVariables());
     81    ModuleAnalyzer moduleAnalyzer(exec, Identifier::fromUid(privateName), source, moduleProgramNode->varDeclarations(), moduleProgramNode->lexicalVariables());
    8282    moduleAnalyzer.analyze(*moduleProgramNode);
    8383    return true;
Note: See TracChangeset for help on using the changeset viewer.