Title: [209848] trunk/Source/_javascript_Core
Revision
209848
Author
[email protected]
Date
2016-12-14 18:23:56 -0800 (Wed, 14 Dec 2016)

Log Message

Update ModuleLoader code by using the latest builtin primitives
https://bugs.webkit.org/show_bug.cgi?id=165851

Reviewed by Sam Weinig.

Update the module loader code,

1. Use @globalPrivate for the utilities, instead of setting them as the member of ModuleLoader.
2. Use @putByValDirect instead of @push. @push is user-observable since it uses Set() operation
   and it can be observed by defining indexed setters in Array.prototype.

* builtins/ModuleLoaderPrototype.js:
(ensureRegistered):
(fulfillFetch):
(commitInstantiated):
(requestFetch):
(requestSatisfy):
(setStateToMax): Deleted.
(newRegistryEntry): Deleted.
* runtime/ModuleLoaderPrototype.cpp:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (209847 => 209848)


--- trunk/Source/_javascript_Core/ChangeLog	2016-12-15 01:41:53 UTC (rev 209847)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-12-15 02:23:56 UTC (rev 209848)
@@ -1,3 +1,26 @@
+2016-12-14  Yusuke Suzuki  <[email protected]>
+
+        Update ModuleLoader code by using the latest builtin primitives
+        https://bugs.webkit.org/show_bug.cgi?id=165851
+
+        Reviewed by Sam Weinig.
+
+        Update the module loader code,
+
+        1. Use @globalPrivate for the utilities, instead of setting them as the member of ModuleLoader.
+        2. Use @putByValDirect instead of @push. @push is user-observable since it uses Set() operation
+           and it can be observed by defining indexed setters in Array.prototype.
+
+        * builtins/ModuleLoaderPrototype.js:
+        (ensureRegistered):
+        (fulfillFetch):
+        (commitInstantiated):
+        (requestFetch):
+        (requestSatisfy):
+        (setStateToMax): Deleted.
+        (newRegistryEntry): Deleted.
+        * runtime/ModuleLoaderPrototype.cpp:
+
 2016-12-14  Michael Saboff  <[email protected]>
 
         The stress GC bot crashes in _javascript_Core beneath ShadowChicken::update and Inspector::jsToInspectorValue

Modified: trunk/Source/_javascript_Core/builtins/ModuleLoaderPrototype.js (209847 => 209848)


--- trunk/Source/_javascript_Core/builtins/ModuleLoaderPrototype.js	2016-12-15 01:41:53 UTC (rev 209847)
+++ trunk/Source/_javascript_Core/builtins/ModuleLoaderPrototype.js	2016-12-15 02:23:56 UTC (rev 209848)
@@ -32,6 +32,7 @@
 //    2. Loader.fetch
 //    3. Loader.instantiate
 
+@globalPrivate
 function setStateToMax(entry, newState)
 {
     // https://whatwg.github.io/loader/#set-state-to-max
@@ -42,6 +43,7 @@
         entry.state = newState;
 }
 
+@globalPrivate
 function newRegistryEntry(key)
 {
     // https://whatwg.github.io/loader/#registry
@@ -111,7 +113,7 @@
     if (entry)
         return entry;
 
-    entry = this.newRegistryEntry(key);
+    entry = @newRegistryEntry(key);
     this.registry.@set(key, entry);
 
     return entry;
@@ -134,7 +136,7 @@
     if (!entry.fetch)
         entry.fetch = @newPromiseCapability(@InternalPromise).@promise;
     this.forceFulfillPromise(entry.fetch, payload);
-    this.setStateToMax(entry, @ModuleInstantiate);
+    @setStateToMax(entry, @ModuleInstantiate);
 }
 
 function fulfillInstantiate(entry, optionalInstance, source)
@@ -180,13 +182,13 @@
             key: depKey,
             value: @undefined
         };
-        dependencies.@push(pair);
+        @putByValDirect(dependencies, dependencies.length, pair);
         dependenciesMap.@set(depKey, pair);
     }
     entry.dependencies = dependencies;
     entry.dependenciesMap = dependenciesMap;
     entry.module = moduleRecord;
-    this.setStateToMax(entry, @ModuleSatisfy);
+    @setStateToMax(entry, @ModuleSatisfy);
 }
 
 function instantiation(result, source, entry)
@@ -219,7 +221,7 @@
     //     For example, _javascript_Core shell can provide the hook fetching the resource
     //     from the local file system.
     var fetchPromise = this.fetch(key, initiator).then((payload) => {
-        this.setStateToMax(entry, @ModuleInstantiate);
+        @setStateToMax(entry, @ModuleInstantiate);
         return payload;
     });
     entry.fetch = fetchPromise;
@@ -297,11 +299,11 @@
                     return entry;
                 });
             });
-            depLoads.@push(promise);
+            @putByValDirect(depLoads, depLoads.length, promise);
         }
 
         return @InternalPromise.internalAll(depLoads).then((modules) => {
-            this.setStateToMax(entry, @ModuleLink);
+            @setStateToMax(entry, @ModuleLink);
             return entry;
         });
     });
@@ -363,7 +365,7 @@
 
     if (entry.state === @ModuleReady)
         return;
-    this.setStateToMax(entry, @ModuleReady);
+    @setStateToMax(entry, @ModuleReady);
 
     // Since we already have the "dependencies" field,
     // we can call moduleDeclarationInstantiation with the correct order

Modified: trunk/Source/_javascript_Core/runtime/ModuleLoaderPrototype.cpp (209847 => 209848)


--- trunk/Source/_javascript_Core/runtime/ModuleLoaderPrototype.cpp	2016-12-15 01:41:53 UTC (rev 209847)
+++ trunk/Source/_javascript_Core/runtime/ModuleLoaderPrototype.cpp	2016-12-15 02:23:56 UTC (rev 209848)
@@ -65,8 +65,6 @@
 
 /* Source for ModuleLoaderPrototype.lut.h
 @begin moduleLoaderPrototypeTable
-    setStateToMax                  JSBuiltin                                           DontEnum|Function 2
-    newRegistryEntry               JSBuiltin                                           DontEnum|Function 1
     ensureRegistered               JSBuiltin                                           DontEnum|Function 1
     forceFulfillPromise            JSBuiltin                                           DontEnum|Function 2
     fulfillFetch                   JSBuiltin                                           DontEnum|Function 2
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to