| 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 #if V8_TARGET_ARCH_ARM | 5 #if V8_TARGET_ARCH_ARM |
| 6 | 6 |
| 7 #include "src/debug/debug.h" | 7 #include "src/debug/debug.h" |
| 8 | 8 |
| 9 #include "src/assembler-inl.h" | 9 #include "src/assembler-inl.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| 11 #include "src/debug/liveedit.h" | 11 #include "src/debug/liveedit.h" |
| 12 #include "src/objects-inl.h" | 12 #include "src/objects-inl.h" |
| 13 | 13 |
| 14 namespace v8 { | 14 namespace v8 { |
| 15 namespace internal { | 15 namespace internal { |
| 16 | 16 |
| 17 #define __ ACCESS_MASM(masm) | 17 #define __ ACCESS_MASM(masm) |
| 18 | 18 |
| 19 | 19 namespace { |
| 20 void EmitDebugBreakSlot(MacroAssembler* masm) { | 20 void EmitDebugBreakSlot(Assembler* assembler) { |
| 21 Label check_size; | 21 Label check_size; |
| 22 __ bind(&check_size); | 22 assembler->bind(&check_size); |
| 23 for (int i = 0; i < Assembler::kDebugBreakSlotInstructions; i++) { | 23 for (int i = 0; i < Assembler::kDebugBreakSlotInstructions; i++) { |
| 24 __ nop(MacroAssembler::DEBUG_BREAK_NOP); | 24 assembler->nop(MacroAssembler::DEBUG_BREAK_NOP); |
| 25 } | 25 } |
| 26 DCHECK_EQ(Assembler::kDebugBreakSlotInstructions, | 26 DCHECK_EQ(Assembler::kDebugBreakSlotInstructions, |
| 27 masm->InstructionsGeneratedSince(&check_size)); | 27 assembler->InstructionsGeneratedSince(&check_size)); |
| 28 } | 28 } |
| 29 | 29 } // anonymous namespace |
| 30 | 30 |
| 31 void DebugCodegen::GenerateSlot(MacroAssembler* masm, RelocInfo::Mode mode) { | 31 void DebugCodegen::GenerateSlot(MacroAssembler* masm, RelocInfo::Mode mode) { |
| 32 // Generate enough nop's to make space for a call instruction. Avoid emitting | 32 // Generate enough nop's to make space for a call instruction. Avoid emitting |
| 33 // the constant pool in the debug break slot code. | 33 // the constant pool in the debug break slot code. |
| 34 Assembler::BlockConstPoolScope block_const_pool(masm); | 34 Assembler::BlockConstPoolScope block_const_pool(masm); |
| 35 masm->RecordDebugBreakSlot(mode); | 35 masm->RecordDebugBreakSlot(mode); |
| 36 EmitDebugBreakSlot(masm); | 36 EmitDebugBreakSlot(masm); |
| 37 } | 37 } |
| 38 | 38 |
| 39 | 39 |
| 40 void DebugCodegen::ClearDebugBreakSlot(Isolate* isolate, Address pc) { | 40 void DebugCodegen::ClearDebugBreakSlot(Isolate* isolate, Address pc) { |
| 41 CodePatcher patcher(isolate, pc, Assembler::kDebugBreakSlotInstructions); | 41 PatchingAssembler patcher(Assembler::IsolateData(isolate), pc, |
| 42 EmitDebugBreakSlot(patcher.masm()); | 42 Assembler::kDebugBreakSlotInstructions); |
| 43 EmitDebugBreakSlot(&patcher); |
| 44 patcher.FlushICache(isolate); |
| 43 } | 45 } |
| 44 | 46 |
| 45 | 47 |
| 46 void DebugCodegen::PatchDebugBreakSlot(Isolate* isolate, Address pc, | 48 void DebugCodegen::PatchDebugBreakSlot(Isolate* isolate, Address pc, |
| 47 Handle<Code> code) { | 49 Handle<Code> code) { |
| 48 DCHECK(code->is_debug_stub()); | 50 DCHECK(code->is_debug_stub()); |
| 49 CodePatcher patcher(isolate, pc, Assembler::kDebugBreakSlotInstructions); | 51 PatchingAssembler patcher(Assembler::IsolateData(isolate), pc, |
| 52 Assembler::kDebugBreakSlotInstructions); |
| 50 // Patch the code changing the debug break slot code from | 53 // Patch the code changing the debug break slot code from |
| 51 // mov r2, r2 | 54 // mov r2, r2 |
| 52 // mov r2, r2 | 55 // mov r2, r2 |
| 53 // mov r2, r2 | 56 // mov r2, r2 |
| 54 // mov r2, r2 | 57 // mov r2, r2 |
| 55 // to a call to the debug break slot code. | 58 // to a call to the debug break slot code. |
| 56 // ldr ip, [pc, #0] | 59 // ldr ip, [pc, #0] |
| 57 // b skip | 60 // b skip |
| 58 // <debug break slot code entry point address> | 61 // <debug break slot code entry point address> |
| 59 // skip: | 62 // skip: |
| 60 // blx ip | 63 // blx ip |
| 61 Label skip_constant; | 64 Label skip_constant; |
| 62 patcher.masm()->ldr(ip, MemOperand(v8::internal::pc, 0)); | 65 patcher.ldr(ip, MemOperand(v8::internal::pc, 0)); |
| 63 patcher.masm()->b(&skip_constant); | 66 patcher.b(&skip_constant); |
| 64 patcher.Emit(code->entry()); | 67 patcher.Emit(code->entry()); |
| 65 patcher.masm()->bind(&skip_constant); | 68 patcher.bind(&skip_constant); |
| 66 patcher.masm()->blx(ip); | 69 patcher.blx(ip); |
| 70 patcher.FlushICache(isolate); |
| 67 } | 71 } |
| 68 | 72 |
| 69 bool DebugCodegen::DebugBreakSlotIsPatched(Address pc) { | 73 bool DebugCodegen::DebugBreakSlotIsPatched(Address pc) { |
| 70 Instr current_instr = Assembler::instr_at(pc); | 74 Instr current_instr = Assembler::instr_at(pc); |
| 71 return !Assembler::IsNop(current_instr, Assembler::DEBUG_BREAK_NOP); | 75 return !Assembler::IsNop(current_instr, Assembler::DEBUG_BREAK_NOP); |
| 72 } | 76 } |
| 73 | 77 |
| 74 void DebugCodegen::GenerateDebugBreakStub(MacroAssembler* masm, | 78 void DebugCodegen::GenerateDebugBreakStub(MacroAssembler* masm, |
| 75 DebugBreakCallHelperMode mode) { | 79 DebugBreakCallHelperMode mode) { |
| 76 __ RecordComment("Debug break"); | 80 __ RecordComment("Debug break"); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 150 |
| 147 | 151 |
| 148 const bool LiveEdit::kFrameDropperSupported = true; | 152 const bool LiveEdit::kFrameDropperSupported = true; |
| 149 | 153 |
| 150 #undef __ | 154 #undef __ |
| 151 | 155 |
| 152 } // namespace internal | 156 } // namespace internal |
| 153 } // namespace v8 | 157 } // namespace v8 |
| 154 | 158 |
| 155 #endif // V8_TARGET_ARCH_ARM | 159 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |