OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
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" |
11 #include "vm/instructions.h" | 11 #include "vm/instructions.h" |
12 #include "vm/stub_code.h" | 12 #include "vm/stub_code.h" |
13 | 13 |
14 namespace dart { | 14 namespace dart { |
15 | 15 |
16 RawCode* CodeBreakpoint::OrigStubAddress() const { | 16 uword CodeBreakpoint::OrigStubAddress() const { |
17 return saved_value_; | 17 return saved_value_; |
18 } | 18 } |
19 | 19 |
20 | 20 |
21 void CodeBreakpoint::PatchCode() { | 21 void CodeBreakpoint::PatchCode() { |
22 ASSERT(!is_enabled_); | 22 ASSERT(!is_enabled_); |
23 Code& stub_target = Code::Handle(); | 23 uword stub_target = 0; |
24 switch (breakpoint_kind_) { | 24 switch (breakpoint_kind_) { |
25 case RawPcDescriptors::kIcCall: | 25 case RawPcDescriptors::kIcCall: |
26 case RawPcDescriptors::kUnoptStaticCall: | 26 case RawPcDescriptors::kUnoptStaticCall: |
27 stub_target = StubCode::ICCallBreakpoint_entry()->code(); | 27 stub_target = StubCode::ICCallBreakpoint_entry()->EntryPoint(); |
28 break; | 28 break; |
29 case RawPcDescriptors::kRuntimeCall: { | 29 case RawPcDescriptors::kRuntimeCall: { |
30 stub_target = StubCode::RuntimeCallBreakpoint_entry()->code(); | 30 stub_target = StubCode::RuntimeCallBreakpoint_entry()->EntryPoint(); |
31 break; | 31 break; |
32 } | 32 } |
33 default: | 33 default: |
34 UNREACHABLE(); | 34 UNREACHABLE(); |
35 } | 35 } |
36 const Code& code = Code::Handle(code_); | 36 const Code& code = Code::Handle(code_); |
37 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); | 37 saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code); |
38 CodePatcher::PatchPoolPointerCallAt(pc_, code, stub_target); | 38 CodePatcher::PatchPoolPointerCallAt(pc_, code, stub_target); |
39 is_enabled_ = true; | 39 is_enabled_ = true; |
40 } | 40 } |
41 | 41 |
42 | 42 |
43 void CodeBreakpoint::RestoreCode() { | 43 void CodeBreakpoint::RestoreCode() { |
44 ASSERT(is_enabled_); | 44 ASSERT(is_enabled_); |
45 const Code& code = Code::Handle(code_); | 45 const Code& code = Code::Handle(code_); |
46 switch (breakpoint_kind_) { | 46 switch (breakpoint_kind_) { |
47 case RawPcDescriptors::kIcCall: | 47 case RawPcDescriptors::kIcCall: |
48 case RawPcDescriptors::kUnoptStaticCall: | 48 case RawPcDescriptors::kUnoptStaticCall: |
49 case RawPcDescriptors::kRuntimeCall: { | 49 case RawPcDescriptors::kRuntimeCall: { |
50 CodePatcher::PatchPoolPointerCallAt( | 50 CodePatcher::PatchPoolPointerCallAt(pc_, code, saved_value_); |
51 pc_, code, Code::Handle(saved_value_)); | |
52 break; | 51 break; |
53 } | 52 } |
54 default: | 53 default: |
55 UNREACHABLE(); | 54 UNREACHABLE(); |
56 } | 55 } |
57 is_enabled_ = false; | 56 is_enabled_ = false; |
58 } | 57 } |
59 | 58 |
60 } // namespace dart | 59 } // namespace dart |
61 | 60 |
62 #endif // defined TARGET_ARCH_ARM64 | 61 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |