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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 } | 47 } |
48 | 48 |
49 | 49 |
50 void CodeBreakpoint::PatchCode() { | 50 void CodeBreakpoint::PatchCode() { |
51 ASSERT(!is_enabled_); | 51 ASSERT(!is_enabled_); |
52 const Code& code = Code::Handle(code_); | 52 const Code& code = Code::Handle(code_); |
53 const Instructions& instrs = Instructions::Handle(code.instructions()); | 53 const Instructions& instrs = Instructions::Handle(code.instructions()); |
54 { | 54 { |
55 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); | 55 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); |
56 switch (breakpoint_kind_) { | 56 switch (breakpoint_kind_) { |
57 case PcDescriptors::kIcCall: | 57 case RawPcDescriptors::kIcCall: |
58 case PcDescriptors::kUnoptStaticCall: | 58 case RawPcDescriptors::kUnoptStaticCall: |
59 case PcDescriptors::kRuntimeCall: | 59 case RawPcDescriptors::kRuntimeCall: |
60 case PcDescriptors::kClosureCall: { | 60 case RawPcDescriptors::kClosureCall: { |
61 int32_t offset = CodePatcher::GetPoolOffsetAt(pc_); | 61 int32_t offset = CodePatcher::GetPoolOffsetAt(pc_); |
62 ASSERT((offset > 0) && ((offset % 8) == 7)); | 62 ASSERT((offset > 0) && ((offset % 8) == 7)); |
63 saved_value_ = static_cast<uword>(offset); | 63 saved_value_ = static_cast<uword>(offset); |
64 const uint32_t stub_offset = | 64 const uint32_t stub_offset = |
65 InstructionPattern::OffsetFromPPIndex( | 65 InstructionPattern::OffsetFromPPIndex( |
66 Assembler::kBreakpointRuntimeCPIndex); | 66 Assembler::kBreakpointRuntimeCPIndex); |
67 CodePatcher::SetPoolOffsetAt(pc_, stub_offset); | 67 CodePatcher::SetPoolOffsetAt(pc_, stub_offset); |
68 break; | 68 break; |
69 } | 69 } |
70 default: | 70 default: |
71 UNREACHABLE(); | 71 UNREACHABLE(); |
72 } | 72 } |
73 } | 73 } |
74 is_enabled_ = true; | 74 is_enabled_ = true; |
75 } | 75 } |
76 | 76 |
77 | 77 |
78 void CodeBreakpoint::RestoreCode() { | 78 void CodeBreakpoint::RestoreCode() { |
79 ASSERT(is_enabled_); | 79 ASSERT(is_enabled_); |
80 const Code& code = Code::Handle(code_); | 80 const Code& code = Code::Handle(code_); |
81 const Instructions& instrs = Instructions::Handle(code.instructions()); | 81 const Instructions& instrs = Instructions::Handle(code.instructions()); |
82 { | 82 { |
83 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); | 83 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); |
84 switch (breakpoint_kind_) { | 84 switch (breakpoint_kind_) { |
85 case PcDescriptors::kIcCall: | 85 case RawPcDescriptors::kIcCall: |
86 case PcDescriptors::kUnoptStaticCall: | 86 case RawPcDescriptors::kUnoptStaticCall: |
87 case PcDescriptors::kClosureCall: | 87 case RawPcDescriptors::kClosureCall: |
88 case PcDescriptors::kRuntimeCall: { | 88 case RawPcDescriptors::kRuntimeCall: { |
89 CodePatcher::SetPoolOffsetAt(pc_, static_cast<int32_t>(saved_value_)); | 89 CodePatcher::SetPoolOffsetAt(pc_, static_cast<int32_t>(saved_value_)); |
90 break; | 90 break; |
91 } | 91 } |
92 default: | 92 default: |
93 UNREACHABLE(); | 93 UNREACHABLE(); |
94 } | 94 } |
95 } | 95 } |
96 is_enabled_ = false; | 96 is_enabled_ = false; |
97 } | 97 } |
98 | 98 |
99 | 99 |
100 } // namespace dart | 100 } // namespace dart |
101 | 101 |
102 #endif // defined TARGET_ARCH_X64 | 102 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |