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 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "assembler.h" | 9 #include "assembler.h" |
10 #include "codegen.h" | 10 #include "codegen.h" |
11 #include "debug.h" | 11 #include "debug.h" |
12 | 12 |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 | 16 |
17 bool BreakLocationIterator::IsDebugBreakAtReturn() { | 17 bool BreakLocationIterator::IsDebugBreakAtReturn() { |
18 return Debug::IsDebugBreakAtReturn(rinfo()); | 18 return Debug::IsDebugBreakAtReturn(rinfo()); |
19 } | 19 } |
20 | 20 |
21 | 21 |
22 // Patch the JS frame exit code with a debug break call. See | 22 // Patch the JS frame exit code with a debug break call. See |
23 // CodeGenerator::VisitReturnStatement and VirtualFrame::Exit in codegen-x64.cc | 23 // CodeGenerator::VisitReturnStatement and VirtualFrame::Exit in codegen-x64.cc |
24 // for the precise return instructions sequence. | 24 // for the precise return instructions sequence. |
25 void BreakLocationIterator::SetDebugBreakAtReturn() { | 25 void BreakLocationIterator::SetDebugBreakAtReturn() { |
26 ASSERT(Assembler::kJSReturnSequenceLength >= Assembler::kCallSequenceLength); | 26 ASSERT(Assembler::kJSReturnSequenceLength >= Assembler::kCallSequenceLength); |
27 rinfo()->PatchCodeWithCall( | 27 rinfo()->PatchCodeWithCall( |
28 debug_info_->GetIsolate()->debug()->debug_break_return()->entry(), | 28 debug_info_->GetIsolate()->builtins()->Return_DebugBreak()->entry(), |
29 Assembler::kJSReturnSequenceLength - Assembler::kCallSequenceLength); | 29 Assembler::kJSReturnSequenceLength - Assembler::kCallSequenceLength); |
30 } | 30 } |
31 | 31 |
32 | 32 |
33 // Restore the JS frame exit code. | 33 // Restore the JS frame exit code. |
34 void BreakLocationIterator::ClearDebugBreakAtReturn() { | 34 void BreakLocationIterator::ClearDebugBreakAtReturn() { |
35 rinfo()->PatchCode(original_rinfo()->pc(), | 35 rinfo()->PatchCode(original_rinfo()->pc(), |
36 Assembler::kJSReturnSequenceLength); | 36 Assembler::kJSReturnSequenceLength); |
37 } | 37 } |
38 | 38 |
39 | 39 |
40 // A debug break in the frame exit code is identified by the JS frame exit code | 40 // A debug break in the frame exit code is identified by the JS frame exit code |
41 // having been patched with a call instruction. | 41 // having been patched with a call instruction. |
42 bool Debug::IsDebugBreakAtReturn(v8::internal::RelocInfo* rinfo) { | 42 bool Debug::IsDebugBreakAtReturn(v8::internal::RelocInfo* rinfo) { |
43 ASSERT(RelocInfo::IsJSReturn(rinfo->rmode())); | 43 ASSERT(RelocInfo::IsJSReturn(rinfo->rmode())); |
44 return rinfo->IsPatchedReturnSequence(); | 44 return rinfo->IsPatchedReturnSequence(); |
45 } | 45 } |
46 | 46 |
47 | 47 |
48 bool BreakLocationIterator::IsDebugBreakAtSlot() { | 48 bool BreakLocationIterator::IsDebugBreakAtSlot() { |
49 ASSERT(IsDebugBreakSlot()); | 49 ASSERT(IsDebugBreakSlot()); |
50 // Check whether the debug break slot instructions have been patched. | 50 // Check whether the debug break slot instructions have been patched. |
51 return !Assembler::IsNop(rinfo()->pc()); | 51 return !Assembler::IsNop(rinfo()->pc()); |
52 } | 52 } |
53 | 53 |
54 | 54 |
55 void BreakLocationIterator::SetDebugBreakAtSlot() { | 55 void BreakLocationIterator::SetDebugBreakAtSlot() { |
56 ASSERT(IsDebugBreakSlot()); | 56 ASSERT(IsDebugBreakSlot()); |
57 rinfo()->PatchCodeWithCall( | 57 rinfo()->PatchCodeWithCall( |
58 debug_info_->GetIsolate()->debug()->debug_break_slot()->entry(), | 58 debug_info_->GetIsolate()->builtins()->Slot_DebugBreak()->entry(), |
59 Assembler::kDebugBreakSlotLength - Assembler::kCallSequenceLength); | 59 Assembler::kDebugBreakSlotLength - Assembler::kCallSequenceLength); |
60 } | 60 } |
61 | 61 |
62 | 62 |
63 void BreakLocationIterator::ClearDebugBreakAtSlot() { | 63 void BreakLocationIterator::ClearDebugBreakAtSlot() { |
64 ASSERT(IsDebugBreakSlot()); | 64 ASSERT(IsDebugBreakSlot()); |
65 rinfo()->PatchCode(original_rinfo()->pc(), Assembler::kDebugBreakSlotLength); | 65 rinfo()->PatchCode(original_rinfo()->pc(), Assembler::kDebugBreakSlotLength); |
66 } | 66 } |
67 | 67 |
68 const bool Debug::FramePaddingLayout::kIsSupported = true; | 68 const bool Debug::FramePaddingLayout::kIsSupported = true; |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 __ jmp(rdx); | 308 __ jmp(rdx); |
309 } | 309 } |
310 | 310 |
311 const bool Debug::kFrameDropperSupported = true; | 311 const bool Debug::kFrameDropperSupported = true; |
312 | 312 |
313 #undef __ | 313 #undef __ |
314 | 314 |
315 } } // namespace v8::internal | 315 } } // namespace v8::internal |
316 | 316 |
317 #endif // V8_TARGET_ARCH_X64 | 317 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |