Title: [160688] trunk/Source/_javascript_Core
Revision
160688
Author
[email protected]
Date
2013-12-16 18:43:26 -0800 (Mon, 16 Dec 2013)

Log Message

Avoid indirect function calls for custom getters
https://bugs.webkit.org/show_bug.cgi?id=125821

Reviewed by Mark Hahnenberg.

Rather than invoking a helper function to perform an indirect call
through a function pointer, just have the JIT call the function directly.

Unfortunately this only works in JSVALUE64 at the moment as there
is not an obvious way to pass two EncodedJSValues uniformly over
the various effected JITs.

* jit/CCallHelpers.h:
(JSC::CCallHelpers::setupArguments):
* jit/Repatch.cpp:
(JSC::generateProtoChainAccessStub):
(JSC::tryBuildGetByIDList):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (160687 => 160688)


--- trunk/Source/_javascript_Core/ChangeLog	2013-12-17 02:27:01 UTC (rev 160687)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-12-17 02:43:26 UTC (rev 160688)
@@ -1,3 +1,23 @@
+2013-12-16  Oliver Hunt  <[email protected]>
+
+        Avoid indirect function calls for custom getters
+        https://bugs.webkit.org/show_bug.cgi?id=125821
+
+        Reviewed by Mark Hahnenberg.
+
+        Rather than invoking a helper function to perform an indirect call
+        through a function pointer, just have the JIT call the function directly.
+
+        Unfortunately this only works in JSVALUE64 at the moment as there
+        is not an obvious way to pass two EncodedJSValues uniformly over
+        the various effected JITs.
+
+        * jit/CCallHelpers.h:
+        (JSC::CCallHelpers::setupArguments):
+        * jit/Repatch.cpp:
+        (JSC::generateProtoChainAccessStub):
+        (JSC::tryBuildGetByIDList):
+
 2013-12-16  Joseph Pecoraro  <[email protected]>
 
         Fix some whitespace issues in inspector code

Modified: trunk/Source/_javascript_Core/jit/CCallHelpers.h (160687 => 160688)


--- trunk/Source/_javascript_Core/jit/CCallHelpers.h	2013-12-17 02:27:01 UTC (rev 160687)
+++ trunk/Source/_javascript_Core/jit/CCallHelpers.h	2013-12-17 02:43:26 UTC (rev 160688)
@@ -956,6 +956,12 @@
         move(arg4, GPRInfo::argumentGPR3);
     }
     
+    ALWAYS_INLINE void setupArguments(GPRReg arg1, GPRReg arg2, GPRReg arg3, TrustedImmPtr arg4)
+    {
+        setupThreeStubArgsGPR<GPRInfo::argumentGPR0, GPRInfo::argumentGPR1, GPRInfo::argumentGPR2>(arg1, arg2, arg3);
+        move(arg4, GPRInfo::argumentGPR3);
+    }
+    
     ALWAYS_INLINE void setupArguments(GPRReg arg1, TrustedImmPtr arg2, GPRReg arg3, TrustedImmPtr arg4)
     {
         setupTwoStubArgsGPR<GPRInfo::argumentGPR0, GPRInfo::argumentGPR2>(arg1, arg3);

Modified: trunk/Source/_javascript_Core/jit/Repatch.cpp (160687 => 160688)


--- trunk/Source/_javascript_Core/jit/Repatch.cpp	2013-12-17 02:27:01 UTC (rev 160687)
+++ trunk/Source/_javascript_Core/jit/Repatch.cpp	2013-12-17 02:43:26 UTC (rev 160688)
@@ -305,11 +305,17 @@
             stubJit.setupArguments(callFrameRegister, scratchGPR, resultGPR);
             operationFunction = operationCallGetter;
         } else {
+#if USE(JSVALUE64)
+            // EncodedJSValue (*GetValueFunc)(ExecState*, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName);
+            stubJit.setupArguments(callFrameRegister, MacroAssembler::TrustedImmPtr(protoObject), scratchGPR, MacroAssembler::TrustedImmPtr(propertyName.impl()));
+            operationFunction = FunctionPtr(slot.customGetter());
+#else
             stubJit.move(MacroAssembler::TrustedImmPtr(protoObject), scratchGPR);
             stubJit.setupArguments(callFrameRegister, scratchGPR,
                 MacroAssembler::TrustedImmPtr(FunctionPtr(slot.customGetter()).executableAddress()),
                 MacroAssembler::TrustedImmPtr(propertyName.impl()));
             operationFunction = operationCallCustomGetter;
+#endif
         }
 
         // Need to make sure that whenever this call is made in the future, we remember the
@@ -607,11 +613,17 @@
                 stubJit.setupArguments(callFrameRegister, baseGPR, scratchGPR);
                 operationFunction = operationCallGetter;
             } else {
+#if USE(JSVALUE64)
+                // EncodedJSValue (*GetValueFunc)(ExecState*, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName);
+                stubJit.setupArguments(callFrameRegister, baseGPR, baseGPR, MacroAssembler::TrustedImmPtr(ident.impl()));
+                operationFunction = FunctionPtr(slot.customGetter());
+#else
                 stubJit.setupArguments(
                     callFrameRegister, baseGPR,
                     MacroAssembler::TrustedImmPtr(FunctionPtr(slot.customGetter()).executableAddress()),
                     MacroAssembler::TrustedImmPtr(ident.impl()));
                 operationFunction = operationCallCustomGetter;
+#endif
             }
             
             // Need to make sure that whenever this call is made in the future, we remember the
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to