Ignore:
Timestamp:
Nov 6, 2009, 1:35:03 AM (16 years ago)
Author:
[email protected]
Message:

Tidy up the shift methods on the macro-assembler interface.

Patch by Gavin Barraclough <[email protected]> on 2009-11-06
Reviewed by Oliver Hunt.

Currently behaviour of shifts of a magnitude > 0x1f is undefined.
Instead defined that all shifts are masked to this range. This makes a lot of
practical sense, both since having undefined behaviour is not particularly
desirable, and because this behaviour is commonly required (particularly since
it is required bt ECMA-262 for shifts).

Update the ARM assemblers to provide this behaviour. Remove (now) redundant
masks from JITArithmetic, and remove rshiftPtr (this was used in case that
could be rewritten in a simpler form using rshift32, only optimized JSVALUE32
on x86-64, which uses JSVALUE64!)

  • assembler/MacroAssembler.h:
  • assembler/MacroAssemblerARM.h:

(JSC::MacroAssemblerARM::lshift32):
(JSC::MacroAssemblerARM::rshift32):

  • assembler/MacroAssemblerARMv7.h:

(JSC::MacroAssemblerARMv7::lshift32):
(JSC::MacroAssemblerARMv7::rshift32):

  • assembler/MacroAssemblerX86_64.h:
  • jit/JITArithmetic.cpp:

(JSC::JIT::emit_op_lshift):
(JSC::JIT::emit_op_rshift):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/jit/JITArithmetic.cpp

    r50531 r50595  
    11441144    emitFastArithImmToInt(regT0);
    11451145    emitFastArithImmToInt(regT2);
    1146 #if !PLATFORM(X86)
    1147     // Mask with 0x1f as per ecma-262 11.7.2 step 7.
    1148     // On 32-bit x86 this is not necessary, since the shift anount is implicitly masked in the instruction.
    1149     and32(Imm32(0x1f), regT2);
    1150 #endif
    11511146    lshift32(regT2, regT0);
    1152 #if !USE(JSVALUE64)
     1147#if USE(JSVALUE32)
    11531148    addSlowCase(branchAdd32(Overflow, regT0, regT0));
    11541149    signExtend32ToPtr(regT0, regT0);
     
    12261221        }
    12271222        emitFastArithImmToInt(regT2);
    1228 #if !PLATFORM(X86)
    1229         // Mask with 0x1f as per ecma-262 11.7.2 step 7.
    1230         // On 32-bit x86 this is not necessary, since the shift anount is implicitly masked in the instruction.
    1231         and32(Imm32(0x1f), regT2);
    1232 #endif
    1233 #if USE(JSVALUE64)
    12341223        rshift32(regT2, regT0);
    1235 #else
    1236         rshiftPtr(regT2, regT0);
     1224#if USE(JSVALUE32)
     1225        signExtend32ToPtr(regT0, regT0);
    12371226#endif
    12381227    }
Note: See TracChangeset for help on using the changeset viewer.