Index: src/debug/arm64/debug-arm64.cc |
diff --git a/src/debug/arm64/debug-arm64.cc b/src/debug/arm64/debug-arm64.cc |
index a2a6b733804d015add7121b5bd0160e888f5144f..f12dd29ec1fa366b7c9b4e887bb42014d7abe405 100644 |
--- a/src/debug/arm64/debug-arm64.cc |
+++ b/src/debug/arm64/debug-arm64.cc |
@@ -92,9 +92,15 @@ void DebugCodegen::GenerateDebugBreakStub(MacroAssembler* masm, |
__ Mov(scratch, Smi::FromInt(LiveEdit::kFramePaddingInitialSize)); |
__ Push(scratch); |
- if (mode == SAVE_RESULT_REGISTER) __ Push(x0); |
- |
- __ Mov(x0, 0); // No arguments. |
+ // Push arguments for DebugBreak call. |
+ if (mode == SAVE_RESULT_REGISTER) { |
+ // Break on return. |
+ __ Push(x0); |
+ } else { |
+ // Non-return breaks. |
+ __ Push(masm->isolate()->factory()->the_hole_value()); |
+ } |
+ __ Mov(x0, 1); |
__ Mov(x1, ExternalReference(Runtime::FunctionForId(Runtime::kDebugBreak), |
masm->isolate())); |
@@ -104,13 +110,14 @@ void DebugCodegen::GenerateDebugBreakStub(MacroAssembler* masm, |
if (FLAG_debug_code) { |
for (int i = 0; i < kNumJSCallerSaved; i++) { |
Register reg = Register::XRegFromCode(JSCallerSavedCode(i)); |
- __ Mov(reg, Operand(kDebugZapValue)); |
+ // Do not clobber x0 if SAVE_RESULT_REGISTER is set. It will |
+ // contain return value of the function. |
+ if (!(reg.is(x0) && SAVE_RESULT_REGISTER)) { |
+ __ Mov(reg, Operand(kDebugZapValue)); |
+ } |
} |
} |
- // Restore the register values from the expression stack. |
- if (mode == SAVE_RESULT_REGISTER) __ Pop(x0); |
- |
// Don't bother removing padding bytes pushed on the stack |
// as the frame is going to be restored right away. |