2010-04-29  Oliver Hunt  <oliver@apple.com>

        Reviewed by Gavin Barraclough.

        Add codegen support for unsigned right shift
        https://bugs.webkit.org/show_bug.cgi?id=38375

        Expose unsigned right shift in the macro assembler, and make use of it
        from the jit.  Currently if the result is outside the range 0..2^31-1
        we simply fall back to the slow case, even in JSVALUE64 and JSVALUE32_64
        where technically we could still return an immediate value.

        * assembler/MacroAssemblerARM.h:
        (JSC::MacroAssemblerARM::urshift32):
        * assembler/MacroAssemblerARMv7.h:
        (JSC::MacroAssemblerARMv7::urshift32):
        * assembler/MacroAssemblerX86Common.h:
        (JSC::MacroAssemblerX86Common::urshift32):
        * assembler/X86Assembler.h:
        (JSC::X86Assembler::):
        (JSC::X86Assembler::shrl_i8r):
        (JSC::X86Assembler::shrl_CLr):
           Add unsigned right shift to the x86 assembler
        * jit/JIT.cpp:
        (JSC::JIT::privateCompileMainPass):
        (JSC::JIT::privateCompileSlowCases):
           op_rshift no longer simply get thrown to a stub function
        * jit/JIT.h:
        * jit/JITArithmetic.cpp:
        (JSC::JIT::emit_op_urshift):
        (JSC::JIT::emitSlow_op_urshift):
          JSVALUE32 and JSVALUE64 implementation.  Only supports
          double lhs in JSVALUE64.
        * jit/JITArithmetic32_64.cpp:
        (JSC::JIT::emit_op_rshift):
        (JSC::JIT::emitSlow_op_rshift):
        (JSC::JIT::emit_op_urshift):
        (JSC::JIT::emitSlow_op_urshift):
          Refactor right shift code to have shared implementation between signed
          and unsigned versions.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@58562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/jit/JIT.h b/JavaScriptCore/jit/JIT.h
index 22e7aba..dbd311b 100644
--- a/JavaScriptCore/jit/JIT.h
+++ b/JavaScriptCore/jit/JIT.h
@@ -734,6 +734,7 @@
         void emit_op_to_jsnumber(Instruction*);
         void emit_op_to_primitive(Instruction*);
         void emit_op_unexpected_load(Instruction*);
+        void emit_op_urshift(Instruction*);
 #if ENABLE(JIT_OPTIMIZE_MOD)
         void softModulo();
 #endif
@@ -784,6 +785,11 @@
         void emitSlow_op_sub(Instruction*, Vector<SlowCaseEntry>::iterator&);
         void emitSlow_op_to_jsnumber(Instruction*, Vector<SlowCaseEntry>::iterator&);
         void emitSlow_op_to_primitive(Instruction*, Vector<SlowCaseEntry>::iterator&);
+        void emitSlow_op_urshift(Instruction*, Vector<SlowCaseEntry>::iterator&);
+
+        
+        void emitRightShift(Instruction*, bool isUnsigned);
+        void emitRightShiftSlowCase(Instruction*, Vector<SlowCaseEntry>::iterator&, bool isUnsigned);
 
         /* These functions are deprecated: Please use JITStubCall instead. */
         void emitPutJITStubArg(RegisterID src, unsigned argumentNumber);