Index: src/debug/x87/debug-x87.cc |
diff --git a/src/debug/x87/debug-x87.cc b/src/debug/x87/debug-x87.cc |
index 28b635b3266ac7ed8c48aaba6a94a9b678f4489e..029a00415f6912751af72320cd5a8b0e98753134 100644 |
--- a/src/debug/x87/debug-x87.cc |
+++ b/src/debug/x87/debug-x87.cc |
@@ -68,9 +68,15 @@ void DebugCodegen::GenerateDebugBreakStub(MacroAssembler* masm, |
} |
__ push(Immediate(Smi::FromInt(LiveEdit::kFramePaddingInitialSize))); |
- if (mode == SAVE_RESULT_REGISTER) __ push(eax); |
- |
- __ Move(eax, Immediate(0)); // No arguments. |
+ // Push arguments for DebugBreak call. |
+ if (mode == SAVE_RESULT_REGISTER) { |
+ // Break on return. |
+ __ push(eax); |
+ } else { |
+ // Non-return breaks. |
+ __ Push(masm->isolate()->factory()->the_hole_value()); |
+ } |
+ __ Move(eax, Immediate(1)); |
__ mov(ebx, |
Immediate(ExternalReference( |
Runtime::FunctionForId(Runtime::kDebugBreak), masm->isolate()))); |
@@ -81,12 +87,14 @@ void DebugCodegen::GenerateDebugBreakStub(MacroAssembler* masm, |
if (FLAG_debug_code) { |
for (int i = 0; i < kNumJSCallerSaved; ++i) { |
Register reg = {JSCallerSavedCode(i)}; |
- __ Move(reg, Immediate(kDebugZapValue)); |
+ // Do not clobber eax if mode is SAVE_RESULT_REGISTER. It will |
+ // contain return value of the function. |
+ if (!(reg.is(eax) && (mode == SAVE_RESULT_REGISTER))) { |
+ __ Move(reg, Immediate(kDebugZapValue)); |
+ } |
} |
} |
- if (mode == SAVE_RESULT_REGISTER) __ pop(eax); |
- |
__ pop(ebx); |
// We divide stored value by 2 (untagging) and multiply it by word's size. |
STATIC_ASSERT(kSmiTagSize == 1 && kSmiShiftSize == 0); |