diff --git a/js/src/gc/Nursery.h b/js/src/gc/Nursery.h index af14121c0dee..78476b30dfdf 100644 --- a/js/src/gc/Nursery.h +++ b/js/src/gc/Nursery.h @@ -54,6 +54,7 @@ class Nursery static const int NumNurseryChunks = 16; static const int LastNurseryChunk = NumNurseryChunks - 1; static const size_t Alignment = gc::ChunkSize; + static const size_t ChunkShift = gc::ChunkShift; static const size_t NurserySize = gc::ChunkSize * NumNurseryChunks; explicit Nursery(JSRuntime *rt) diff --git a/js/src/jit/arm/MacroAssembler-arm.cpp b/js/src/jit/arm/MacroAssembler-arm.cpp index 92196ec43703..c2affe2b5dbe 100644 --- a/js/src/jit/arm/MacroAssembler-arm.cpp +++ b/js/src/jit/arm/MacroAssembler-arm.cpp @@ -4352,12 +4352,14 @@ void MacroAssemblerARMCompat::branchPtrInNurseryRange(Register ptr, Register temp, Label *label) { JS_ASSERT(ptr != temp); - JS_ASSERT(ptr != ScratchRegister); + JS_ASSERT(ptr != secondScratchReg_); const Nursery &nursery = GetIonContext()->runtime->gcNursery(); - movePtr(ImmWord(-ptrdiff_t(nursery.start())), ScratchRegister); - addPtr(ptr, ScratchRegister); - branchPtr(Assembler::Below, ScratchRegister, Imm32(Nursery::NurserySize), label); + uintptr_t startChunk = nursery.start() >> Nursery::ChunkShift; + + ma_mov(Imm32(startChunk), secondScratchReg_); + as_rsb(secondScratchReg_, secondScratchReg_, lsr(ptr, Nursery::ChunkShift)); + branch32(Assembler::Below, secondScratchReg_, Imm32(Nursery::NumNurseryChunks), label); } void