Changeset 205276 in webkit


Ignore:
Timestamp:
Aug 31, 2016 7:11:43 PM (8 years ago)
Author:
Yusuke Suzuki
Message:

[JSC] linking and evaluating the modules are done in a sync manner
https://bugs.webkit.org/show_bug.cgi?id=161467

Reviewed by Saam Barati.

While the fetching and the other stages are done in an asynchronous manner,
linking and evaluating are done in a sync manner.
Just return the result value and do not wrap them with the internal promise.

  • builtins/ModuleLoaderPrototype.js:

(linkAndEvaluateModule):

  • runtime/Completion.cpp:

(JSC::linkAndEvaluateModule):

  • runtime/Completion.h:
  • runtime/JSModuleLoader.cpp:

(JSC::JSModuleLoader::linkAndEvaluateModule):

  • runtime/JSModuleLoader.h:
Location:
trunk/Source/JavaScriptCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r205267 r205276  
     12016-08-31  Yusuke Suzuki  <utatane.tea@gmail.com>
     2
     3        [JSC] linking and evaluating the modules are done in a sync manner
     4        https://bugs.webkit.org/show_bug.cgi?id=161467
     5
     6        Reviewed by Saam Barati.
     7
     8        While the fetching and the other stages are done in an asynchronous manner,
     9        linking and evaluating are done in a sync manner.
     10        Just return the result value and do not wrap them with the internal promise.
     11
     12        * builtins/ModuleLoaderPrototype.js:
     13        (linkAndEvaluateModule):
     14        * runtime/Completion.cpp:
     15        (JSC::linkAndEvaluateModule):
     16        * runtime/Completion.h:
     17        * runtime/JSModuleLoader.cpp:
     18        (JSC::JSModuleLoader::linkAndEvaluateModule):
     19        * runtime/JSModuleLoader.h:
     20
    1212016-08-31  Yusuke Suzuki  <utatane.tea@gmail.com>
    222
  • trunk/Source/JavaScriptCore/builtins/ModuleLoaderPrototype.js

    r204330 r205276  
    559559    "use strict";
    560560
    561     return this.requestReady(key);
    562 }
     561    var entry = this.ensureRegistered(key);
     562    if (entry.state < @ModuleLink)
     563        throw new @TypeError("Requested module is not instantiated yet.");
     564
     565    this.link(entry);
     566    return this.moduleEvaluation(entry.module);
     567}
  • trunk/Source/JavaScriptCore/runtime/Completion.cpp

    r204714 r205276  
    230230}
    231231
    232 JSInternalPromise* linkAndEvaluateModule(ExecState* exec, const Identifier& moduleKey)
     232JSValue linkAndEvaluateModule(ExecState* exec, const Identifier& moduleKey)
    233233{
    234234    JSLockHolder lock(exec);
  • trunk/Source/JavaScriptCore/runtime/Completion.h

    r201542 r205276  
    6666JS_EXPORT_PRIVATE JSInternalPromise* loadModule(ExecState*, const SourceCode&);
    6767
    68 // Link and evaluate the already linked module.
    69 JS_EXPORT_PRIVATE JSInternalPromise* linkAndEvaluateModule(ExecState*, const Identifier& moduleKey);
     68// Link and evaluate the already linked module. This function is called in a sync manner.
     69JS_EXPORT_PRIVATE JSValue linkAndEvaluateModule(ExecState*, const Identifier& moduleKey);
    7070
    7171} // namespace JSC
  • trunk/Source/JavaScriptCore/runtime/JSModuleLoader.cpp

    r204330 r205276  
    115115}
    116116
    117 JSInternalPromise* JSModuleLoader::linkAndEvaluateModule(ExecState* exec, JSValue moduleKey)
     117JSValue JSModuleLoader::linkAndEvaluateModule(ExecState* exec, JSValue moduleKey)
    118118{
    119119    JSObject* function = jsCast<JSObject*>(get(exec, exec->propertyNames().builtinNames().linkAndEvaluateModulePublicName()));
     
    125125    arguments.append(moduleKey);
    126126
    127     return jsCast<JSInternalPromise*>(call(exec, function, callType, callData, this, arguments));
     127    return call(exec, function, callType, callData, this, arguments);
    128128}
    129129
  • trunk/Source/JavaScriptCore/runtime/JSModuleLoader.h

    r204330 r205276  
    6666    JSInternalPromise* loadAndEvaluateModule(ExecState*, JSValue moduleName, JSValue referrer);
    6767    JSInternalPromise* loadModule(ExecState*, JSValue moduleName, JSValue referrer);
    68     JSInternalPromise* linkAndEvaluateModule(ExecState*, JSValue moduleKey);
     68    JSValue linkAndEvaluateModule(ExecState*, JSValue moduleKey);
    6969
    7070    // Platform dependent hooked APIs.
Note: See TracChangeset for help on using the changeset viewer.