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