Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: src/debug/arm/debug-arm.cc

Issue 2636913002: [liveedit] reimplement frame restarting. (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/verifier.cc ('k') | src/debug/arm64/debug-arm64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_ARM 5 #if V8_TARGET_ARCH_ARM
6 6
7 #include "src/debug/debug.h" 7 #include "src/debug/debug.h"
8 8
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/debug/liveedit.h" 10 #include "src/debug/liveedit.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 Instr current_instr = Assembler::instr_at(pc); 68 Instr current_instr = Assembler::instr_at(pc);
69 return !Assembler::IsNop(current_instr, Assembler::DEBUG_BREAK_NOP); 69 return !Assembler::IsNop(current_instr, Assembler::DEBUG_BREAK_NOP);
70 } 70 }
71 71
72 void DebugCodegen::GenerateDebugBreakStub(MacroAssembler* masm, 72 void DebugCodegen::GenerateDebugBreakStub(MacroAssembler* masm,
73 DebugBreakCallHelperMode mode) { 73 DebugBreakCallHelperMode mode) {
74 __ RecordComment("Debug break"); 74 __ RecordComment("Debug break");
75 { 75 {
76 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 76 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
77 77
78 // Load padding words on stack.
79 __ mov(ip, Operand(Smi::FromInt(LiveEdit::kFramePaddingValue)));
80 for (int i = 0; i < LiveEdit::kFramePaddingInitialSize; i++) {
81 __ push(ip);
82 }
83 __ mov(ip, Operand(Smi::FromInt(LiveEdit::kFramePaddingInitialSize)));
84 __ push(ip);
85
86 // Push arguments for DebugBreak call. 78 // Push arguments for DebugBreak call.
87 if (mode == SAVE_RESULT_REGISTER) { 79 if (mode == SAVE_RESULT_REGISTER) {
88 // Break on return. 80 // Break on return.
89 __ push(r0); 81 __ push(r0);
90 } else { 82 } else {
91 // Non-return breaks. 83 // Non-return breaks.
92 __ Push(masm->isolate()->factory()->the_hole_value()); 84 __ Push(masm->isolate()->factory()->the_hole_value());
93 } 85 }
94 __ mov(r0, Operand(1)); 86 __ mov(r0, Operand(1));
95 __ mov(r1, 87 __ mov(r1,
96 Operand(ExternalReference( 88 Operand(ExternalReference(
97 Runtime::FunctionForId(Runtime::kDebugBreak), masm->isolate()))); 89 Runtime::FunctionForId(Runtime::kDebugBreak), masm->isolate())));
98 90
99 CEntryStub ceb(masm->isolate(), 1); 91 CEntryStub ceb(masm->isolate(), 1);
100 __ CallStub(&ceb); 92 __ CallStub(&ceb);
101 93
102 if (FLAG_debug_code) { 94 if (FLAG_debug_code) {
103 for (int i = 0; i < kNumJSCallerSaved; i++) { 95 for (int i = 0; i < kNumJSCallerSaved; i++) {
104 Register reg = {JSCallerSavedCode(i)}; 96 Register reg = {JSCallerSavedCode(i)};
105 // Do not clobber r0 if mode is SAVE_RESULT_REGISTER. It will 97 // Do not clobber r0 if mode is SAVE_RESULT_REGISTER. It will
106 // contain return value of the function. 98 // contain return value of the function.
107 if (!(reg.is(r0) && (mode == SAVE_RESULT_REGISTER))) { 99 if (!(reg.is(r0) && (mode == SAVE_RESULT_REGISTER))) {
108 __ mov(reg, Operand(kDebugZapValue)); 100 __ mov(reg, Operand(kDebugZapValue));
109 } 101 }
110 } 102 }
111 } 103 }
112
113 // Don't bother removing padding bytes pushed on the stack
114 // as the frame is going to be restored right away.
115
116 // Leave the internal frame. 104 // Leave the internal frame.
117 } 105 }
118 106
119 // Now that the break point has been handled, resume normal execution by 107 __ MaybeDropFrames();
120 // jumping to the target address intended by the caller and that was 108
121 // overwritten by the address of DebugBreakXXX. 109 // Return to caller.
122 ExternalReference after_break_target = 110 __ Ret();
123 ExternalReference::debug_after_break_target_address(masm->isolate()); 111 }
124 __ mov(ip, Operand(after_break_target)); 112
125 __ ldr(ip, MemOperand(ip)); 113 void DebugCodegen::GenerateHandleDebuggerStatement(MacroAssembler* masm) {
126 __ Jump(ip); 114 {
115 FrameScope scope(masm, StackFrame::INTERNAL);
116 __ CallRuntime(Runtime::kHandleDebuggerStatement, 0);
117 }
118 __ MaybeDropFrames();
119
120 // Return to caller.
121 __ Ret();
122 }
123
124 void DebugCodegen::GenerateFrameDropperTrampoline(MacroAssembler* masm) {
125 // Frame is being dropped:
126 // - Drop to the target frame specified by r1.
127 // - Look up current function on the frame.
128 // - Leave the frame.
129 // - Restart the frame by calling the function.
130 __ mov(fp, r1);
131 __ ldr(r1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
132 __ LeaveFrame(StackFrame::INTERNAL);
133
134 __ ldr(r0, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
135 __ ldr(r0,
136 FieldMemOperand(r0, SharedFunctionInfo::kFormalParameterCountOffset));
137 __ mov(r2, r0);
138
139 ParameterCount dummy1(r2);
140 ParameterCount dummy2(r0);
141 __ InvokeFunction(r1, dummy1, dummy2, JUMP_FUNCTION,
142 CheckDebugStepCallWrapper());
127 } 143 }
128 144
129 145
130 void DebugCodegen::GenerateFrameDropperLiveEdit(MacroAssembler* masm) {
131 // Load the function pointer off of our current stack frame.
132 __ ldr(r1, MemOperand(fp, FrameDropperFrameConstants::kFunctionOffset));
133
134 // Pop return address, frame and constant pool pointer (if
135 // FLAG_enable_embedded_constant_pool).
136 __ LeaveFrame(StackFrame::INTERNAL);
137
138 ParameterCount dummy(0);
139 __ CheckDebugHook(r1, no_reg, dummy, dummy);
140
141 { ConstantPoolUnavailableScope constant_pool_unavailable(masm);
142 // Load context from the function.
143 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
144
145 // Clear new.target as a safety measure.
146 __ LoadRoot(r3, Heap::kUndefinedValueRootIndex);
147
148 // Get function code.
149 __ ldr(ip, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
150 __ ldr(ip, FieldMemOperand(ip, SharedFunctionInfo::kCodeOffset));
151 __ add(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag));
152
153 // Re-run JSFunction, r1 is function, cp is context.
154 __ Jump(ip);
155 }
156 }
157
158
159 const bool LiveEdit::kFrameDropperSupported = true; 146 const bool LiveEdit::kFrameDropperSupported = true;
160 147
161 #undef __ 148 #undef __
162 149
163 } // namespace internal 150 } // namespace internal
164 } // namespace v8 151 } // namespace v8
165 152
166 #endif // V8_TARGET_ARCH_ARM 153 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/compiler/verifier.cc ('k') | src/debug/arm64/debug-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698