 Chromium Code Reviews
 Chromium Code Reviews Issue 1818873003:
  [Interpreter] Adds support to fetch return value on break at return.  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master
    
  
    Issue 1818873003:
  [Interpreter] Adds support to fetch return value on break at return.  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master| OLD | NEW | 
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 | 
| 6 | 6 | 
| 7 #include "src/codegen.h" | 7 #include "src/codegen.h" | 
| 8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" | 
| 9 #include "src/ia32/frames-ia32.h" | 9 #include "src/ia32/frames-ia32.h" | 
| 10 | 10 | 
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 // Enter an internal frame. | 61 // Enter an internal frame. | 
| 62 { | 62 { | 
| 63 FrameScope scope(masm, StackFrame::INTERNAL); | 63 FrameScope scope(masm, StackFrame::INTERNAL); | 
| 64 | 64 | 
| 65 // Load padding words on stack. | 65 // Load padding words on stack. | 
| 66 for (int i = 0; i < LiveEdit::kFramePaddingInitialSize; i++) { | 66 for (int i = 0; i < LiveEdit::kFramePaddingInitialSize; i++) { | 
| 67 __ push(Immediate(Smi::FromInt(LiveEdit::kFramePaddingValue))); | 67 __ push(Immediate(Smi::FromInt(LiveEdit::kFramePaddingValue))); | 
| 68 } | 68 } | 
| 69 __ push(Immediate(Smi::FromInt(LiveEdit::kFramePaddingInitialSize))); | 69 __ push(Immediate(Smi::FromInt(LiveEdit::kFramePaddingInitialSize))); | 
| 70 | 70 | 
| 71 if (mode == SAVE_RESULT_REGISTER) __ push(eax); | 71 // Push arguments for DebugBreak call. | 
| 72 | 72 if (mode == SAVE_RESULT_REGISTER) { | 
| 73 __ Move(eax, Immediate(0)); // No arguments. | 73 // Break on return. | 
| 74 __ push(eax); | |
| 75 } else { | |
| 76 // Non-return breaks. | |
| 77 __ Push(masm->isolate()->factory()->the_hole_value()); | |
| 78 } | |
| 79 __ Move(eax, Immediate(1)); | |
| 74 __ mov(ebx, | 80 __ mov(ebx, | 
| 75 Immediate(ExternalReference( | 81 Immediate(ExternalReference( | 
| 76 Runtime::FunctionForId(Runtime::kDebugBreak), masm->isolate()))); | 82 Runtime::FunctionForId(Runtime::kDebugBreak), masm->isolate()))); | 
| 77 | 83 | 
| 78 CEntryStub ceb(masm->isolate(), 1); | 84 CEntryStub ceb(masm->isolate(), 1); | 
| 79 __ CallStub(&ceb); | 85 __ CallStub(&ceb); | 
| 80 | 86 | 
| 81 if (FLAG_debug_code) { | 87 if (FLAG_debug_code) { | 
| 82 for (int i = 0; i < kNumJSCallerSaved; ++i) { | 88 // Do not clobber eax if SAVE_RESULT_REGISTER is set. It will | 
| 89 // contain return value of the function. | |
| 90 for (int i = SAVE_RESULT_REGISTER ? 1 : 0; i < kNumJSCallerSaved; ++i) { | |
| 
rmcilroy
2016/03/22 11:32:34
This is relying on JSCallerSavedCode(0) being eax,
 
mythria
2016/03/22 12:08:09
Thanks, I did not realize we could check if a regi
 | |
| 83 Register reg = {JSCallerSavedCode(i)}; | 91 Register reg = {JSCallerSavedCode(i)}; | 
| 84 __ Move(reg, Immediate(kDebugZapValue)); | 92 __ Move(reg, Immediate(kDebugZapValue)); | 
| 85 } | 93 } | 
| 86 } | 94 } | 
| 87 | 95 | 
| 88 if (mode == SAVE_RESULT_REGISTER) __ pop(eax); | |
| 89 | |
| 90 __ pop(ebx); | 96 __ pop(ebx); | 
| 91 // We divide stored value by 2 (untagging) and multiply it by word's size. | 97 // We divide stored value by 2 (untagging) and multiply it by word's size. | 
| 92 STATIC_ASSERT(kSmiTagSize == 1 && kSmiShiftSize == 0); | 98 STATIC_ASSERT(kSmiTagSize == 1 && kSmiShiftSize == 0); | 
| 93 __ lea(esp, Operand(esp, ebx, times_half_pointer_size, 0)); | 99 __ lea(esp, Operand(esp, ebx, times_half_pointer_size, 0)); | 
| 94 | 100 | 
| 95 // Get rid of the internal frame. | 101 // Get rid of the internal frame. | 
| 96 } | 102 } | 
| 97 | 103 | 
| 98 // This call did not replace a call , so there will be an unwanted | 104 // This call did not replace a call , so there will be an unwanted | 
| 99 // return address left on the stack. Here we get rid of that. | 105 // return address left on the stack. Here we get rid of that. | 
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 | 144 | 
| 139 | 145 | 
| 140 const bool LiveEdit::kFrameDropperSupported = true; | 146 const bool LiveEdit::kFrameDropperSupported = true; | 
| 141 | 147 | 
| 142 #undef __ | 148 #undef __ | 
| 143 | 149 | 
| 144 } // namespace internal | 150 } // namespace internal | 
| 145 } // namespace v8 | 151 } // namespace v8 | 
| 146 | 152 | 
| 147 #endif // V8_TARGET_ARCH_IA32 | 153 #endif // V8_TARGET_ARCH_IA32 | 
| OLD | NEW |