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