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 28 matching lines...) Expand all Loading... |
39 | 39 |
40 | 40 |
41 void CodeBreakpoint::PatchCode() { | 41 void CodeBreakpoint::PatchCode() { |
42 ASSERT(!is_enabled_); | 42 ASSERT(!is_enabled_); |
43 switch (breakpoint_kind_) { | 43 switch (breakpoint_kind_) { |
44 case PcDescriptors::kIcCall: | 44 case PcDescriptors::kIcCall: |
45 case PcDescriptors::kUnoptStaticCall: | 45 case PcDescriptors::kUnoptStaticCall: |
46 case PcDescriptors::kRuntimeCall: | 46 case PcDescriptors::kRuntimeCall: |
47 case PcDescriptors::kClosureCall: | 47 case PcDescriptors::kClosureCall: |
48 case PcDescriptors::kReturn: { | 48 case PcDescriptors::kReturn: { |
49 const Code& code = | 49 const Code& code = Code::Handle(code_); |
50 Code::Handle(Function::Handle(function_).unoptimized_code()); | |
51 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); | 50 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); |
52 CodePatcher::PatchStaticCallAt(pc_, code, | 51 CodePatcher::PatchStaticCallAt(pc_, code, |
53 StubCode::BreakpointRuntimeEntryPoint()); | 52 StubCode::BreakpointRuntimeEntryPoint()); |
54 break; | 53 break; |
55 } | 54 } |
56 default: | 55 default: |
57 UNREACHABLE(); | 56 UNREACHABLE(); |
58 } | 57 } |
59 is_enabled_ = true; | 58 is_enabled_ = true; |
60 } | 59 } |
61 | 60 |
62 | 61 |
63 void CodeBreakpoint::RestoreCode() { | 62 void CodeBreakpoint::RestoreCode() { |
64 ASSERT(is_enabled_); | 63 ASSERT(is_enabled_); |
65 switch (breakpoint_kind_) { | 64 switch (breakpoint_kind_) { |
66 case PcDescriptors::kIcCall: | 65 case PcDescriptors::kIcCall: |
67 case PcDescriptors::kUnoptStaticCall: | 66 case PcDescriptors::kUnoptStaticCall: |
68 case PcDescriptors::kClosureCall: | 67 case PcDescriptors::kClosureCall: |
69 case PcDescriptors::kRuntimeCall: | 68 case PcDescriptors::kRuntimeCall: |
70 case PcDescriptors::kReturn: { | 69 case PcDescriptors::kReturn: { |
71 const Code& code = | 70 const Code& code = Code::Handle(code_); |
72 Code::Handle(Function::Handle(function_).unoptimized_code()); | |
73 CodePatcher::PatchStaticCallAt(pc_, code, saved_value_); | 71 CodePatcher::PatchStaticCallAt(pc_, code, saved_value_); |
74 break; | 72 break; |
75 } | 73 } |
76 default: | 74 default: |
77 UNREACHABLE(); | 75 UNREACHABLE(); |
78 } | 76 } |
79 is_enabled_ = false; | 77 is_enabled_ = false; |
80 } | 78 } |
81 | 79 |
82 } // namespace dart | 80 } // namespace dart |
83 | 81 |
84 #endif // defined TARGET_ARCH_ARM | 82 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |