Bug 925733 - don't use JS_BITS_PER_WORD_LOG2 for jit caches; r=jandem

This commit is contained in:
Nathan Froyd 2013-10-11 12:08:58 -04:00
parent a328587475
commit a518715bc1
2 changed files with 12 additions and 2 deletions

View File

@ -6,8 +6,11 @@
#include "jit/BaselineIC.h" #include "jit/BaselineIC.h"
#include "mozilla/TemplateLib.h"
#include "jsautooplen.h" #include "jsautooplen.h"
#include "jslibmath.h" #include "jslibmath.h"
#include "jstypes.h"
#include "builtin/Eval.h" #include "builtin/Eval.h"
#include "jit/BaselineHelpers.h" #include "jit/BaselineHelpers.h"
@ -4495,7 +4498,9 @@ ICGetElem_Arguments::Compiler::generateStubCode(MacroAssembler &masm)
// In tempReg, calculate index of word containing bit: (idx >> logBitsPerWord) // In tempReg, calculate index of word containing bit: (idx >> logBitsPerWord)
masm.movePtr(idxReg, tempReg); masm.movePtr(idxReg, tempReg);
masm.rshiftPtr(Imm32(JS_BITS_PER_WORD_LOG2), tempReg); const uint32_t shift = mozilla::tl::FloorLog2<(sizeof(size_t) * JS_BITS_PER_BYTE)>::value;
JS_ASSERT(shift == 5 || shift == 6);
masm.rshiftPtr(Imm32(shift), tempReg);
masm.loadPtr(BaseIndex(scratchReg, tempReg, ScaleFromElemWidth(sizeof(size_t))), scratchReg); masm.loadPtr(BaseIndex(scratchReg, tempReg, ScaleFromElemWidth(sizeof(size_t))), scratchReg);
// Don't bother testing specific bit, if any bit is set in the word, fail. // Don't bother testing specific bit, if any bit is set in the word, fail.

View File

@ -7,8 +7,10 @@
#include "jit/IonCaches.h" #include "jit/IonCaches.h"
#include "mozilla/DebugOnly.h" #include "mozilla/DebugOnly.h"
#include "mozilla/TemplateLib.h"
#include "jsproxy.h" #include "jsproxy.h"
#include "jstypes.h"
#include "builtin/TypeRepresentation.h" #include "builtin/TypeRepresentation.h"
#include "jit/Ion.h" #include "jit/Ion.h"
@ -30,6 +32,7 @@ using namespace js;
using namespace js::jit; using namespace js::jit;
using mozilla::DebugOnly; using mozilla::DebugOnly;
using mozilla::tl::FloorLog2;
void void
CodeLocationJump::repoint(IonCode *code, MacroAssembler *masm) CodeLocationJump::repoint(IonCode *code, MacroAssembler *masm)
@ -3276,7 +3279,9 @@ GetElementIC::attachArgumentsElement(JSContext *cx, IonScript *ion, JSObject *ob
masm.loadPtr(Address(tmpReg, offsetof(ArgumentsData, deletedBits)), tmpReg); masm.loadPtr(Address(tmpReg, offsetof(ArgumentsData, deletedBits)), tmpReg);
// In tempReg, calculate index of word containing bit: (idx >> logBitsPerWord) // In tempReg, calculate index of word containing bit: (idx >> logBitsPerWord)
masm.rshiftPtr(Imm32(JS_BITS_PER_WORD_LOG2), indexReg); const uint32_t shift = FloorLog2<(sizeof(size_t) * JS_BITS_PER_BYTE)>::value;
JS_ASSERT(shift == 5 || shift == 6);
masm.rshiftPtr(Imm32(shift), indexReg);
masm.loadPtr(BaseIndex(tmpReg, indexReg, ScaleFromElemWidth(sizeof(size_t))), tmpReg); masm.loadPtr(BaseIndex(tmpReg, indexReg, ScaleFromElemWidth(sizeof(size_t))), tmpReg);
// Don't bother testing specific bit, if any bit is set in the word, fail. // Don't bother testing specific bit, if any bit is set in the word, fail.