2009-05-15  Gavin Barraclough  <barraclough@apple.com>

        Reviewed by Oliver Hunt.

        Add FP support to the MacroAssembler, port JITArithmetic over to make use of this. Also add
        API to determine whether FP support is available 'MacroAssembler::supportsFloatingPoint()',
        FP is presently only supported on SSE2 platforms, not x87.  On platforms where a suitable
        hardware FPU is not available 'supportsFloatingPoint()' may simply return false, and all
        other methods ASSERT_NOT_REACHED().

        * assembler/AbstractMacroAssembler.h:
        * assembler/MacroAssemblerX86.h:
        (JSC::MacroAssemblerX86::MacroAssemblerX86):
        (JSC::MacroAssemblerX86::branch32):
        (JSC::MacroAssemblerX86::branchPtrWithPatch):
        (JSC::MacroAssemblerX86::supportsFloatingPoint):
        * assembler/MacroAssemblerX86Common.h:
        (JSC::MacroAssemblerX86Common::):
        (JSC::MacroAssemblerX86Common::loadDouble):
        (JSC::MacroAssemblerX86Common::storeDouble):
        (JSC::MacroAssemblerX86Common::addDouble):
        (JSC::MacroAssemblerX86Common::subDouble):
        (JSC::MacroAssemblerX86Common::mulDouble):
        (JSC::MacroAssemblerX86Common::convertInt32ToDouble):
        (JSC::MacroAssemblerX86Common::branchDouble):
        (JSC::MacroAssemblerX86Common::branchTruncateDoubleToInt32):
        (JSC::MacroAssemblerX86Common::branch32):
        (JSC::MacroAssemblerX86Common::branch16):
        (JSC::MacroAssemblerX86Common::branchTest32):
        (JSC::MacroAssemblerX86Common::branchAdd32):
        (JSC::MacroAssemblerX86Common::branchMul32):
        (JSC::MacroAssemblerX86Common::branchSub32):
        (JSC::MacroAssemblerX86Common::set32):
        (JSC::MacroAssemblerX86Common::setTest32):
        (JSC::MacroAssemblerX86Common::x86Condition):
        (JSC::MacroAssemblerX86Common::isSSE2Present):
        * assembler/MacroAssemblerX86_64.h:
        (JSC::MacroAssemblerX86_64::movePtrToDouble):
        (JSC::MacroAssemblerX86_64::moveDoubleToPtr):
        (JSC::MacroAssemblerX86_64::setPtr):
        (JSC::MacroAssemblerX86_64::branchPtr):
        (JSC::MacroAssemblerX86_64::branchTestPtr):
        (JSC::MacroAssemblerX86_64::branchAddPtr):
        (JSC::MacroAssemblerX86_64::branchSubPtr):
        (JSC::MacroAssemblerX86_64::supportsFloatingPoint):
        * assembler/X86Assembler.h:
        * jit/JIT.cpp:
        (JSC::JIT::JIT):
        * jit/JIT.h:
        * jit/JITArithmetic.cpp:
        (JSC::JIT::emit_op_rshift):
        (JSC::JIT::emitSlow_op_rshift):
        (JSC::JIT::emitSlow_op_jnless):
        (JSC::JIT::emitSlow_op_jnlesseq):
        (JSC::JIT::compileBinaryArithOp):
        (JSC::JIT::compileBinaryArithOpSlowCase):
        (JSC::JIT::emit_op_add):
        (JSC::JIT::emitSlow_op_add):
        (JSC::JIT::emit_op_mul):
        (JSC::JIT::emitSlow_op_mul):
        * jit/JITPropertyAccess.cpp:
        (JSC::JIT::privateCompilePutByIdTransition):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@43781 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/assembler/MacroAssemblerX86.h b/JavaScriptCore/assembler/MacroAssemblerX86.h
index 094b53d..94f857b 100644
--- a/JavaScriptCore/assembler/MacroAssemblerX86.h
+++ b/JavaScriptCore/assembler/MacroAssemblerX86.h
@@ -36,6 +36,11 @@
 
 class MacroAssemblerX86 : public MacroAssemblerX86Common {
 public:
+    MacroAssemblerX86()
+        : m_isSSE2Present(isSSE2Present())
+    {
+    }
+
     static const Scale ScalePtr = TimesFour;
 
     using MacroAssemblerX86Common::add32;
@@ -95,13 +100,13 @@
     Jump branch32(Condition cond, AbsoluteAddress left, RegisterID right)
     {
         m_assembler.cmpl_rm(right, left.m_ptr);
-        return Jump(m_assembler.jCC(cond));
+        return Jump(m_assembler.jCC(x86Condition(cond)));
     }
 
     Jump branch32(Condition cond, AbsoluteAddress left, Imm32 right)
     {
         m_assembler.cmpl_im(right.m_value, left.m_ptr);
-        return Jump(m_assembler.jCC(cond));
+        return Jump(m_assembler.jCC(x86Condition(cond)));
     }
 
     Call call()
@@ -124,14 +129,14 @@
     {
         m_assembler.cmpl_ir_force32(initialRightValue.asIntptr(), left);
         dataLabel = DataLabelPtr(this);
-        return Jump(m_assembler.jCC(cond));
+        return Jump(m_assembler.jCC(x86Condition(cond)));
     }
 
     Jump branchPtrWithPatch(Condition cond, Address left, DataLabelPtr& dataLabel, ImmPtr initialRightValue = ImmPtr(0))
     {
         m_assembler.cmpl_im_force32(initialRightValue.asIntptr(), left.offset, left.base);
         dataLabel = DataLabelPtr(this);
-        return Jump(m_assembler.jCC(cond));
+        return Jump(m_assembler.jCC(x86Condition(cond)));
     }
 
     DataLabelPtr storePtrWithPatch(Address address)
@@ -139,6 +144,11 @@
         m_assembler.movl_i32m(0, address.offset, address.base);
         return DataLabelPtr(this);
     }
+
+    bool supportsFloatingPoint() const { return m_isSSE2Present; }
+
+private:
+    const bool m_isSSE2Present;
 };
 
 } // namespace JSC