2008-11-13  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Cameron Zwarich.
        
        - remove immediate checks from native codegen for known non-immediate cases like "this"
        
        ~.5% speedup on v8 benchmarks
        
        In the future we can extend this model to remove all sorts of
        typechecks based on local type info or type inference.
        
        I also added an assertion to verify that all slow cases linked as
        many slow case jumps as the corresponding fast case generated, and
        fixed the pre-existing cases where this was not true.
        
        * VM/CTI.cpp:
        (JSC::CTI::emitJumpSlowCaseIfNotJSCell):
        (JSC::CTI::linkSlowCaseIfNotJSCell):
        (JSC::CTI::compileBinaryArithOp):
        (JSC::CTI::compileBinaryArithOpSlowCase):
        (JSC::CTI::privateCompileMainPass):
        (JSC::CTI::privateCompileSlowCases):
        * VM/CTI.h:
        * VM/CodeBlock.h:
        (JSC::CodeBlock::isKnownNotImmediate):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@38369 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/VM/CTI.h b/JavaScriptCore/VM/CTI.h
index 909262c..3d65d9c 100644
--- a/JavaScriptCore/VM/CTI.h
+++ b/JavaScriptCore/VM/CTI.h
@@ -269,12 +269,12 @@
         static const int ctiArgumentInitSize = 0;
 #endif
         // These architecture specific value are used to enable repatching - see comment on op_put_by_id.
-        static const int repatchOffsetPutByIdStructureID = 19;
-        static const int repatchOffsetPutByIdPropertyMapOffset = 34;
+        static const int repatchOffsetPutByIdStructureID = 7;
+        static const int repatchOffsetPutByIdPropertyMapOffset = 22;
         // These architecture specific value are used to enable repatching - see comment on op_get_by_id.
-        static const int repatchOffsetGetByIdStructureID = 19;
-        static const int repatchOffsetGetByIdBranchToSlowCase = 25;
-        static const int repatchOffsetGetByIdPropertyMapOffset = 34;
+        static const int repatchOffsetGetByIdStructureID = 7;
+        static const int repatchOffsetGetByIdBranchToSlowCase = 13;
+        static const int repatchOffsetGetByIdPropertyMapOffset = 22;
 #if ENABLE(OPCODE_SAMPLING)
         static const int repatchOffsetGetByIdSlowCaseCall = 27 + 4 + ctiArgumentInitSize;
 #else
@@ -392,8 +392,9 @@
         JSValue* getConstantImmediateNumericArg(unsigned src);
         unsigned getDeTaggedConstantImmediate(JSValue* imm);
 
-        void emitJumpSlowCaseIfIsJSCell(X86Assembler::RegisterID reg, unsigned opcodeIndex);
-        void emitJumpSlowCaseIfNotJSCell(X86Assembler::RegisterID reg, unsigned opcodeIndex);
+        bool linkSlowCaseIfNotJSCell(const Vector<SlowCaseEntry>::iterator&, int vReg);
+        void emitJumpSlowCaseIfNotJSCell(X86Assembler::RegisterID, unsigned opcodeIndex);
+        void emitJumpSlowCaseIfNotJSCell(X86Assembler::RegisterID, unsigned opcodeIndex, int VReg);
 
         void emitJumpSlowCaseIfNotImmNum(X86Assembler::RegisterID, unsigned opcodeIndex);
         void emitJumpSlowCaseIfNotImmNums(X86Assembler::RegisterID, X86Assembler::RegisterID, unsigned opcodeIndex);