Index: runtime/vm/stub_code_arm.cc |
diff --git a/runtime/vm/stub_code_arm.cc b/runtime/vm/stub_code_arm.cc |
index 3bcf173ba07b6f33928c539493773cb1e531c585..fa370caa6509ef49d5dbcf59243ae58e14bdbb3d 100644 |
--- a/runtime/vm/stub_code_arm.cc |
+++ b/runtime/vm/stub_code_arm.cc |
@@ -522,7 +522,7 @@ static void GenerateDeoptimizationSequence(Assembler* assembler, |
__ CallRuntime(kDeoptimizeMaterializeRuntimeEntry, 0); |
// Result tells stub how many bytes to remove from the expression stack |
// of the bottom-most frame. They were used as materialization arguments. |
- __ Pop(R1); |
+ __ Pop(R2); |
if (kind == kLazyDeoptFromReturn) { |
__ Pop(R0); // Restore result. |
} else if (kind == kLazyDeoptFromThrow) { |
@@ -531,34 +531,32 @@ static void GenerateDeoptimizationSequence(Assembler* assembler, |
} |
__ LeaveStubFrame(); |
// Remove materialization arguments. |
- __ add(SP, SP, Operand(R1, ASR, kSmiTagSize)); |
+ __ add(SP, SP, Operand(R2, ASR, kSmiTagSize)); |
__ Ret(); |
} |
-// LR: return address + call-instruction-size |
// R0: result, must be preserved |
void StubCode::GenerateDeoptimizeLazyFromReturnStub(Assembler* assembler) { |
- // Correct return address to point just after the call that is being |
- // deoptimized. |
- __ AddImmediate(LR, -CallPattern::DeoptCallPatternLengthInBytes()); |
// Push zap value instead of CODE_REG for lazy deopt. |
__ LoadImmediate(IP, 0xf1f1f1f1); |
__ Push(IP); |
+ // Return address for "call" to deopt stub. |
+ __ LoadImmediate(LR, 0xe1e1e1e1); |
+ __ ldr(CODE_REG, Address(THR, Thread::lazy_deopt_from_return_stub_offset())); |
GenerateDeoptimizationSequence(assembler, kLazyDeoptFromReturn); |
} |
-// LR: return address + call-instruction-size |
// R0: exception, must be preserved |
// R1: stacktrace, must be preserved |
void StubCode::GenerateDeoptimizeLazyFromThrowStub(Assembler* assembler) { |
- // Correct return address to point just after the call that is being |
- // deoptimized. |
- __ AddImmediate(LR, -CallPattern::DeoptCallPatternLengthInBytes()); |
// Push zap value instead of CODE_REG for lazy deopt. |
__ LoadImmediate(IP, 0xf1f1f1f1); |
__ Push(IP); |
+ // Return address for "call" to deopt stub. |
+ __ LoadImmediate(LR, 0xe1e1e1e1); |
+ __ ldr(CODE_REG, Address(THR, Thread::lazy_deopt_from_throw_stub_offset())); |
GenerateDeoptimizationSequence(assembler, kLazyDeoptFromThrow); |
} |