2009-05-18 Maciej Stachowiak <mjs@apple.com>
authormjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 May 2009 05:39:07 +0000 (05:39 +0000)
committermjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 May 2009 05:39:07 +0000 (05:39 +0000)
        Reviewed by Oliver Hunt.

        - tighten up the code for the load_varargs stub

        ~1-2% on v8-raytrace

        * jit/JITStubs.cpp:
        (JSC::JITStubs::cti_op_load_varargs): Hoist some loop invariants that
        the compiler didn't feel like hoisting for us. Remove unneeded exception check.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@43854 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/jit/JITStubs.cpp

index b4e44a689ba42c168a95b281e82878069a5f202f..78ebeba0c751aa57f38caafcf0f28829e120d09d 100644 (file)
@@ -1,3 +1,15 @@
+2009-05-18  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Oliver Hunt.
+        
+        - tighten up the code for the load_varargs stub
+        
+        ~1-2% on v8-raytrace
+        
+        * jit/JITStubs.cpp:
+        (JSC::JITStubs::cti_op_load_varargs): Hoist some loop invariants that
+        the compiler didn't feel like hoisting for us. Remove unneeded exception check.
+
 2009-05-18  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Geoff Garen.
index cd15eba995a85d5999ca5da4090a75e36143d534..bdf83fff15454e674d71c5c8b088c2ffafad4b24 100644 (file)
@@ -1595,15 +1595,23 @@ int JITStubs::cti_op_load_varargs(STUB_ARGS_DECLARATION)
         }
         int32_t expectedParams = asFunction(callFrame[RegisterFile::Callee].jsValue())->body()->parameterCount();
         int32_t inplaceArgs = min(providedParams, expectedParams);
-        int32_t i = 0;
-        Register* argStore = callFrame->registers() + argsOffset;
         
+        Register* inplaceArgsDst = callFrame->registers() + argsOffset;
+
+        Register* inplaceArgsEnd = inplaceArgsDst + inplaceArgs;
+        Register* inplaceArgsEnd2 = inplaceArgsDst + providedParams;
+
+        Register* inplaceArgsSrc = callFrame->registers() - RegisterFile::CallFrameHeaderSize - expectedParams;
+        Register* inplaceArgsSrc2 = inplaceArgsSrc - providedParams - 1 + inplaceArgs;
         // First step is to copy the "expected" parameters from their normal location relative to the callframe
-        for (; i < inplaceArgs; i++)
-            argStore[i] = callFrame->registers()[i - RegisterFile::CallFrameHeaderSize - expectedParams];
+        while (inplaceArgsDst < inplaceArgsEnd)
+            *inplaceArgsDst++ = *inplaceArgsSrc++;
+
         // Then we copy any additional arguments that may be further up the stack ('-1' to account for 'this')
-        for (; i < providedParams; i++)
-            argStore[i] = callFrame->registers()[i - RegisterFile::CallFrameHeaderSize - expectedParams - providedParams - 1];
+        while (inplaceArgsDst < inplaceArgsEnd2)
+            *inplaceArgsDst++ = *inplaceArgsSrc2++;
+
     } else if (!arguments.isUndefinedOrNull()) {
         if (!arguments.isObject()) {
             CodeBlock* codeBlock = callFrame->codeBlock();
@@ -1652,7 +1660,7 @@ int JITStubs::cti_op_load_varargs(STUB_ARGS_DECLARATION)
             VM_THROW_EXCEPTION();
         }
     }
-    CHECK_FOR_EXCEPTION_AT_END();
+
     return argCount + 1;
 }