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