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
Родитель d6862f8195
Коммит 10b501297f
2 изменённых файлов: 12 добавлений и 2 удалений

Просмотреть файл

@ -6,8 +6,11 @@
#include "jit/BaselineIC.h"
#include "mozilla/TemplateLib.h"
#include "jsautooplen.h"
#include "jslibmath.h"
#include "jstypes.h"
#include "builtin/Eval.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)
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);
// Don't bother testing specific bit, if any bit is set in the word, fail.

Просмотреть файл

@ -7,8 +7,10 @@
#include "jit/IonCaches.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/TemplateLib.h"
#include "jsproxy.h"
#include "jstypes.h"
#include "builtin/TypeRepresentation.h"
#include "jit/Ion.h"
@ -30,6 +32,7 @@ using namespace js;
using namespace js::jit;
using mozilla::DebugOnly;
using mozilla::tl::FloorLog2;
void
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);
// 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);
// Don't bother testing specific bit, if any bit is set in the word, fail.