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

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

Issue 967323002: Refactor BreakLocationIterator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: static_cast instead Created 5 years, 9 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/arm/assembler-arm.cc ('k') | src/arm64/assembler-arm64.h » ('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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_ARM 7 #if V8_TARGET_ARCH_ARM
8 8
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/debug.h" 10 #include "src/debug.h"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 14
15 bool BreakLocationIterator::IsDebugBreakAtReturn() { 15 void BreakLocation::SetDebugBreakAtReturn() {
16 return Debug::IsDebugBreakAtReturn(rinfo());
17 }
18
19
20 void BreakLocationIterator::SetDebugBreakAtReturn() {
21 // Patch the code changing the return from JS function sequence from 16 // Patch the code changing the return from JS function sequence from
22 // mov sp, fp 17 // mov sp, fp
23 // ldmia sp!, {fp, lr} 18 // ldmia sp!, {fp, lr}
24 // add sp, sp, #4 19 // add sp, sp, #4
25 // bx lr 20 // bx lr
26 // to a call to the debug break return code. 21 // to a call to the debug break return code.
27 // ldr ip, [pc, #0] 22 // ldr ip, [pc, #0]
28 // blx ip 23 // blx ip
29 // <debug break return code entry point address> 24 // <debug break return code entry point address>
30 // bkpt 0 25 // bkpt 0
31 CodePatcher patcher(rinfo()->pc(), Assembler::kJSReturnSequenceInstructions); 26 CodePatcher patcher(pc(), Assembler::kJSReturnSequenceInstructions);
32 patcher.masm()->ldr(v8::internal::ip, MemOperand(v8::internal::pc, 0)); 27 patcher.masm()->ldr(v8::internal::ip, MemOperand(v8::internal::pc, 0));
33 patcher.masm()->blx(v8::internal::ip); 28 patcher.masm()->blx(v8::internal::ip);
34 patcher.Emit( 29 patcher.Emit(
35 debug_info_->GetIsolate()->builtins()->Return_DebugBreak()->entry()); 30 debug_info_->GetIsolate()->builtins()->Return_DebugBreak()->entry());
36 patcher.masm()->bkpt(0); 31 patcher.masm()->bkpt(0);
37 } 32 }
38 33
39 34
40 // Restore the JS frame exit code. 35 void BreakLocation::SetDebugBreakAtSlot() {
41 void BreakLocationIterator::ClearDebugBreakAtReturn() {
42 rinfo()->PatchCode(original_rinfo()->pc(),
43 Assembler::kJSReturnSequenceInstructions);
44 }
45
46
47 // A debug break in the frame exit code is identified by the JS frame exit code
48 // having been patched with a call instruction.
49 bool Debug::IsDebugBreakAtReturn(RelocInfo* rinfo) {
50 DCHECK(RelocInfo::IsJSReturn(rinfo->rmode()));
51 return rinfo->IsPatchedReturnSequence();
52 }
53
54
55 bool BreakLocationIterator::IsDebugBreakAtSlot() {
56 DCHECK(IsDebugBreakSlot());
57 // Check whether the debug break slot instructions have been patched.
58 return rinfo()->IsPatchedDebugBreakSlotSequence();
59 }
60
61
62 void BreakLocationIterator::SetDebugBreakAtSlot() {
63 DCHECK(IsDebugBreakSlot()); 36 DCHECK(IsDebugBreakSlot());
64 // Patch the code changing the debug break slot code from 37 // Patch the code changing the debug break slot code from
65 // mov r2, r2 38 // mov r2, r2
66 // mov r2, r2 39 // mov r2, r2
67 // mov r2, r2 40 // mov r2, r2
68 // to a call to the debug break slot code. 41 // to a call to the debug break slot code.
69 // ldr ip, [pc, #0] 42 // ldr ip, [pc, #0]
70 // blx ip 43 // blx ip
71 // <debug break slot code entry point address> 44 // <debug break slot code entry point address>
72 CodePatcher patcher(rinfo()->pc(), Assembler::kDebugBreakSlotInstructions); 45 CodePatcher patcher(pc(), Assembler::kDebugBreakSlotInstructions);
73 patcher.masm()->ldr(v8::internal::ip, MemOperand(v8::internal::pc, 0)); 46 patcher.masm()->ldr(v8::internal::ip, MemOperand(v8::internal::pc, 0));
74 patcher.masm()->blx(v8::internal::ip); 47 patcher.masm()->blx(v8::internal::ip);
75 patcher.Emit( 48 patcher.Emit(
76 debug_info_->GetIsolate()->builtins()->Slot_DebugBreak()->entry()); 49 debug_info_->GetIsolate()->builtins()->Slot_DebugBreak()->entry());
77 } 50 }
78 51
79 52
80 void BreakLocationIterator::ClearDebugBreakAtSlot() {
81 DCHECK(IsDebugBreakSlot());
82 rinfo()->PatchCode(original_rinfo()->pc(),
83 Assembler::kDebugBreakSlotInstructions);
84 }
85
86
87 #define __ ACCESS_MASM(masm) 53 #define __ ACCESS_MASM(masm)
88 54
89 55
90 static void Generate_DebugBreakCallHelper(MacroAssembler* masm, 56 static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
91 RegList object_regs, 57 RegList object_regs,
92 RegList non_object_regs) { 58 RegList non_object_regs) {
93 { 59 {
94 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 60 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
95 61
96 // Load padding words on stack. 62 // Load padding words on stack.
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 } 285 }
320 286
321 287
322 const bool LiveEdit::kFrameDropperSupported = true; 288 const bool LiveEdit::kFrameDropperSupported = true;
323 289
324 #undef __ 290 #undef __
325 291
326 } } // namespace v8::internal 292 } } // namespace v8::internal
327 293
328 #endif // V8_TARGET_ARCH_ARM 294 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/assembler-arm.cc ('k') | src/arm64/assembler-arm64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698