OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
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 27 matching lines...) Expand all Loading... |
38 } | 38 } |
39 | 39 |
40 | 40 |
41 void CodeBreakpoint::PatchCode() { | 41 void CodeBreakpoint::PatchCode() { |
42 ASSERT(!is_enabled_); | 42 ASSERT(!is_enabled_); |
43 const Code& code = Code::Handle(code_); | 43 const Code& code = Code::Handle(code_); |
44 const Instructions& instrs = Instructions::Handle(code.instructions()); | 44 const Instructions& instrs = Instructions::Handle(code.instructions()); |
45 { | 45 { |
46 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); | 46 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); |
47 switch (breakpoint_kind_) { | 47 switch (breakpoint_kind_) { |
48 case PcDescriptors::kIcCall: | 48 case RawPcDescriptors::kIcCall: |
49 case PcDescriptors::kUnoptStaticCall: | 49 case RawPcDescriptors::kUnoptStaticCall: |
50 case PcDescriptors::kRuntimeCall: | 50 case RawPcDescriptors::kRuntimeCall: |
51 case PcDescriptors::kClosureCall: { | 51 case RawPcDescriptors::kClosureCall: { |
52 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); | 52 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); |
53 CodePatcher::PatchStaticCallAt(pc_, code, | 53 CodePatcher::PatchStaticCallAt(pc_, code, |
54 StubCode::BreakpointRuntimeEntryPoint()); | 54 StubCode::BreakpointRuntimeEntryPoint()); |
55 break; | 55 break; |
56 } | 56 } |
57 default: | 57 default: |
58 UNREACHABLE(); | 58 UNREACHABLE(); |
59 } | 59 } |
60 } | 60 } |
61 is_enabled_ = true; | 61 is_enabled_ = true; |
62 } | 62 } |
63 | 63 |
64 | 64 |
65 void CodeBreakpoint::RestoreCode() { | 65 void CodeBreakpoint::RestoreCode() { |
66 ASSERT(is_enabled_); | 66 ASSERT(is_enabled_); |
67 const Code& code = Code::Handle(code_); | 67 const Code& code = Code::Handle(code_); |
68 const Instructions& instrs = Instructions::Handle(code.instructions()); | 68 const Instructions& instrs = Instructions::Handle(code.instructions()); |
69 { | 69 { |
70 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); | 70 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); |
71 switch (breakpoint_kind_) { | 71 switch (breakpoint_kind_) { |
72 case PcDescriptors::kIcCall: | 72 case RawPcDescriptors::kIcCall: |
73 case PcDescriptors::kUnoptStaticCall: | 73 case RawPcDescriptors::kUnoptStaticCall: |
74 case PcDescriptors::kClosureCall: | 74 case RawPcDescriptors::kClosureCall: |
75 case PcDescriptors::kRuntimeCall: { | 75 case RawPcDescriptors::kRuntimeCall: { |
76 CodePatcher::PatchStaticCallAt(pc_, code, saved_value_); | 76 CodePatcher::PatchStaticCallAt(pc_, code, saved_value_); |
77 break; | 77 break; |
78 } | 78 } |
79 default: | 79 default: |
80 UNREACHABLE(); | 80 UNREACHABLE(); |
81 } | 81 } |
82 } | 82 } |
83 is_enabled_ = false; | 83 is_enabled_ = false; |
84 } | 84 } |
85 | 85 |
86 } // namespace dart | 86 } // namespace dart |
87 | 87 |
88 #endif // defined TARGET_ARCH_ARM | 88 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |