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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 RawPcDescriptors::kIcCall: | 55 case RawPcDescriptors::kIcCall: |
56 case RawPcDescriptors::kUnoptStaticCall: | 56 case RawPcDescriptors::kUnoptStaticCall: { |
57 case RawPcDescriptors::kRuntimeCall: | 57 int32_t offset = CodePatcher::GetPoolOffsetAt(pc_); |
| 58 ASSERT((offset > 0) && ((offset & 0x7) == 0)); |
| 59 saved_value_ = static_cast<uword>(offset); |
| 60 const uint32_t stub_offset = |
| 61 InstructionPattern::OffsetFromPPIndex( |
| 62 Assembler::kICCallBreakpointCPIndex); |
| 63 CodePatcher::SetPoolOffsetAt(pc_, stub_offset); |
| 64 break; |
| 65 } |
58 case RawPcDescriptors::kClosureCall: { | 66 case RawPcDescriptors::kClosureCall: { |
59 int32_t offset = CodePatcher::GetPoolOffsetAt(pc_); | 67 int32_t offset = CodePatcher::GetPoolOffsetAt(pc_); |
60 ASSERT((offset > 0) && ((offset & 0x7) == 0)); | 68 ASSERT((offset > 0) && ((offset & 0x7) == 0)); |
61 saved_value_ = static_cast<uword>(offset); | 69 saved_value_ = static_cast<uword>(offset); |
62 const uint32_t stub_offset = | 70 const uint32_t stub_offset = |
63 InstructionPattern::OffsetFromPPIndex( | 71 InstructionPattern::OffsetFromPPIndex( |
64 Assembler::kBreakpointRuntimeCPIndex); | 72 Assembler::kClosureCallBreakpointCPIndex); |
65 CodePatcher::SetPoolOffsetAt(pc_, stub_offset); | 73 CodePatcher::SetPoolOffsetAt(pc_, stub_offset); |
66 break; | 74 break; |
67 } | 75 } |
| 76 case RawPcDescriptors::kRuntimeCall: { |
| 77 int32_t offset = CodePatcher::GetPoolOffsetAt(pc_); |
| 78 ASSERT((offset > 0) && ((offset & 0x7) == 0)); |
| 79 saved_value_ = static_cast<uword>(offset); |
| 80 const uint32_t stub_offset = |
| 81 InstructionPattern::OffsetFromPPIndex( |
| 82 Assembler::kRuntimeCallBreakpointCPIndex); |
| 83 CodePatcher::SetPoolOffsetAt(pc_, stub_offset); |
| 84 break; |
| 85 } |
68 default: | 86 default: |
69 UNREACHABLE(); | 87 UNREACHABLE(); |
70 } | 88 } |
71 } | 89 } |
72 is_enabled_ = true; | 90 is_enabled_ = true; |
73 } | 91 } |
74 | 92 |
75 | 93 |
76 void CodeBreakpoint::RestoreCode() { | 94 void CodeBreakpoint::RestoreCode() { |
77 ASSERT(is_enabled_); | 95 ASSERT(is_enabled_); |
(...skipping 12 matching lines...) Expand all Loading... |
90 default: | 108 default: |
91 UNREACHABLE(); | 109 UNREACHABLE(); |
92 } | 110 } |
93 } | 111 } |
94 is_enabled_ = false; | 112 is_enabled_ = false; |
95 } | 113 } |
96 | 114 |
97 } // namespace dart | 115 } // namespace dart |
98 | 116 |
99 #endif // defined TARGET_ARCH_ARM64 | 117 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |