| 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_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/debugger.h" | 8 #include "vm/debugger.h" |
| 9 | 9 |
| 10 #include "vm/assembler.h" | 10 #include "vm/assembler.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 void CodeBreakpoint::PatchCode() { | 23 void CodeBreakpoint::PatchCode() { |
| 24 ASSERT(!is_enabled_); | 24 ASSERT(!is_enabled_); |
| 25 StubCode* stub_code = Isolate::Current()->stub_code(); | 25 StubCode* stub_code = Isolate::Current()->stub_code(); |
| 26 uword stub_target = 0; | 26 uword stub_target = 0; |
| 27 switch (breakpoint_kind_) { | 27 switch (breakpoint_kind_) { |
| 28 case RawPcDescriptors::kIcCall: | 28 case RawPcDescriptors::kIcCall: |
| 29 case RawPcDescriptors::kUnoptStaticCall: | 29 case RawPcDescriptors::kUnoptStaticCall: |
| 30 stub_target = stub_code->ICCallBreakpointEntryPoint(); | 30 stub_target = stub_code->ICCallBreakpointEntryPoint(); |
| 31 break; | 31 break; |
| 32 case RawPcDescriptors::kClosureCall: | |
| 33 stub_target = stub_code->ClosureCallBreakpointEntryPoint(); | |
| 34 break; | |
| 35 case RawPcDescriptors::kRuntimeCall: | 32 case RawPcDescriptors::kRuntimeCall: |
| 36 stub_target = stub_code->RuntimeCallBreakpointEntryPoint(); | 33 stub_target = stub_code->RuntimeCallBreakpointEntryPoint(); |
| 37 break; | 34 break; |
| 38 default: | 35 default: |
| 39 UNREACHABLE(); | 36 UNREACHABLE(); |
| 40 } | 37 } |
| 41 const Code& code = Code::Handle(code_); | 38 const Code& code = Code::Handle(code_); |
| 42 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); | 39 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); |
| 43 CodePatcher::PatchPoolPointerCallAt(pc_, code, stub_target); | 40 CodePatcher::PatchPoolPointerCallAt(pc_, code, stub_target); |
| 44 is_enabled_ = true; | 41 is_enabled_ = true; |
| 45 } | 42 } |
| 46 | 43 |
| 47 | 44 |
| 48 void CodeBreakpoint::RestoreCode() { | 45 void CodeBreakpoint::RestoreCode() { |
| 49 ASSERT(is_enabled_); | 46 ASSERT(is_enabled_); |
| 50 const Code& code = Code::Handle(code_); | 47 const Code& code = Code::Handle(code_); |
| 51 switch (breakpoint_kind_) { | 48 switch (breakpoint_kind_) { |
| 52 case RawPcDescriptors::kIcCall: | 49 case RawPcDescriptors::kIcCall: |
| 53 case RawPcDescriptors::kUnoptStaticCall: | 50 case RawPcDescriptors::kUnoptStaticCall: |
| 54 case RawPcDescriptors::kClosureCall: | |
| 55 case RawPcDescriptors::kRuntimeCall: { | 51 case RawPcDescriptors::kRuntimeCall: { |
| 56 CodePatcher::PatchPoolPointerCallAt(pc_, code, saved_value_); | 52 CodePatcher::PatchPoolPointerCallAt(pc_, code, saved_value_); |
| 57 break; | 53 break; |
| 58 } | 54 } |
| 59 default: | 55 default: |
| 60 UNREACHABLE(); | 56 UNREACHABLE(); |
| 61 } | 57 } |
| 62 is_enabled_ = false; | 58 is_enabled_ = false; |
| 63 } | 59 } |
| 64 | 60 |
| 65 | 61 |
| 66 } // namespace dart | 62 } // namespace dart |
| 67 | 63 |
| 68 #endif // defined TARGET_ARCH_X64 | 64 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |