Title: [96988] trunk/Source/_javascript_Core
Revision
96988
Author
[email protected]
Date
2011-10-07 16:38:03 -0700 (Fri, 07 Oct 2011)

Log Message

Refactor DFG to make for use of callOperation
https://bugs.webkit.org/show_bug.cgi?id=69672

Reviewed by Oliver Hunt.

* dfg/DFGJITCodeGenerator.h:
(JSC::DFG::callOperation):
    - Added new callOperation calls, don't ASSERT flushed (use helpers for unexpected calls, too).
* dfg/DFGOperations.cpp:
* dfg/DFGOperations.h:
    - Switch operationNewObject/operationCreateThis to return Cells,
    - Added C_DFGOperation_E/C_DFGOperation_EC/J_DFGOperation_EA/J_DFGOperation_EJA call types.
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compileLogicalNot):
(JSC::DFG::SpeculativeJIT::emitBranch):
(JSC::DFG::SpeculativeJIT::compile):
    - Replace code plating calls to operations to with calls to callOperation.
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compileLogicalNot):
(JSC::DFG::SpeculativeJIT::emitBranch):
(JSC::DFG::SpeculativeJIT::compile):
    - Replace code plating calls to operations to with calls to callOperation.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (96987 => 96988)


--- trunk/Source/_javascript_Core/ChangeLog	2011-10-07 23:29:50 UTC (rev 96987)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-10-07 23:38:03 UTC (rev 96988)
@@ -1,3 +1,28 @@
+2011-10-07  Gavin Barraclough  <[email protected]>
+
+        Refactor DFG to make for use of callOperation
+        https://bugs.webkit.org/show_bug.cgi?id=69672
+
+        Reviewed by Oliver Hunt.
+
+        * dfg/DFGJITCodeGenerator.h:
+        (JSC::DFG::callOperation):
+            - Added new callOperation calls, don't ASSERT flushed (use helpers for unexpected calls, too).
+        * dfg/DFGOperations.cpp:
+        * dfg/DFGOperations.h:
+            - Switch operationNewObject/operationCreateThis to return Cells,
+            - Added C_DFGOperation_E/C_DFGOperation_EC/J_DFGOperation_EA/J_DFGOperation_EJA call types.
+        * dfg/DFGSpeculativeJIT32_64.cpp:
+        (JSC::DFG::SpeculativeJIT::compileLogicalNot):
+        (JSC::DFG::SpeculativeJIT::emitBranch):
+        (JSC::DFG::SpeculativeJIT::compile):
+            - Replace code plating calls to operations to with calls to callOperation.
+        * dfg/DFGSpeculativeJIT64.cpp:
+        (JSC::DFG::SpeculativeJIT::compileLogicalNot):
+        (JSC::DFG::SpeculativeJIT::emitBranch):
+        (JSC::DFG::SpeculativeJIT::compile):
+            - Replace code plating calls to operations to with calls to callOperation.
+
 2011-10-07  Oliver Hunt  <[email protected]>
 
         Support string indexing in the DFG

Modified: trunk/Source/_javascript_Core/dfg/DFGJITCodeGenerator.h (96987 => 96988)


--- trunk/Source/_javascript_Core/dfg/DFGJITCodeGenerator.h	2011-10-07 23:29:50 UTC (rev 96987)
+++ trunk/Source/_javascript_Core/dfg/DFGJITCodeGenerator.h	2011-10-07 23:38:03 UTC (rev 96988)
@@ -1056,8 +1056,6 @@
     // These methods add calls to C++ helper functions.
     void callOperation(J_DFGOperation_EP operation, GPRReg result, void* pointer)
     {
-        ASSERT(isFlushed());
-
         m_jit.move(JITCompiler::TrustedImmPtr(pointer), GPRInfo::argumentGPR1);
         m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
 
@@ -1068,10 +1066,12 @@
     {
         callOperation((J_DFGOperation_EP)operation, result, identifier);
     }
+    void callOperation(J_DFGOperation_EA operation, GPRReg result, GPRReg arg1)
+    {
+        callOperation((J_DFGOperation_EP)operation, result, arg1);
+    }
     void callOperation(J_DFGOperation_EPS operation, GPRReg result, void* pointer, size_t size)
     {
-        ASSERT(isFlushed());
-
         m_jit.move(JITCompiler::TrustedImmPtr(size), GPRInfo::argumentGPR2);
         m_jit.move(JITCompiler::TrustedImmPtr(pointer), GPRInfo::argumentGPR1);
         m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
@@ -1081,8 +1081,6 @@
     }
     void callOperation(J_DFGOperation_ESS operation, GPRReg result, int startConstant, int numConstants)
     {
-        ASSERT(isFlushed());
-
         m_jit.move(JITCompiler::TrustedImm32(numConstants), GPRInfo::argumentGPR2);
         m_jit.move(JITCompiler::TrustedImm32(startConstant), GPRInfo::argumentGPR1);
         m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
@@ -1092,8 +1090,6 @@
     }
     void callOperation(J_DFGOperation_EJP operation, GPRReg result, GPRReg arg1, void* pointer)
     {
-        ASSERT(isFlushed());
-
         m_jit.move(arg1, GPRInfo::argumentGPR1);
         m_jit.move(JITCompiler::TrustedImmPtr(pointer), GPRInfo::argumentGPR2);
         m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
@@ -1105,10 +1101,28 @@
     {
         callOperation((J_DFGOperation_EJP)operation, result, arg1, identifier);
     }
+    void callOperation(J_DFGOperation_EJA operation, GPRReg result, GPRReg arg1, GPRReg arg2)
+    {
+        callOperation((J_DFGOperation_EJP)operation, result, arg1, arg2);
+    }
+    // This also handles J_DFGOperation_EP!
     void callOperation(J_DFGOperation_EJ operation, GPRReg result, GPRReg arg1)
     {
-        ASSERT(isFlushed());
+        m_jit.move(arg1, GPRInfo::argumentGPR1);
+        m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
 
+        appendCallWithExceptionCheck(operation);
+        m_jit.move(GPRInfo::returnValueGPR, result);
+    }
+    void callOperation(C_DFGOperation_E operation, GPRReg result)
+    {
+        m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
+
+        appendCallWithExceptionCheck(operation);
+        m_jit.move(GPRInfo::returnValueGPR, result);
+    }
+    void callOperation(C_DFGOperation_EC operation, GPRReg result, GPRReg arg1)
+    {
         m_jit.move(arg1, GPRInfo::argumentGPR1);
         m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
 
@@ -1117,8 +1131,6 @@
     }
     void callOperation(Z_DFGOperation_EJ operation, GPRReg result, GPRReg arg1)
     {
-        ASSERT(isFlushed());
-
         m_jit.move(arg1, GPRInfo::argumentGPR1);
         m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
 
@@ -1127,18 +1139,15 @@
     }
     void callOperation(Z_DFGOperation_EJJ operation, GPRReg result, GPRReg arg1, GPRReg arg2)
     {
-        ASSERT(isFlushed());
-
         setupStubArguments(arg1, arg2);
         m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
 
         appendCallWithExceptionCheck(operation);
         m_jit.move(GPRInfo::returnValueGPR, result);
     }
+    // This also handles J_DFGOperation_EJP!
     void callOperation(J_DFGOperation_EJJ operation, GPRReg result, GPRReg arg1, GPRReg arg2)
     {
-        ASSERT(isFlushed());
-
         setupStubArguments(arg1, arg2);
         m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
 
@@ -1147,8 +1156,6 @@
     }
     void callOperation(V_DFGOperation_EJJP operation, GPRReg arg1, GPRReg arg2, void* pointer)
     {
-        ASSERT(isFlushed());
-
         setupStubArguments(arg1, arg2);
         m_jit.move(JITCompiler::TrustedImmPtr(pointer), GPRInfo::argumentGPR3);
         m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
@@ -1161,8 +1168,6 @@
     }
     void callOperation(V_DFGOperation_EJJJ operation, GPRReg arg1, GPRReg arg2, GPRReg arg3)
     {
-        ASSERT(isFlushed());
-
         setupStubArguments(arg1, arg2, arg3);
         m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
 
@@ -1170,8 +1175,6 @@
     }
     void callOperation(D_DFGOperation_DD operation, FPRReg result, FPRReg arg1, FPRReg arg2)
     {
-        ASSERT(isFlushed());
-
         setupTwoStubArgs<FPRInfo::argumentFPR0, FPRInfo::argumentFPR1>(arg1, arg2);
 
         m_jit.appendCall(operation);
@@ -1202,22 +1205,30 @@
     // These methods add calls to C++ helper functions.
     void callOperation(J_DFGOperation_EP operation, GPRReg resultTag, GPRReg resultPayload, void* pointer)
     {
-        ASSERT(isFlushed());
-
         m_jit.push(JITCompiler::TrustedImm32(reinterpret_cast<int>(pointer)));
         m_jit.push(GPRInfo::callFrameRegister);
 
         appendCallWithExceptionCheck(operation);
         setupResults(resultTag, resultPayload);
     }
+    void callOperation(J_DFGOperation_EP operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1)
+    {
+        m_jit.push(arg1);
+        m_jit.push(GPRInfo::callFrameRegister);
+
+        appendCallWithExceptionCheck(operation);
+        setupResults(resultTag, resultPayload);
+    }
     void callOperation(J_DFGOperation_EI operation, GPRReg resultTag, GPRReg resultPayload, Identifier* identifier)
     {
         callOperation((J_DFGOperation_EP)operation, resultTag, resultPayload, identifier);
     }
+    void callOperation(J_DFGOperation_EA operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1)
+    {
+        callOperation((J_DFGOperation_EP)operation, resultTag, resultPayload, arg1);
+    }
     void callOperation(J_DFGOperation_EPS operation, GPRReg resultTag, GPRReg resultPayload, void* pointer, size_t size)
     {
-        ASSERT(isFlushed());
-
         m_jit.push(JITCompiler::TrustedImm32(size));
         m_jit.push(JITCompiler::TrustedImm32(reinterpret_cast<int>(pointer)));
         m_jit.push(GPRInfo::callFrameRegister);
@@ -1227,8 +1238,6 @@
     }
     void callOperation(J_DFGOperation_ESS operation, GPRReg resultTag, GPRReg resultPayload, int startConstant, int numConstants)
     {
-        ASSERT(isFlushed());
-
         m_jit.push(JITCompiler::TrustedImm32(numConstants));
         m_jit.push(JITCompiler::TrustedImm32(startConstant));
         m_jit.push(GPRInfo::callFrameRegister);
@@ -1238,8 +1247,6 @@
     }
     void callOperation(J_DFGOperation_EJP operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1Tag, GPRReg arg1Payload, void* pointer)
     {
-        ASSERT(isFlushed());
-
         m_jit.push(JITCompiler::TrustedImm32(reinterpret_cast<int>(pointer)));
         m_jit.push(arg1Tag);
         m_jit.push(arg1Payload);
@@ -1248,14 +1255,26 @@
         appendCallWithExceptionCheck(operation);
         setupResults(resultTag, resultPayload);
     }
+    void callOperation(J_DFGOperation_EJP operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2)
+    {
+        m_jit.push(arg2);
+        m_jit.push(arg1Tag);
+        m_jit.push(arg1Payload);
+        m_jit.push(GPRInfo::callFrameRegister);
+
+        appendCallWithExceptionCheck(operation);
+        setupResults(resultTag, resultPayload);
+    }
     void callOperation(J_DFGOperation_EJI operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1Tag, GPRReg arg1Payload, Identifier* identifier)
     {
         callOperation((J_DFGOperation_EJP)operation, resultTag, resultPayload, arg1Tag, arg1Payload, identifier);
     }
+    void callOperation(J_DFGOperation_EJA operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2)
+    {
+        callOperation((J_DFGOperation_EJP)operation, resultTag, resultPayload, arg1Tag, arg1Payload, arg2);
+    }
     void callOperation(J_DFGOperation_EJ operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1Tag, GPRReg arg1Payload)
     {
-        ASSERT(isFlushed());
-
         m_jit.push(arg1Tag);
         m_jit.push(arg1Payload);
         m_jit.push(GPRInfo::callFrameRegister);
@@ -1263,10 +1282,23 @@
         appendCallWithExceptionCheck(operation);
         setupResults(resultTag, resultPayload);
     }
+    void callOperation(C_DFGOperation_E operation, GPRReg result)
+    {
+        m_jit.push(GPRInfo::callFrameRegister);
+
+        appendCallWithExceptionCheck(operation);
+        m_jit.move(GPRInfo::returnValueGPR, result);
+    }
+    void callOperation(C_DFGOperation_EC operation, GPRReg result, GPRReg arg1)
+    {
+        m_jit.push(arg1);
+        m_jit.push(GPRInfo::callFrameRegister);
+
+        appendCallWithExceptionCheck(operation);
+        m_jit.move(GPRInfo::returnValueGPR, result);
+    }
     void callOperation(Z_DFGOperation_EJ operation, GPRReg result, GPRReg arg1Tag, GPRReg arg1Payload)
     {
-        ASSERT(isFlushed());
-
         m_jit.push(arg1Tag);
         m_jit.push(arg1Payload);
         m_jit.push(GPRInfo::callFrameRegister);
@@ -1276,8 +1308,6 @@
     }
     void callOperation(Z_DFGOperation_EJJ operation, GPRReg result, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2Tag, GPRReg arg2Payload)
     {
-        ASSERT(isFlushed());
-
         m_jit.push(arg2Tag);
         m_jit.push(arg2Payload);
         m_jit.push(arg1Tag);
@@ -1289,8 +1319,6 @@
     }
     void callOperation(J_DFGOperation_EJJ operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2Tag, GPRReg arg2Payload)
     {
-        ASSERT(isFlushed());
-
         m_jit.push(arg2Tag);
         m_jit.push(arg2Payload);
         m_jit.push(arg1Tag);
@@ -1302,8 +1330,6 @@
     }
     void callOperation(V_DFGOperation_EJJP operation, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2Tag, GPRReg arg2Payload, void* pointer)
     {
-        ASSERT(isFlushed());
-
         m_jit.push(JITCompiler::TrustedImm32(reinterpret_cast<int>(pointer)));
         m_jit.push(arg2Tag);
         m_jit.push(arg2Payload);
@@ -1319,8 +1345,6 @@
     }
     void callOperation(V_DFGOperation_EJJJ operation, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2Tag, GPRReg arg2Payload, GPRReg arg3Tag, GPRReg arg3Payload)
     {
-        ASSERT(isFlushed());
-
         m_jit.push(arg3Tag);
         m_jit.push(arg3Payload);
         m_jit.push(arg2Tag);
@@ -1334,8 +1358,6 @@
 
     void callOperation(D_DFGOperation_DD operation, FPRReg result, FPRReg arg1, FPRReg arg2)
     {
-        ASSERT(isFlushed());
-
         m_jit.subPtr(TrustedImm32(2 * sizeof(double)), JITCompiler::stackPointerRegister);
         m_jit.storeDouble(arg2, JITCompiler::Address(JITCompiler::stackPointerRegister, sizeof(double)));
         m_jit.storeDouble(arg1, JITCompiler::stackPointerRegister);

Modified: trunk/Source/_javascript_Core/dfg/DFGOperations.cpp (96987 => 96988)


--- trunk/Source/_javascript_Core/dfg/DFGOperations.cpp	2011-10-07 23:29:50 UTC (rev 96987)
+++ trunk/Source/_javascript_Core/dfg/DFGOperations.cpp	2011-10-07 23:38:03 UTC (rev 96988)
@@ -135,7 +135,7 @@
     return JSValue::encode(JSValue::decode(encodedOp).toThisObject(exec));
 }
 
-EncodedJSValue DFG_OPERATION operationCreateThis(ExecState* exec, EncodedJSValue encodedOp)
+JSCell* DFG_OPERATION operationCreateThis(ExecState* exec, JSCell* prototype)
 {
     JSFunction* constructor = asFunction(exec->callee());
     
@@ -147,18 +147,17 @@
     JSGlobalData& globalData = exec->globalData();
     
     Structure* structure;
-    JSValue proto = JSValue::decode(encodedOp);
-    if (proto.isObject())
-        structure = asObject(proto)->inheritorID(globalData);
+    if (prototype->isObject())
+        structure = asObject(prototype)->inheritorID(globalData);
     else
         structure = constructor->scope()->globalObject->emptyObjectStructure();
     
-    return JSValue::encode(constructEmptyObject(exec, structure));
+    return constructEmptyObject(exec, structure);
 }
 
-EncodedJSValue DFG_OPERATION operationNewObject(ExecState* exec)
+JSCell* DFG_OPERATION operationNewObject(ExecState* exec)
 {
-    return JSValue::encode(constructEmptyObject(exec));
+    return constructEmptyObject(exec);
 }
 
 EncodedJSValue DFG_OPERATION operationValueAdd(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2)
@@ -374,7 +373,7 @@
     array->JSArray::put(exec, index, JSValue::decode(encodedValue));
 }
 
-EncodedJSValue DFG_OPERATION operationArrayPush(ExecState* exec, JSArray* array, EncodedJSValue encodedValue)
+EncodedJSValue DFG_OPERATION operationArrayPush(ExecState* exec, EncodedJSValue encodedValue, JSArray* array)
 {
     array->push(exec, JSValue::decode(encodedValue));
     return JSValue::encode(jsNumber(array->length()));

Modified: trunk/Source/_javascript_Core/dfg/DFGOperations.h (96987 => 96988)


--- trunk/Source/_javascript_Core/dfg/DFGOperations.h	2011-10-07 23:29:50 UTC (rev 96987)
+++ trunk/Source/_javascript_Core/dfg/DFGOperations.h	2011-10-07 23:38:03 UTC (rev 96988)
@@ -50,6 +50,10 @@
 
 // These typedefs provide typechecking when generating calls out to helper routines;
 // this helps prevent calling a helper routine with the wrong arguments!
+typedef JSCell* DFG_OPERATION (*C_DFGOperation_E)(ExecState*);
+typedef JSCell* DFG_OPERATION (*C_DFGOperation_EC)(ExecState*, JSCell*);
+typedef EncodedJSValue DFG_OPERATION (*J_DFGOperation_EA)(ExecState*, JSArray*);
+typedef EncodedJSValue DFG_OPERATION (*J_DFGOperation_EJA)(ExecState*, EncodedJSValue, JSArray*);
 typedef EncodedJSValue DFG_OPERATION (*J_DFGOperation_EJJ)(ExecState*, EncodedJSValue, EncodedJSValue);
 typedef EncodedJSValue DFG_OPERATION (*J_DFGOperation_EJ)(ExecState*, EncodedJSValue);
 typedef EncodedJSValue DFG_OPERATION (*J_DFGOperation_EJP)(ExecState*, EncodedJSValue, void*);
@@ -67,9 +71,9 @@
 typedef void* DFG_OPERATION (*P_DFGOperation_E)(ExecState*);
 
 // These routines are provide callbacks out to C++ implementations of operations too complex to JIT.
+JSCell* DFG_OPERATION operationNewObject(ExecState*);
+JSCell* DFG_OPERATION operationCreateThis(ExecState*, JSCell* encodedOp1);
 EncodedJSValue DFG_OPERATION operationConvertThis(ExecState*, EncodedJSValue encodedOp1);
-EncodedJSValue DFG_OPERATION operationCreateThis(ExecState*, EncodedJSValue encodedOp1);
-EncodedJSValue DFG_OPERATION operationNewObject(ExecState*);
 EncodedJSValue DFG_OPERATION operationValueAdd(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2);
 EncodedJSValue DFG_OPERATION operationValueAddNotNumber(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2);
 EncodedJSValue DFG_OPERATION operationArithAdd(EncodedJSValue encodedOp1, EncodedJSValue encodedOp2);
@@ -97,7 +101,7 @@
 void DFG_OPERATION operationPutByValStrict(ExecState*, EncodedJSValue encodedBase, EncodedJSValue encodedProperty, EncodedJSValue encodedValue);
 void DFG_OPERATION operationPutByValNonStrict(ExecState*, EncodedJSValue encodedBase, EncodedJSValue encodedProperty, EncodedJSValue encodedValue);
 void DFG_OPERATION operationPutByValBeyondArrayBounds(ExecState*, JSArray*, int32_t index, EncodedJSValue encodedValue);
-EncodedJSValue DFG_OPERATION operationArrayPush(ExecState*, JSArray*, EncodedJSValue encodedValue);
+EncodedJSValue DFG_OPERATION operationArrayPush(ExecState*, EncodedJSValue encodedValue, JSArray*);
 EncodedJSValue DFG_OPERATION operationArrayPop(ExecState*, JSArray*);
 void DFG_OPERATION operationPutByIdStrict(ExecState*, EncodedJSValue encodedValue, EncodedJSValue encodedBase, Identifier*);
 void DFG_OPERATION operationPutByIdNonStrict(ExecState*, EncodedJSValue encodedValue, EncodedJSValue encodedBase, Identifier*);

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp (96987 => 96988)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp	2011-10-07 23:29:50 UTC (rev 96987)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp	2011-10-07 23:38:03 UTC (rev 96988)
@@ -528,11 +528,7 @@
     JITCompiler::Jump fastCase = m_jit.branch32(JITCompiler::Equal, arg1TagGPR, TrustedImm32(JSValue::BooleanTag));
         
     silentSpillAllRegisters(resultTagGPR, resultPayloadGPR);
-    m_jit.push(arg1TagGPR);
-    m_jit.push(arg1PayloadGPR);
-    m_jit.push(GPRInfo::callFrameRegister);
-    appendCallWithExceptionCheck(dfgConvertJSValueToBoolean);
-    m_jit.move(GPRInfo::returnValueGPR, resultPayloadGPR);
+    callOperation(dfgConvertJSValueToBoolean, resultPayloadGPR, arg1TagGPR, arg1PayloadGPR);
     silentFillAllRegisters(resultTagGPR, resultPayloadGPR);
     JITCompiler::Jump doNot = m_jit.jump();
         
@@ -620,11 +616,7 @@
 
         slowPath.link(&m_jit);
         silentSpillAllRegisters(resultGPR);
-        m_jit.push(valueTagGPR);
-        m_jit.push(valuePayloadGPR);
-        m_jit.push(GPRInfo::callFrameRegister);
-        appendCallWithExceptionCheck(dfgConvertJSValueToBoolean);
-        m_jit.move(GPRInfo::returnValueGPR, resultGPR);
+        callOperation(dfgConvertJSValueToBoolean, resultGPR, valueTagGPR, valuePayloadGPR);
         silentFillAllRegisters(resultGPR);
     
         addBranch(m_jit.branchTest8(JITCompiler::NonZero, resultGPR), taken);
@@ -1432,12 +1424,7 @@
         slowPath.link(&m_jit);
         
         silentSpillAllRegisters(storageGPR, storageLengthGPR);
-        m_jit.push(valueTagGPR);
-        m_jit.push(valuePayloadGPR);
-        m_jit.push(baseGPR);
-        m_jit.push(GPRInfo::callFrameRegister);
-        appendCallWithExceptionCheck(operationArrayPush);
-        setupResults(storageGPR, storageLengthGPR);
+        callOperation(operationArrayPush, storageGPR, storageLengthGPR, valueTagGPR, valuePayloadGPR, baseGPR);
         silentFillAllRegisters(storageGPR, storageLengthGPR);
         
         done.link(&m_jit);
@@ -1496,10 +1483,7 @@
         slowCase.link(&m_jit);
         
         silentSpillAllRegisters(valueTagGPR, valuePayloadGPR);
-        m_jit.push(baseGPR);
-        m_jit.push(GPRInfo::callFrameRegister);
-        appendCallWithExceptionCheck(operationArrayPop);
-        setupResults(valueTagGPR, valuePayloadGPR);
+        callOperation(operationArrayPop, valueTagGPR, valuePayloadGPR, baseGPR);
         silentFillAllRegisters(valueTagGPR, valuePayloadGPR);
         
         done.link(&m_jit);
@@ -1629,11 +1613,7 @@
             alreadyPrimitive.append(m_jit.branchPtr(MacroAssembler::Equal, MacroAssembler::Address(op1PayloadGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsStringVPtr)));
             
             silentSpillAllRegisters(resultTagGPR, resultPayloadGPR);
-            m_jit.push(op1TagGPR);
-            m_jit.push(op1PayloadGPR);
-            m_jit.push(GPRInfo::callFrameRegister);
-            appendCallWithExceptionCheck(operationToPrimitive);
-            setupResults(resultTagGPR, resultPayloadGPR);
+            callOperation(operationToPrimitive, resultTagGPR, resultPayloadGPR, op1TagGPR, op1PayloadGPR);
             silentFillAllRegisters(resultTagGPR, resultPayloadGPR);
             
             MacroAssembler::Jump done = m_jit.jump();
@@ -1797,11 +1777,7 @@
         slowPath.link(&m_jit);
         
         silentSpillAllRegisters(resultGPR);
-        m_jit.push(TrustedImm32(JSValue::CellTag));
-        m_jit.push(protoGPR);
-        m_jit.push(GPRInfo::callFrameRegister);
-        appendCallWithExceptionCheck(operationCreateThis);
-        m_jit.move(GPRInfo::returnValueGPR, resultGPR);
+        callOperation(operationCreateThis, resultGPR, protoGPR);
         silentFillAllRegisters(resultGPR);
         
         done.link(&m_jit);
@@ -1826,9 +1802,7 @@
         slowPath.link(&m_jit);
         
         silentSpillAllRegisters(resultGPR);
-        m_jit.push(GPRInfo::callFrameRegister);
-        appendCallWithExceptionCheck(operationNewObject);
-        m_jit.move(GPRInfo::returnValueGPR, resultGPR);
+        callOperation(operationNewObject, resultGPR);
         silentFillAllRegisters(resultGPR);
         
         done.link(&m_jit);

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp (96987 => 96988)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp	2011-10-07 23:29:50 UTC (rev 96987)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp	2011-10-07 23:38:03 UTC (rev 96988)
@@ -621,10 +621,7 @@
     JITCompiler::Jump fastCase = m_jit.branchTestPtr(JITCompiler::Zero, resultGPR, TrustedImm32(static_cast<int32_t>(~1)));
     
     silentSpillAllRegisters(resultGPR);
-    m_jit.move(arg1GPR, GPRInfo::argumentGPR1);
-    m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
-    appendCallWithExceptionCheck(dfgConvertJSValueToBoolean);
-    m_jit.move(GPRInfo::returnValueGPR, resultGPR);
+    callOperation(dfgConvertJSValueToBoolean, resultGPR, arg1GPR);
     silentFillAllRegisters(resultGPR);
     
     fastCase.link(&m_jit);
@@ -728,10 +725,7 @@
             value.use();
     
             silentSpillAllRegisters(resultGPR);
-            m_jit.move(valueGPR, GPRInfo::argumentGPR1);
-            m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
-            appendCallWithExceptionCheck(dfgConvertJSValueToBoolean);
-            m_jit.move(GPRInfo::returnValueGPR, resultGPR);
+            callOperation(dfgConvertJSValueToBoolean, resultGPR, valueGPR);
             silentFillAllRegisters(resultGPR);
     
             addBranch(m_jit.branchTest8(MacroAssembler::NonZero, resultGPR), taken);
@@ -1542,10 +1536,7 @@
         slowPath.link(&m_jit);
         
         silentSpillAllRegisters(storageLengthGPR);
-        setupStubArguments(baseGPR, valueGPR);
-        m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
-        appendCallWithExceptionCheck(operationArrayPush);
-        m_jit.move(GPRInfo::returnValueGPR, storageLengthGPR);
+        callOperation(operationArrayPush, storageLengthGPR, valueGPR, baseGPR);
         silentFillAllRegisters(storageLengthGPR);
         
         done.link(&m_jit);
@@ -1598,10 +1589,7 @@
         slowCase.link(&m_jit);
         
         silentSpillAllRegisters(valueGPR);
-        m_jit.move(baseGPR, GPRInfo::argumentGPR1);
-        m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
-        appendCallWithExceptionCheck(operationArrayPop);
-        m_jit.move(GPRInfo::returnValueGPR, valueGPR);
+        callOperation(operationArrayPop, valueGPR, baseGPR);
         silentFillAllRegisters(valueGPR);
         
         done.link(&m_jit);
@@ -1715,10 +1703,7 @@
             alreadyPrimitive.append(m_jit.branchPtr(MacroAssembler::Equal, MacroAssembler::Address(op1GPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsStringVPtr)));
             
             silentSpillAllRegisters(resultGPR);
-            m_jit.move(op1GPR, GPRInfo::argumentGPR1);
-            m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
-            appendCallWithExceptionCheck(operationToPrimitive);
-            m_jit.move(GPRInfo::returnValueGPR, resultGPR);
+            callOperation(operationToPrimitive, resultGPR, op1GPR);
             silentFillAllRegisters(resultGPR);
             
             MacroAssembler::Jump done = m_jit.jump();
@@ -1870,10 +1855,7 @@
         slowPath.link(&m_jit);
         
         silentSpillAllRegisters(resultGPR);
-        m_jit.move(protoGPR, GPRInfo::argumentGPR1);
-        m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
-        appendCallWithExceptionCheck(operationCreateThis);
-        m_jit.move(GPRInfo::returnValueGPR, resultGPR);
+        callOperation(operationCreateThis, resultGPR, protoGPR);
         silentFillAllRegisters(resultGPR);
         
         done.link(&m_jit);
@@ -1898,9 +1880,7 @@
         slowPath.link(&m_jit);
         
         silentSpillAllRegisters(resultGPR);
-        m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
-        appendCallWithExceptionCheck(operationNewObject);
-        m_jit.move(GPRInfo::returnValueGPR, resultGPR);
+        callOperation(operationNewObject, resultGPR);
         silentFillAllRegisters(resultGPR);
         
         done.link(&m_jit);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to