diff --git a/js/src/nanojit/NativeARM.h b/js/src/nanojit/NativeARM.h index 168f85d1f1db..3ac7ceac0f1c 100644 --- a/js/src/nanojit/NativeARM.h +++ b/js/src/nanojit/NativeARM.h @@ -497,20 +497,14 @@ typedef enum { #define LDR_chk(_d,_b,_off,_chk) do { \ if (IsFpReg(_d)) { \ FLDD_chk(_d,_b,_off,_chk); \ - } else if ((_off)<0) { \ + } else if ((_off) > -4096 && (_off) < 4096) { \ if (_chk) underrunProtect(4); \ - NanoAssert((_off)>-4096); \ - *(--_nIns) = (NIns)( COND_AL | (0x51<<20) | ((_b)<<16) | ((_d)<<12) | ((-(_off))&0xFFF) ); \ + *(--_nIns) = (NIns)( COND_AL | (((_off) < 0 ? 0x51 : 0x59)<<20) | ((_b)<<16) | ((_d)<<12) | (((_off) < 0 ? -(_off) : (_off))&0xFFF) ); \ } else { \ - if (isS16(_off) || isU16(_off)) { \ - if (_chk) underrunProtect(4); \ - NanoAssert((_off)<4096); \ - *(--_nIns) = (NIns)( COND_AL | (0x59<<20) | ((_b)<<16) | ((_d)<<12) | ((_off)&0xFFF) ); \ - } else { \ - if (_chk) underrunProtect(4+LD32_size); \ - *(--_nIns) = (NIns)( COND_AL | (0x79<<20) | ((_b)<<16) | ((_d)<<12) | Scratch ); \ - LD32_nochk(Scratch, _off); \ - } \ + if (_chk) underrunProtect(4+LD32_size); \ + NanoAssert((_b) != IP); \ + *(--_nIns) = (NIns)( COND_AL | (0x79<<20) | ((_b)<<16) | ((_d)<<12) | Scratch ); \ + LD32_nochk(Scratch, _off); \ } \ asm_output("ldr %s, [%s, #%d]",gpn(_d),gpn(_b),(_off)); \ } while(0)