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 "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
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 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 // Patch the code at the current PC with a call to the target address. | 16 // Patch the code at the current PC with a call to the target address. |
17 // Additional guard int3 instructions can be added if required. | 17 // Additional guard int3 instructions can be added if required. |
18 void RelocInfo::PatchCodeWithCall(Address pc, Address target, int guard_bytes) { | 18 void PatchCodeWithCall(Address pc, Address target, int guard_bytes) { |
19 // Call instruction takes up 5 bytes and int3 takes up one byte. | 19 // Call instruction takes up 5 bytes and int3 takes up one byte. |
20 static const int kCallCodeSize = 5; | 20 static const int kCallCodeSize = 5; |
21 int code_size = kCallCodeSize + guard_bytes; | 21 int code_size = kCallCodeSize + guard_bytes; |
22 | 22 |
23 // Create a code patcher. | 23 // Create a code patcher. |
24 CodePatcher patcher(pc, code_size); | 24 CodePatcher patcher(pc, code_size); |
25 | 25 |
26 // Add a label for checking the size of the code used for returning. | 26 // Add a label for checking the size of the code used for returning. |
27 #ifdef DEBUG | 27 #ifdef DEBUG |
28 Label check_codesize; | 28 Label check_codesize; |
(...skipping 22 matching lines...) Expand all Loading... |
51 // for the precise return instructions sequence. | 51 // for the precise return instructions sequence. |
52 void BreakLocation::SetDebugBreakAtReturn() { | 52 void BreakLocation::SetDebugBreakAtReturn() { |
53 DCHECK(Assembler::kJSReturnSequenceLength >= | 53 DCHECK(Assembler::kJSReturnSequenceLength >= |
54 Assembler::kCallInstructionLength); | 54 Assembler::kCallInstructionLength); |
55 PatchCodeWithCall( | 55 PatchCodeWithCall( |
56 pc(), debug_info_->GetIsolate()->builtins()->Return_DebugBreak()->entry(), | 56 pc(), debug_info_->GetIsolate()->builtins()->Return_DebugBreak()->entry(), |
57 Assembler::kJSReturnSequenceLength - Assembler::kCallInstructionLength); | 57 Assembler::kJSReturnSequenceLength - Assembler::kCallInstructionLength); |
58 } | 58 } |
59 | 59 |
60 | 60 |
61 void BreakLocationIterator::SetDebugBreakAtSlot() { | 61 void BreakLocation::SetDebugBreakAtSlot() { |
62 DCHECK(IsDebugBreakSlot()); | 62 DCHECK(IsDebugBreakSlot()); |
63 Isolate* isolate = debug_info_->GetIsolate(); | 63 Isolate* isolate = debug_info_->GetIsolate(); |
64 rinfo().PatchCodeWithCall( | 64 PatchCodeWithCall( |
65 pc(), isolate->builtins()->Slot_DebugBreak()->entry(), | 65 pc(), isolate->builtins()->Slot_DebugBreak()->entry(), |
66 Assembler::kDebugBreakSlotLength - Assembler::kCallInstructionLength); | 66 Assembler::kDebugBreakSlotLength - Assembler::kCallInstructionLength); |
67 } | 67 } |
68 | 68 |
69 | 69 |
70 #define __ ACCESS_MASM(masm) | 70 #define __ ACCESS_MASM(masm) |
71 | 71 |
72 static void Generate_DebugBreakCallHelper(MacroAssembler* masm, | 72 static void Generate_DebugBreakCallHelper(MacroAssembler* masm, |
73 RegList object_regs, | 73 RegList object_regs, |
74 RegList non_object_regs, | 74 RegList non_object_regs, |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 } | 321 } |
322 | 322 |
323 | 323 |
324 const bool LiveEdit::kFrameDropperSupported = true; | 324 const bool LiveEdit::kFrameDropperSupported = true; |
325 | 325 |
326 #undef __ | 326 #undef __ |
327 | 327 |
328 } } // namespace v8::internal | 328 } } // namespace v8::internal |
329 | 329 |
330 #endif // V8_TARGET_ARCH_X87 | 330 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |