Implement callOperation(D_DFGOperation_DD) for DFG JIT 32_64
authorbarraclough@apple.com <barraclough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Sep 2011 20:59:24 +0000 (20:59 +0000)
committerbarraclough@apple.com <barraclough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Sep 2011 20:59:24 +0000 (20:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=69026

Reviewed by Sam Weinig.

* assembler/X86Assembler.h:
(JSC::X86Assembler::fstpl):
* dfg/DFGJITCodeGenerator.h:
(JSC::DFG::callOperation):

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

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/assembler/X86Assembler.h
Source/JavaScriptCore/dfg/DFGJITCodeGenerator.h

index 091534f..a8a8141 100644 (file)
@@ -1,5 +1,17 @@
 2011-09-28  Gavin Barraclough  <barraclough@apple.com>
 
+        Implement callOperation(D_DFGOperation_DD) for DFG JIT 32_64
+        https://bugs.webkit.org/show_bug.cgi?id=69026
+
+        Reviewed by Sam Weinig.
+
+        * assembler/X86Assembler.h:
+        (JSC::X86Assembler::fstpl):
+        * dfg/DFGJITCodeGenerator.h:
+        (JSC::DFG::callOperation):
+
+2011-09-28  Gavin Barraclough  <barraclough@apple.com>
+
         Merge bug#68580, bug#68932 for DFG JIT with JSVALUE32_64
         https://bugs.webkit.org/show_bug.cgi?id=69017
 
index b1ac369..add8fda 100644 (file)
@@ -150,6 +150,7 @@ private:
         OP_INT3                         = 0xCC,
         OP_GROUP2_Ev1                   = 0xD1,
         OP_GROUP2_EvCL                  = 0xD3,
+        OP_ESCAPE_DD                    = 0xDD,
         OP_CALL_rel32                   = 0xE8,
         OP_JMP_rel32                    = 0xE9,
         PRE_SSE_F2                      = 0xF2,
@@ -218,6 +219,8 @@ private:
         GROUP5_OP_PUSH  = 6,
 
         GROUP11_MOV = 0,
+
+        ESCAPE_DD_FSTP_doubleReal = 3,
     } GroupOpcodeID;
     
     class X86InstructionFormatter;
@@ -984,6 +987,11 @@ public:
         m_formatter.oneByteOp(OP_CDQ);
     }
 
+    void fstpl(int offset, RegisterID base)
+    {
+        m_formatter.oneByteOp(OP_ESCAPE_DD, ESCAPE_DD_FSTP_doubleReal, base, offset);
+    }
+
     void xchgl_rr(RegisterID src, RegisterID dst)
     {
         m_formatter.oneByteOp(OP_XCHG_EvGv, src, dst);
index 3380e55..0047613 100644 (file)
@@ -1307,17 +1307,16 @@ protected:
         appendCallWithExceptionCheck(operation);
     }
 
-    void NO_RETURN callOperation(D_DFGOperation_DD operation, FPRReg result, FPRReg arg1, FPRReg arg2)
+    void callOperation(D_DFGOperation_DD operation, FPRReg result, FPRReg arg1, FPRReg arg2)
     {
         ASSERT(isFlushed());
 
-        // FIXME: Need to to pass doubles.
-        ASSERT_NOT_REACHED();
-        UNUSED_PARAM(arg1);
-        UNUSED_PARAM(arg2);
+        m_jit.storeDouble(arg2, JITCompiler::Address(JITCompiler::stackPointerRegister, sizeof(double)));
+        m_jit.storeDouble(arg1, JITCompiler::stackPointerRegister);
 
         m_jit.appendCall(operation);
-        m_jit.moveDouble(FPRInfo::returnValueFPR, result);
+        m_jit.assembler().fstpl(0, JITCompiler::stackPointerRegister);
+        m_jit.loadDouble(JITCompiler::stackPointerRegister, result);
     }
 #endif