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

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

Issue 1265923002: Debugger: move implementation to a separate folder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 5 years, 4 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/ppc/builtins-ppc.cc ('k') | src/ppc/macro-assembler-ppc.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "src/v8.h"
6
7 #if V8_TARGET_ARCH_PPC
8
9 #include "src/codegen.h"
10 #include "src/debug.h"
11
12 namespace v8 {
13 namespace internal {
14
15 #define __ ACCESS_MASM(masm)
16
17
18 void EmitDebugBreakSlot(MacroAssembler* masm) {
19 Label check_size;
20 __ bind(&check_size);
21 for (int i = 0; i < Assembler::kDebugBreakSlotInstructions; i++) {
22 __ nop(MacroAssembler::DEBUG_BREAK_NOP);
23 }
24 DCHECK_EQ(Assembler::kDebugBreakSlotInstructions,
25 masm->InstructionsGeneratedSince(&check_size));
26 }
27
28
29 void DebugCodegen::GenerateSlot(MacroAssembler* masm, RelocInfo::Mode mode,
30 int call_argc) {
31 // Generate enough nop's to make space for a call instruction. Avoid emitting
32 // the trampoline pool in the debug break slot code.
33 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm);
34 masm->RecordDebugBreakSlot(mode, call_argc);
35 EmitDebugBreakSlot(masm);
36 }
37
38
39 void DebugCodegen::ClearDebugBreakSlot(Address pc) {
40 CodePatcher patcher(pc, Assembler::kDebugBreakSlotInstructions);
41 EmitDebugBreakSlot(patcher.masm());
42 }
43
44
45 void DebugCodegen::PatchDebugBreakSlot(Address pc, Handle<Code> code) {
46 DCHECK_EQ(Code::BUILTIN, code->kind());
47 CodePatcher patcher(pc, Assembler::kDebugBreakSlotInstructions);
48 // Patch the code changing the debug break slot code from
49 //
50 // ori r3, r3, 0
51 // ori r3, r3, 0
52 // ori r3, r3, 0
53 // ori r3, r3, 0
54 // ori r3, r3, 0
55 //
56 // to a call to the debug break code, using a FIXED_SEQUENCE.
57 //
58 // mov r0, <address>
59 // mtlr r0
60 // blrl
61 //
62 Assembler::BlockTrampolinePoolScope block_trampoline_pool(patcher.masm());
63 patcher.masm()->mov(v8::internal::r0,
64 Operand(reinterpret_cast<intptr_t>(code->entry())));
65 patcher.masm()->mtctr(v8::internal::r0);
66 patcher.masm()->bctrl();
67 }
68
69
70 void DebugCodegen::GenerateDebugBreakStub(MacroAssembler* masm,
71 DebugBreakCallHelperMode mode) {
72 __ RecordComment("Debug break");
73 {
74 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
75
76 // Load padding words on stack.
77 __ LoadSmiLiteral(ip, Smi::FromInt(LiveEdit::kFramePaddingValue));
78 for (int i = 0; i < LiveEdit::kFramePaddingInitialSize; i++) {
79 __ push(ip);
80 }
81 __ LoadSmiLiteral(ip, Smi::FromInt(LiveEdit::kFramePaddingInitialSize));
82 __ push(ip);
83
84 if (mode == SAVE_RESULT_REGISTER) __ push(r3);
85
86 __ mov(r3, Operand::Zero()); // no arguments
87 __ mov(r4,
88 Operand(ExternalReference(
89 Runtime::FunctionForId(Runtime::kDebugBreak), masm->isolate())));
90
91 CEntryStub ceb(masm->isolate(), 1);
92 __ CallStub(&ceb);
93
94 if (FLAG_debug_code) {
95 for (int i = 0; i < kNumJSCallerSaved; i++) {
96 Register reg = {JSCallerSavedCode(i)};
97 __ mov(reg, Operand(kDebugZapValue));
98 }
99 }
100
101 if (mode == SAVE_RESULT_REGISTER) __ pop(r3);
102
103 // Don't bother removing padding bytes pushed on the stack
104 // as the frame is going to be restored right away.
105
106 // Leave the internal frame.
107 }
108
109 // Now that the break point has been handled, resume normal execution by
110 // jumping to the target address intended by the caller and that was
111 // overwritten by the address of DebugBreakXXX.
112 ExternalReference after_break_target =
113 ExternalReference::debug_after_break_target_address(masm->isolate());
114 __ mov(ip, Operand(after_break_target));
115 __ LoadP(ip, MemOperand(ip));
116 __ JumpToJSEntry(ip);
117 }
118
119
120 void DebugCodegen::GeneratePlainReturnLiveEdit(MacroAssembler* masm) {
121 __ Ret();
122 }
123
124
125 void DebugCodegen::GenerateFrameDropperLiveEdit(MacroAssembler* masm) {
126 ExternalReference restarter_frame_function_slot =
127 ExternalReference::debug_restarter_frame_function_pointer_address(
128 masm->isolate());
129 __ mov(ip, Operand(restarter_frame_function_slot));
130 __ li(r4, Operand::Zero());
131 __ StoreP(r4, MemOperand(ip, 0));
132
133 // Load the function pointer off of our current stack frame.
134 __ LoadP(r4, MemOperand(fp, StandardFrameConstants::kConstantPoolOffset -
135 kPointerSize));
136
137 // Pop return address and frame
138 __ LeaveFrame(StackFrame::INTERNAL);
139
140 // Load context from the function.
141 __ LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset));
142
143 // Get function code.
144 __ LoadP(ip, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
145 __ LoadP(ip, FieldMemOperand(ip, SharedFunctionInfo::kCodeOffset));
146 __ addi(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag));
147
148 // Re-run JSFunction, r4 is function, cp is context.
149 __ Jump(ip);
150 }
151
152
153 const bool LiveEdit::kFrameDropperSupported = true;
154
155 #undef __
156 } // namespace internal
157 } // namespace v8
158
159 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/ppc/builtins-ppc.cc ('k') | src/ppc/macro-assembler-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698