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