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