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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 RawPcDescriptors::kIcCall: | 57 case RawPcDescriptors::kIcCall: |
58 case RawPcDescriptors::kUnoptStaticCall: | 58 case RawPcDescriptors::kUnoptStaticCall: { |
59 case RawPcDescriptors::kRuntimeCall: | 59 int32_t offset = CodePatcher::GetPoolOffsetAt(pc_); |
| 60 ASSERT((offset > 0) && ((offset % 8) == 7)); |
| 61 saved_value_ = static_cast<uword>(offset); |
| 62 const uint32_t stub_offset = |
| 63 InstructionPattern::OffsetFromPPIndex( |
| 64 Assembler::kICCallBreakpointCPIndex); |
| 65 CodePatcher::SetPoolOffsetAt(pc_, stub_offset); |
| 66 break; |
| 67 } |
60 case RawPcDescriptors::kClosureCall: { | 68 case RawPcDescriptors::kClosureCall: { |
61 int32_t offset = CodePatcher::GetPoolOffsetAt(pc_); | 69 int32_t offset = CodePatcher::GetPoolOffsetAt(pc_); |
62 ASSERT((offset > 0) && ((offset % 8) == 7)); | 70 ASSERT((offset > 0) && ((offset % 8) == 7)); |
63 saved_value_ = static_cast<uword>(offset); | 71 saved_value_ = static_cast<uword>(offset); |
64 const uint32_t stub_offset = | 72 const uint32_t stub_offset = |
65 InstructionPattern::OffsetFromPPIndex( | 73 InstructionPattern::OffsetFromPPIndex( |
66 Assembler::kBreakpointRuntimeCPIndex); | 74 Assembler::kClosureCallBreakpointCPIndex); |
67 CodePatcher::SetPoolOffsetAt(pc_, stub_offset); | 75 CodePatcher::SetPoolOffsetAt(pc_, stub_offset); |
68 break; | 76 break; |
69 } | 77 } |
| 78 case RawPcDescriptors::kRuntimeCall: { |
| 79 int32_t offset = CodePatcher::GetPoolOffsetAt(pc_); |
| 80 ASSERT((offset > 0) && ((offset % 8) == 7)); |
| 81 saved_value_ = static_cast<uword>(offset); |
| 82 const uint32_t stub_offset = |
| 83 InstructionPattern::OffsetFromPPIndex( |
| 84 Assembler::kRuntimeCallBreakpointCPIndex); |
| 85 CodePatcher::SetPoolOffsetAt(pc_, stub_offset); |
| 86 break; |
| 87 } |
70 default: | 88 default: |
71 UNREACHABLE(); | 89 UNREACHABLE(); |
72 } | 90 } |
73 } | 91 } |
74 is_enabled_ = true; | 92 is_enabled_ = true; |
75 } | 93 } |
76 | 94 |
77 | 95 |
78 void CodeBreakpoint::RestoreCode() { | 96 void CodeBreakpoint::RestoreCode() { |
79 ASSERT(is_enabled_); | 97 ASSERT(is_enabled_); |
(...skipping 13 matching lines...) Expand all Loading... |
93 UNREACHABLE(); | 111 UNREACHABLE(); |
94 } | 112 } |
95 } | 113 } |
96 is_enabled_ = false; | 114 is_enabled_ = false; |
97 } | 115 } |
98 | 116 |
99 | 117 |
100 } // namespace dart | 118 } // namespace dart |
101 | 119 |
102 #endif // defined TARGET_ARCH_X64 | 120 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |