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/parser/ModuleAnalyzer.h

    r188752 r189088  
    3232
    3333class JSModuleRecord;
     34class SourceCode;
    3435
    3536class ModuleAnalyzer {
    3637    WTF_MAKE_NONCOPYABLE(ModuleAnalyzer);
    3738public:
    38     ModuleAnalyzer(ExecState*, const Identifier& moduleKey, const VariableEnvironment& declaredVariables, const VariableEnvironment& lexicalVariables);
     39    ModuleAnalyzer(ExecState*, const Identifier& moduleKey, const SourceCode&, const VariableEnvironment& declaredVariables, const VariableEnvironment& lexicalVariables);
    3940
    4041    JSModuleRecord* analyze(ModuleProgramNode&);
     
    5556    VM* m_vm;
    5657    Strong<JSModuleRecord> m_moduleRecord;
    57     VariableEnvironment m_declaredVariables;
    58     VariableEnvironment m_lexicalVariables;
    5958    IdentifierAliasMap m_aliasMap;
    6059};
Note: See TracChangeset for help on using the changeset viewer.