OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 bool BreakLocationIterator::IsDebugBreakAtReturn() { | 42 bool BreakLocationIterator::IsDebugBreakAtReturn() { |
43 return Debug::IsDebugBreakAtReturn(rinfo()); | 43 return Debug::IsDebugBreakAtReturn(rinfo()); |
44 } | 44 } |
45 | 45 |
46 | 46 |
47 // Patch the JS frame exit code with a debug break call. See | 47 // Patch the JS frame exit code with a debug break call. See |
48 // CodeGenerator::VisitReturnStatement and VirtualFrame::Exit in codegen-x64.cc | 48 // CodeGenerator::VisitReturnStatement and VirtualFrame::Exit in codegen-x64.cc |
49 // for the precise return instructions sequence. | 49 // for the precise return instructions sequence. |
50 void BreakLocationIterator::SetDebugBreakAtReturn() { | 50 void BreakLocationIterator::SetDebugBreakAtReturn() { |
51 ASSERT(Assembler::kJSReturnSequenceLength >= Assembler::kCallSequenceLength); | 51 ASSERT(Assembler::kJSReturnSequenceLength >= |
| 52 Assembler::kCallInstructionLength); |
52 rinfo()->PatchCodeWithCall( | 53 rinfo()->PatchCodeWithCall( |
53 Isolate::Current()->debug()->debug_break_return()->entry(), | 54 Isolate::Current()->debug()->debug_break_return()->entry(), |
54 Assembler::kJSReturnSequenceLength - Assembler::kCallSequenceLength); | 55 Assembler::kJSReturnSequenceLength - Assembler::kCallInstructionLength); |
55 } | 56 } |
56 | 57 |
57 | 58 |
58 // Restore the JS frame exit code. | 59 // Restore the JS frame exit code. |
59 void BreakLocationIterator::ClearDebugBreakAtReturn() { | 60 void BreakLocationIterator::ClearDebugBreakAtReturn() { |
60 rinfo()->PatchCode(original_rinfo()->pc(), | 61 rinfo()->PatchCode(original_rinfo()->pc(), |
61 Assembler::kJSReturnSequenceLength); | 62 Assembler::kJSReturnSequenceLength); |
62 } | 63 } |
63 | 64 |
64 | 65 |
65 // A debug break in the frame exit code is identified by the JS frame exit code | 66 // A debug break in the frame exit code is identified by the JS frame exit code |
66 // having been patched with a call instruction. | 67 // having been patched with a call instruction. |
67 bool Debug::IsDebugBreakAtReturn(v8::internal::RelocInfo* rinfo) { | 68 bool Debug::IsDebugBreakAtReturn(v8::internal::RelocInfo* rinfo) { |
68 ASSERT(RelocInfo::IsJSReturn(rinfo->rmode())); | 69 ASSERT(RelocInfo::IsJSReturn(rinfo->rmode())); |
69 return rinfo->IsPatchedReturnSequence(); | 70 return rinfo->IsPatchedReturnSequence(); |
70 } | 71 } |
71 | 72 |
72 | 73 |
73 bool BreakLocationIterator::IsDebugBreakAtSlot() { | 74 bool BreakLocationIterator::IsDebugBreakAtSlot() { |
74 ASSERT(IsDebugBreakSlot()); | 75 ASSERT(IsDebugBreakSlot()); |
75 // Check whether the debug break slot instructions have been patched. | 76 // Check whether the debug break slot instructions have been patched. |
76 return !Assembler::IsNop(rinfo()->pc()); | 77 return !Assembler::IsNop(rinfo()->pc()); |
77 } | 78 } |
78 | 79 |
79 | 80 |
80 void BreakLocationIterator::SetDebugBreakAtSlot() { | 81 void BreakLocationIterator::SetDebugBreakAtSlot() { |
81 ASSERT(IsDebugBreakSlot()); | 82 ASSERT(IsDebugBreakSlot()); |
82 rinfo()->PatchCodeWithCall( | 83 rinfo()->PatchCodeWithCall( |
83 Isolate::Current()->debug()->debug_break_slot()->entry(), | 84 Isolate::Current()->debug()->debug_break_slot()->entry(), |
84 Assembler::kDebugBreakSlotLength - Assembler::kCallSequenceLength); | 85 Assembler::kDebugBreakSlotLength - Assembler::kCallInstructionLength); |
85 } | 86 } |
86 | 87 |
87 | 88 |
88 void BreakLocationIterator::ClearDebugBreakAtSlot() { | 89 void BreakLocationIterator::ClearDebugBreakAtSlot() { |
89 ASSERT(IsDebugBreakSlot()); | 90 ASSERT(IsDebugBreakSlot()); |
90 rinfo()->PatchCode(original_rinfo()->pc(), Assembler::kDebugBreakSlotLength); | 91 rinfo()->PatchCode(original_rinfo()->pc(), Assembler::kDebugBreakSlotLength); |
91 } | 92 } |
92 | 93 |
93 const bool Debug::FramePaddingLayout::kIsSupported = true; | 94 const bool Debug::FramePaddingLayout::kIsSupported = true; |
94 | 95 |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 | 354 |
354 const bool Debug::kFrameDropperSupported = true; | 355 const bool Debug::kFrameDropperSupported = true; |
355 | 356 |
356 #undef __ | 357 #undef __ |
357 | 358 |
358 #endif // ENABLE_DEBUGGER_SUPPORT | 359 #endif // ENABLE_DEBUGGER_SUPPORT |
359 | 360 |
360 } } // namespace v8::internal | 361 } } // namespace v8::internal |
361 | 362 |
362 #endif // V8_TARGET_ARCH_X64 | 363 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |