Title: [231283] trunk
Revision
231283
Author
fpi...@apple.com
Date
2018-05-02 17:37:30 -0700 (Wed, 02 May 2018)

Log Message

JSC should know how to cache custom getter accesses on the prototype chain
https://bugs.webkit.org/show_bug.cgi?id=185213

Reviewed by Keith Miller.

JSTests:

* microbenchmarks/get-custom-getter.js: Added.
(test):

Source/_javascript_Core:

This was a simple fix after the work I did for bug 185174. >4x speed-up on the new get-custom-getter.js test.

* jit/Repatch.cpp:
(JSC::tryCacheGetByID):

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (231282 => 231283)


--- trunk/JSTests/ChangeLog	2018-05-03 00:31:50 UTC (rev 231282)
+++ trunk/JSTests/ChangeLog	2018-05-03 00:37:30 UTC (rev 231283)
@@ -1,3 +1,13 @@
+2018-05-02  Filip Pizlo  <fpi...@apple.com>
+
+        JSC should know how to cache custom getter accesses on the prototype chain
+        https://bugs.webkit.org/show_bug.cgi?id=185213
+
+        Reviewed by Keith Miller.
+
+        * microbenchmarks/get-custom-getter.js: Added.
+        (test):
+
 2018-05-02  Robin Morisset  <rmoris...@apple.com>
 
         emitCodeToGetArgumentsArrayLength should not crash on PhantomNewArrayWithSpread

Added: trunk/JSTests/microbenchmarks/get-custom-getter.js (0 => 231283)


--- trunk/JSTests/microbenchmarks/get-custom-getter.js	                        (rev 0)
+++ trunk/JSTests/microbenchmarks/get-custom-getter.js	2018-05-03 00:37:30 UTC (rev 231283)
@@ -0,0 +1,21 @@
+// RegExp.input is a handy getter
+
+var o = RegExp;
+o.input = "foo";
+
+function test(o) {
+    var result = null;
+    for (var i = 0; i < 30000; i++)
+        result = o.input;
+
+    return result;
+}
+
+for (var k = 0; k < 9; k++) {
+    var newResult = test(o)
+    if (newResult != "foo")
+        throw "Failed at " + k + " with " +newResult;
+    result = newResult; 
+    o = {__proto__ : o }
+}
+

Modified: trunk/Source/_javascript_Core/ChangeLog (231282 => 231283)


--- trunk/Source/_javascript_Core/ChangeLog	2018-05-03 00:31:50 UTC (rev 231282)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-05-03 00:37:30 UTC (rev 231283)
@@ -1,3 +1,15 @@
+2018-05-02  Filip Pizlo  <fpi...@apple.com>
+
+        JSC should know how to cache custom getter accesses on the prototype chain
+        https://bugs.webkit.org/show_bug.cgi?id=185213
+
+        Reviewed by Keith Miller.
+
+        This was a simple fix after the work I did for bug 185174. >4x speed-up on the new get-custom-getter.js test.
+
+        * jit/Repatch.cpp:
+        (JSC::tryCacheGetByID):
+
 2018-05-01  Filip Pizlo  <fpi...@apple.com>
 
         JSC should be able to cache custom setter calls on the prototype chain

Modified: trunk/Source/_javascript_Core/jit/Repatch.cpp (231282 => 231283)


--- trunk/Source/_javascript_Core/jit/Repatch.cpp	2018-05-03 00:31:50 UTC (rev 231282)
+++ trunk/Source/_javascript_Core/jit/Repatch.cpp	2018-05-03 00:37:30 UTC (rev 231283)
@@ -301,13 +301,19 @@
                         // We use ObjectPropertyConditionSet instead for faster accesses.
                         prototypeAccessChain = nullptr;
 
+                        // FIXME: Maybe this `if` should be inside generateConditionsForPropertyBlah.
+                        // https://bugs.webkit.org/show_bug.cgi?id=185215
                         if (slot.isUnset()) {
                             conditionSet = generateConditionsForPropertyMiss(
                                 vm, codeBlock, exec, structure, propertyName.impl());
-                        } else {
+                        } else if (!slot.isCacheableCustom()) {
                             conditionSet = generateConditionsForPrototypePropertyHit(
                                 vm, codeBlock, exec, structure, slot.slotBase(),
                                 propertyName.impl());
+                        } else {
+                            conditionSet = generateConditionsForPrototypePropertyHitCustom(
+                                vm, codeBlock, exec, structure, slot.slotBase(),
+                                propertyName.impl());
                         }
 
                         if (!conditionSet.isValid())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to