Index: src/mips/macro-assembler-mips.cc |
diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc |
index 5c0b901c1f5f3740ceddacadd75147f4b8ce5a61..c3abe4fa6fe2f5405d00441331d075aedf770077 100644 |
--- a/src/mips/macro-assembler-mips.cc |
+++ b/src/mips/macro-assembler-mips.cc |
@@ -6560,13 +6560,14 @@ void MacroAssembler::TestJSArrayForAllocationMemento(Register receiver_reg, |
ExternalReference new_space_allocation_top_adr = |
ExternalReference::new_space_allocation_top_address(isolate()); |
const int kMementoMapOffset = JSArray::kSize - kHeapObjectTag; |
- const int kMementoEndOffset = kMementoMapOffset + AllocationMemento::kSize; |
+ const int kMementoLastWordOffset = |
+ kMementoMapOffset + AllocationMemento::kSize - kPointerSize; |
// Bail out if the object is not in new space. |
JumpIfNotInNewSpace(receiver_reg, scratch_reg, no_memento_found); |
// If the object is in new space, we need to check whether it is on the same |
// page as the current top. |
- Addu(scratch_reg, receiver_reg, Operand(kMementoEndOffset)); |
+ Addu(scratch_reg, receiver_reg, Operand(kMementoLastWordOffset)); |
li(at, Operand(new_space_allocation_top_adr)); |
lw(at, MemOperand(at)); |
Xor(scratch_reg, scratch_reg, Operand(at)); |
@@ -6575,7 +6576,7 @@ void MacroAssembler::TestJSArrayForAllocationMemento(Register receiver_reg, |
// The object is on a different page than allocation top. Bail out if the |
// object sits on the page boundary as no memento can follow and we cannot |
// touch the memory following it. |
- Addu(scratch_reg, receiver_reg, Operand(kMementoEndOffset)); |
+ Addu(scratch_reg, receiver_reg, Operand(kMementoLastWordOffset)); |
Xor(scratch_reg, scratch_reg, Operand(receiver_reg)); |
And(scratch_reg, scratch_reg, Operand(~Page::kPageAlignmentMask)); |
Branch(no_memento_found, ne, scratch_reg, Operand(zero_reg)); |
@@ -6584,10 +6585,10 @@ void MacroAssembler::TestJSArrayForAllocationMemento(Register receiver_reg, |
// If top is on the same page as the current object, we need to check whether |
// we are below top. |
bind(&top_check); |
- Addu(scratch_reg, receiver_reg, Operand(kMementoEndOffset)); |
+ Addu(scratch_reg, receiver_reg, Operand(kMementoLastWordOffset)); |
li(at, Operand(new_space_allocation_top_adr)); |
lw(at, MemOperand(at)); |
- Branch(no_memento_found, gt, scratch_reg, Operand(at)); |
+ Branch(no_memento_found, ge, scratch_reg, Operand(at)); |
// Memento map check. |
bind(&map_check); |
lw(scratch_reg, MemOperand(receiver_reg, kMementoMapOffset)); |