Title: [205276] trunk/Source/_javascript_Core
Revision
205276
Author
[email protected]
Date
2016-08-31 19:11:43 -0700 (Wed, 31 Aug 2016)

Log 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:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (205275 => 205276)


--- trunk/Source/_javascript_Core/ChangeLog	2016-09-01 01:33:40 UTC (rev 205275)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-09-01 02:11:43 UTC (rev 205276)
@@ -1,5 +1,25 @@
 2016-08-31  Yusuke Suzuki  <[email protected]>
 
+        [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:
+
+2016-08-31  Yusuke Suzuki  <[email protected]>
+
         stress/random-53bit.js.ftl-no-cjit-no-inline-validate sometimes fails
         https://bugs.webkit.org/show_bug.cgi?id=161436
 

Modified: trunk/Source/_javascript_Core/builtins/ModuleLoaderPrototype.js (205275 => 205276)


--- trunk/Source/_javascript_Core/builtins/ModuleLoaderPrototype.js	2016-09-01 01:33:40 UTC (rev 205275)
+++ trunk/Source/_javascript_Core/builtins/ModuleLoaderPrototype.js	2016-09-01 02:11:43 UTC (rev 205276)
@@ -558,5 +558,10 @@
 {
     "use strict";
 
-    return this.requestReady(key);
+    var entry = this.ensureRegistered(key);
+    if (entry.state < @ModuleLink)
+        throw new @TypeError("Requested module is not instantiated yet.");
+
+    this.link(entry);
+    return this.moduleEvaluation(entry.module);
 }

Modified: trunk/Source/_javascript_Core/runtime/Completion.cpp (205275 => 205276)


--- trunk/Source/_javascript_Core/runtime/Completion.cpp	2016-09-01 01:33:40 UTC (rev 205275)
+++ trunk/Source/_javascript_Core/runtime/Completion.cpp	2016-09-01 02:11:43 UTC (rev 205276)
@@ -229,7 +229,7 @@
     return loadModule(lock, exec, globalObject, key, jsUndefined());
 }
 
-JSInternalPromise* linkAndEvaluateModule(ExecState* exec, const Identifier& moduleKey)
+JSValue linkAndEvaluateModule(ExecState* exec, const Identifier& moduleKey)
 {
     JSLockHolder lock(exec);
     RELEASE_ASSERT(exec->vm().atomicStringTable() == wtfThreadData().atomicStringTable());

Modified: trunk/Source/_javascript_Core/runtime/Completion.h (205275 => 205276)


--- trunk/Source/_javascript_Core/runtime/Completion.h	2016-09-01 01:33:40 UTC (rev 205275)
+++ trunk/Source/_javascript_Core/runtime/Completion.h	2016-09-01 02:11:43 UTC (rev 205276)
@@ -65,8 +65,8 @@
 JS_EXPORT_PRIVATE JSInternalPromise* loadModule(ExecState*, const String& moduleName);
 JS_EXPORT_PRIVATE JSInternalPromise* loadModule(ExecState*, const SourceCode&);
 
-// Link and evaluate the already linked module.
-JS_EXPORT_PRIVATE JSInternalPromise* linkAndEvaluateModule(ExecState*, const Identifier& moduleKey);
+// Link and evaluate the already linked module. This function is called in a sync manner.
+JS_EXPORT_PRIVATE JSValue linkAndEvaluateModule(ExecState*, const Identifier& moduleKey);
 
 } // namespace JSC
 

Modified: trunk/Source/_javascript_Core/runtime/JSModuleLoader.cpp (205275 => 205276)


--- trunk/Source/_javascript_Core/runtime/JSModuleLoader.cpp	2016-09-01 01:33:40 UTC (rev 205275)
+++ trunk/Source/_javascript_Core/runtime/JSModuleLoader.cpp	2016-09-01 02:11:43 UTC (rev 205276)
@@ -114,7 +114,7 @@
     return jsCast<JSInternalPromise*>(call(exec, function, callType, callData, this, arguments));
 }
 
-JSInternalPromise* JSModuleLoader::linkAndEvaluateModule(ExecState* exec, JSValue moduleKey)
+JSValue JSModuleLoader::linkAndEvaluateModule(ExecState* exec, JSValue moduleKey)
 {
     JSObject* function = jsCast<JSObject*>(get(exec, exec->propertyNames().builtinNames().linkAndEvaluateModulePublicName()));
     CallData callData;
@@ -124,7 +124,7 @@
     MarkedArgumentBuffer arguments;
     arguments.append(moduleKey);
 
-    return jsCast<JSInternalPromise*>(call(exec, function, callType, callData, this, arguments));
+    return call(exec, function, callType, callData, this, arguments);
 }
 
 JSInternalPromise* JSModuleLoader::resolve(ExecState* exec, JSValue name, JSValue referrer)

Modified: trunk/Source/_javascript_Core/runtime/JSModuleLoader.h (205275 => 205276)


--- trunk/Source/_javascript_Core/runtime/JSModuleLoader.h	2016-09-01 01:33:40 UTC (rev 205275)
+++ trunk/Source/_javascript_Core/runtime/JSModuleLoader.h	2016-09-01 02:11:43 UTC (rev 205276)
@@ -65,7 +65,7 @@
     JSValue provide(ExecState*, JSValue key, Status, const String&);
     JSInternalPromise* loadAndEvaluateModule(ExecState*, JSValue moduleName, JSValue referrer);
     JSInternalPromise* loadModule(ExecState*, JSValue moduleName, JSValue referrer);
-    JSInternalPromise* linkAndEvaluateModule(ExecState*, JSValue moduleKey);
+    JSValue linkAndEvaluateModule(ExecState*, JSValue moduleKey);
 
     // Platform dependent hooked APIs.
     JSInternalPromise* resolve(ExecState*, JSValue name, JSValue referrer);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to