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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 void CodeBreakpoint::PatchCode() { | 45 void CodeBreakpoint::PatchCode() { |
46 ASSERT(!is_enabled_); | 46 ASSERT(!is_enabled_); |
47 const Code& code = Code::Handle(code_); | 47 const Code& code = Code::Handle(code_); |
48 const Instructions& instrs = Instructions::Handle(code.instructions()); | 48 const Instructions& instrs = Instructions::Handle(code.instructions()); |
49 { | 49 { |
50 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); | 50 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); |
51 switch (breakpoint_kind_) { | 51 switch (breakpoint_kind_) { |
52 case PcDescriptors::kIcCall: | 52 case PcDescriptors::kIcCall: |
53 case PcDescriptors::kUnoptStaticCall: | 53 case PcDescriptors::kUnoptStaticCall: |
54 case PcDescriptors::kRuntimeCall: | 54 case PcDescriptors::kRuntimeCall: |
55 case PcDescriptors::kClosureCall: | 55 case PcDescriptors::kClosureCall: { |
56 case PcDescriptors::kReturn: { | |
57 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); | 56 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); |
58 CodePatcher::PatchStaticCallAt(pc_, code, | 57 CodePatcher::PatchStaticCallAt(pc_, code, |
59 StubCode::BreakpointRuntimeEntryPoint()); | 58 StubCode::BreakpointRuntimeEntryPoint()); |
60 break; | 59 break; |
61 } | 60 } |
62 default: | 61 default: |
63 UNREACHABLE(); | 62 UNREACHABLE(); |
64 } | 63 } |
65 } | 64 } |
66 is_enabled_ = true; | 65 is_enabled_ = true; |
67 } | 66 } |
68 | 67 |
69 | 68 |
70 void CodeBreakpoint::RestoreCode() { | 69 void CodeBreakpoint::RestoreCode() { |
71 ASSERT(is_enabled_); | 70 ASSERT(is_enabled_); |
72 const Code& code = Code::Handle(code_); | 71 const Code& code = Code::Handle(code_); |
73 const Instructions& instrs = Instructions::Handle(code.instructions()); | 72 const Instructions& instrs = Instructions::Handle(code.instructions()); |
74 { | 73 { |
75 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); | 74 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); |
76 switch (breakpoint_kind_) { | 75 switch (breakpoint_kind_) { |
77 case PcDescriptors::kIcCall: | 76 case PcDescriptors::kIcCall: |
78 case PcDescriptors::kUnoptStaticCall: | 77 case PcDescriptors::kUnoptStaticCall: |
79 case PcDescriptors::kClosureCall: | 78 case PcDescriptors::kClosureCall: |
80 case PcDescriptors::kRuntimeCall: | 79 case PcDescriptors::kRuntimeCall: { |
81 case PcDescriptors::kReturn: { | |
82 CodePatcher::PatchStaticCallAt(pc_, code, saved_value_); | 80 CodePatcher::PatchStaticCallAt(pc_, code, saved_value_); |
83 break; | 81 break; |
84 } | 82 } |
85 default: | 83 default: |
86 UNREACHABLE(); | 84 UNREACHABLE(); |
87 } | 85 } |
88 } | 86 } |
89 is_enabled_ = false; | 87 is_enabled_ = false; |
90 } | 88 } |
91 | 89 |
92 } // namespace dart | 90 } // namespace dart |
93 | 91 |
94 #endif // defined TARGET_ARCH_IA32 | 92 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |