Index: src/full-codegen/mips64/full-codegen-mips64.cc |
diff --git a/src/full-codegen/mips64/full-codegen-mips64.cc b/src/full-codegen/mips64/full-codegen-mips64.cc |
index a37586440af0f588195d2c061c91a64324cadbbc..7276e98deaddd78c674e3a0f58cd8279e467b36b 100644 |
--- a/src/full-codegen/mips64/full-codegen-mips64.cc |
+++ b/src/full-codegen/mips64/full-codegen-mips64.cc |
@@ -4062,7 +4062,9 @@ void BackEdgeTable::PatchAt(Code* unoptimized_code, |
BackEdgeState target_state, |
Code* replacement_code) { |
static const int kInstrSize = Assembler::kInstrSize; |
- Address branch_address = pc - 8 * kInstrSize; |
+ Address pc_immediate_load_address = |
+ Assembler::target_address_from_return_address(pc); |
+ Address branch_address = pc_immediate_load_address - 2 * kInstrSize; |
Isolate* isolate = unoptimized_code->GetIsolate(); |
CodePatcher patcher(isolate, branch_address, 1); |
@@ -4092,7 +4094,6 @@ void BackEdgeTable::PatchAt(Code* unoptimized_code, |
patcher.masm()->daddiu(at, zero_reg, 1); |
break; |
} |
- Address pc_immediate_load_address = pc - 6 * kInstrSize; |
// Replace the stack check address in the load-immediate (6-instr sequence) |
// with the entry address of the replacement code. |
Assembler::set_target_address_at(isolate, pc_immediate_load_address, |
@@ -4108,12 +4109,11 @@ BackEdgeTable::BackEdgeState BackEdgeTable::GetBackEdgeState( |
Code* unoptimized_code, |
Address pc) { |
static const int kInstrSize = Assembler::kInstrSize; |
- Address branch_address = pc - 8 * kInstrSize; |
-#ifdef DEBUG |
- Address pc_immediate_load_address = pc - 6 * kInstrSize; |
-#endif |
+ Address pc_immediate_load_address = |
+ Assembler::target_address_from_return_address(pc); |
+ Address branch_address = pc_immediate_load_address - 2 * kInstrSize; |
- DCHECK(Assembler::IsBeq(Assembler::instr_at(pc - 7 * kInstrSize))); |
+ DCHECK(Assembler::IsBeq(Assembler::instr_at(branch_address + kInstrSize))); |
if (!Assembler::IsAddImmediate(Assembler::instr_at(branch_address))) { |
DCHECK(reinterpret_cast<uint64_t>( |
Assembler::target_address_at(pc_immediate_load_address)) == |