| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 return Debug::IsDebugBreakAtReturn(rinfo()); | 42 return Debug::IsDebugBreakAtReturn(rinfo()); |
| 43 } | 43 } |
| 44 | 44 |
| 45 | 45 |
| 46 // Patch the JS frame exit code with a debug break call. See | 46 // Patch the JS frame exit code with a debug break call. See |
| 47 // CodeGenerator::VisitReturnStatement and VirtualFrame::Exit in codegen-ia32.cc | 47 // CodeGenerator::VisitReturnStatement and VirtualFrame::Exit in codegen-ia32.cc |
| 48 // for the precise return instructions sequence. | 48 // for the precise return instructions sequence. |
| 49 void BreakLocationIterator::SetDebugBreakAtReturn() { | 49 void BreakLocationIterator::SetDebugBreakAtReturn() { |
| 50 ASSERT(Assembler::kJSReturnSequenceLength >= | 50 ASSERT(Assembler::kJSReturnSequenceLength >= |
| 51 Assembler::kCallInstructionLength); | 51 Assembler::kCallInstructionLength); |
| 52 rinfo()->PatchCodeWithCall(Debug::debug_break_return()->entry(), | 52 Isolate* isolate = Isolate::Current(); |
| 53 rinfo()->PatchCodeWithCall(isolate->debug()->debug_break_return()->entry(), |
| 53 Assembler::kJSReturnSequenceLength - Assembler::kCallInstructionLength); | 54 Assembler::kJSReturnSequenceLength - Assembler::kCallInstructionLength); |
| 54 } | 55 } |
| 55 | 56 |
| 56 | 57 |
| 57 // Restore the JS frame exit code. | 58 // Restore the JS frame exit code. |
| 58 void BreakLocationIterator::ClearDebugBreakAtReturn() { | 59 void BreakLocationIterator::ClearDebugBreakAtReturn() { |
| 59 rinfo()->PatchCode(original_rinfo()->pc(), | 60 rinfo()->PatchCode(original_rinfo()->pc(), |
| 60 Assembler::kJSReturnSequenceLength); | 61 Assembler::kJSReturnSequenceLength); |
| 61 } | 62 } |
| 62 | 63 |
| 63 | 64 |
| 64 // A debug break in the frame exit code is identified by the JS frame exit code | 65 // A debug break in the frame exit code is identified by the JS frame exit code |
| 65 // having been patched with a call instruction. | 66 // having been patched with a call instruction. |
| 66 bool Debug::IsDebugBreakAtReturn(RelocInfo* rinfo) { | 67 bool Debug::IsDebugBreakAtReturn(RelocInfo* rinfo) { |
| 67 ASSERT(RelocInfo::IsJSReturn(rinfo->rmode())); | 68 ASSERT(RelocInfo::IsJSReturn(rinfo->rmode())); |
| 68 return rinfo->IsPatchedReturnSequence(); | 69 return rinfo->IsPatchedReturnSequence(); |
| 69 } | 70 } |
| 70 | 71 |
| 71 | 72 |
| 72 bool BreakLocationIterator::IsDebugBreakAtSlot() { | 73 bool BreakLocationIterator::IsDebugBreakAtSlot() { |
| 73 ASSERT(IsDebugBreakSlot()); | 74 ASSERT(IsDebugBreakSlot()); |
| 74 // Check whether the debug break slot instructions have been patched. | 75 // Check whether the debug break slot instructions have been patched. |
| 75 return rinfo()->IsPatchedDebugBreakSlotSequence(); | 76 return rinfo()->IsPatchedDebugBreakSlotSequence(); |
| 76 } | 77 } |
| 77 | 78 |
| 78 | 79 |
| 79 void BreakLocationIterator::SetDebugBreakAtSlot() { | 80 void BreakLocationIterator::SetDebugBreakAtSlot() { |
| 80 ASSERT(IsDebugBreakSlot()); | 81 ASSERT(IsDebugBreakSlot()); |
| 82 Isolate* isolate = Isolate::Current(); |
| 81 rinfo()->PatchCodeWithCall( | 83 rinfo()->PatchCodeWithCall( |
| 82 Debug::debug_break_slot()->entry(), | 84 isolate->debug()->debug_break_slot()->entry(), |
| 83 Assembler::kDebugBreakSlotLength - Assembler::kCallInstructionLength); | 85 Assembler::kDebugBreakSlotLength - Assembler::kCallInstructionLength); |
| 84 } | 86 } |
| 85 | 87 |
| 86 | 88 |
| 87 void BreakLocationIterator::ClearDebugBreakAtSlot() { | 89 void BreakLocationIterator::ClearDebugBreakAtSlot() { |
| 88 ASSERT(IsDebugBreakSlot()); | 90 ASSERT(IsDebugBreakSlot()); |
| 89 rinfo()->PatchCode(original_rinfo()->pc(), Assembler::kDebugBreakSlotLength); | 91 rinfo()->PatchCode(original_rinfo()->pc(), Assembler::kDebugBreakSlotLength); |
| 90 } | 92 } |
| 91 | 93 |
| 92 | 94 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 | 302 |
| 301 const bool Debug::kFrameDropperSupported = true; | 303 const bool Debug::kFrameDropperSupported = true; |
| 302 | 304 |
| 303 #undef __ | 305 #undef __ |
| 304 | 306 |
| 305 #endif // ENABLE_DEBUGGER_SUPPORT | 307 #endif // ENABLE_DEBUGGER_SUPPORT |
| 306 | 308 |
| 307 } } // namespace v8::internal | 309 } } // namespace v8::internal |
| 308 | 310 |
| 309 #endif // V8_TARGET_ARCH_IA32 | 311 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |