OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
7 | 7 |
8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
10 #include "vm/debugger.h" | 10 #include "vm/debugger.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 } | 45 } |
46 | 46 |
47 | 47 |
48 void CodeBreakpoint::PatchCode() { | 48 void CodeBreakpoint::PatchCode() { |
49 ASSERT(!is_enabled_); | 49 ASSERT(!is_enabled_); |
50 const Code& code = Code::Handle(code_); | 50 const Code& code = Code::Handle(code_); |
51 const Instructions& instrs = Instructions::Handle(code.instructions()); | 51 const Instructions& instrs = Instructions::Handle(code.instructions()); |
52 { | 52 { |
53 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); | 53 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); |
54 switch (breakpoint_kind_) { | 54 switch (breakpoint_kind_) { |
55 case PcDescriptors::kIcCall: | 55 case RawPcDescriptors::kIcCall: |
56 case PcDescriptors::kUnoptStaticCall: | 56 case RawPcDescriptors::kUnoptStaticCall: |
57 case PcDescriptors::kRuntimeCall: | 57 case RawPcDescriptors::kRuntimeCall: |
58 case PcDescriptors::kClosureCall: { | 58 case RawPcDescriptors::kClosureCall: { |
59 int32_t offset = CodePatcher::GetPoolOffsetAt(pc_); | 59 int32_t offset = CodePatcher::GetPoolOffsetAt(pc_); |
60 ASSERT((offset > 0) && ((offset & 0x7) == 0)); | 60 ASSERT((offset > 0) && ((offset & 0x7) == 0)); |
61 saved_value_ = static_cast<uword>(offset); | 61 saved_value_ = static_cast<uword>(offset); |
62 const uint32_t stub_offset = | 62 const uint32_t stub_offset = |
63 InstructionPattern::OffsetFromPPIndex( | 63 InstructionPattern::OffsetFromPPIndex( |
64 Assembler::kBreakpointRuntimeCPIndex); | 64 Assembler::kBreakpointRuntimeCPIndex); |
65 CodePatcher::SetPoolOffsetAt(pc_, stub_offset); | 65 CodePatcher::SetPoolOffsetAt(pc_, stub_offset); |
66 break; | 66 break; |
67 } | 67 } |
68 default: | 68 default: |
69 UNREACHABLE(); | 69 UNREACHABLE(); |
70 } | 70 } |
71 } | 71 } |
72 is_enabled_ = true; | 72 is_enabled_ = true; |
73 } | 73 } |
74 | 74 |
75 | 75 |
76 void CodeBreakpoint::RestoreCode() { | 76 void CodeBreakpoint::RestoreCode() { |
77 ASSERT(is_enabled_); | 77 ASSERT(is_enabled_); |
78 const Code& code = Code::Handle(code_); | 78 const Code& code = Code::Handle(code_); |
79 const Instructions& instrs = Instructions::Handle(code.instructions()); | 79 const Instructions& instrs = Instructions::Handle(code.instructions()); |
80 { | 80 { |
81 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); | 81 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); |
82 switch (breakpoint_kind_) { | 82 switch (breakpoint_kind_) { |
83 case PcDescriptors::kIcCall: | 83 case RawPcDescriptors::kIcCall: |
84 case PcDescriptors::kUnoptStaticCall: | 84 case RawPcDescriptors::kUnoptStaticCall: |
85 case PcDescriptors::kClosureCall: | 85 case RawPcDescriptors::kClosureCall: |
86 case PcDescriptors::kRuntimeCall: { | 86 case RawPcDescriptors::kRuntimeCall: { |
87 CodePatcher::SetPoolOffsetAt(pc_, static_cast<int32_t>(saved_value_)); | 87 CodePatcher::SetPoolOffsetAt(pc_, static_cast<int32_t>(saved_value_)); |
88 break; | 88 break; |
89 } | 89 } |
90 default: | 90 default: |
91 UNREACHABLE(); | 91 UNREACHABLE(); |
92 } | 92 } |
93 } | 93 } |
94 is_enabled_ = false; | 94 is_enabled_ = false; |
95 } | 95 } |
96 | 96 |
97 } // namespace dart | 97 } // namespace dart |
98 | 98 |
99 #endif // defined TARGET_ARCH_ARM64 | 99 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |