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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 const intptr_t index = (offset - Array::data_offset()) / kWordSize; | 44 const intptr_t index = (offset - Array::data_offset()) / kWordSize; |
45 const uword stub_address = reinterpret_cast<uword>(object_pool.At(index)); | 45 const uword stub_address = reinterpret_cast<uword>(object_pool.At(index)); |
46 ASSERT(stub_address % kWordSize == 0); | 46 ASSERT(stub_address % kWordSize == 0); |
47 return stub_address; | 47 return stub_address; |
48 } | 48 } |
49 | 49 |
50 | 50 |
51 void CodeBreakpoint::PatchCode() { | 51 void CodeBreakpoint::PatchCode() { |
52 ASSERT(!is_enabled_); | 52 ASSERT(!is_enabled_); |
53 switch (breakpoint_kind_) { | 53 switch (breakpoint_kind_) { |
54 case PcDescriptors::kIcCall: { | 54 case PcDescriptors::kIcCall: |
55 int32_t offset = CodePatcher::GetPoolOffsetAt(pc_); | |
56 ASSERT((offset > 0) && ((offset % 8) == 7)); | |
57 saved_value_ = static_cast<uword>(offset); | |
58 const int32_t stub_offset = | |
59 InstructionPattern::OffsetFromPPIndex( | |
60 Assembler::kBreakpointDynamicCPIndex); | |
61 CodePatcher::SetPoolOffsetAt(pc_, stub_offset); | |
62 break; | |
63 } | |
64 case PcDescriptors::kUnoptStaticCall: | 55 case PcDescriptors::kUnoptStaticCall: |
65 case PcDescriptors::kRuntimeCall: | 56 case PcDescriptors::kRuntimeCall: |
66 case PcDescriptors::kClosureCall: | 57 case PcDescriptors::kClosureCall: |
67 case PcDescriptors::kReturn: { | 58 case PcDescriptors::kReturn: { |
68 int32_t offset = CodePatcher::GetPoolOffsetAt(pc_); | 59 int32_t offset = CodePatcher::GetPoolOffsetAt(pc_); |
69 ASSERT((offset > 0) && ((offset % 8) == 7)); | 60 ASSERT((offset > 0) && ((offset % 8) == 7)); |
70 saved_value_ = static_cast<uword>(offset); | 61 saved_value_ = static_cast<uword>(offset); |
71 const uint32_t stub_offset = | 62 const uint32_t stub_offset = |
72 InstructionPattern::OffsetFromPPIndex( | 63 InstructionPattern::OffsetFromPPIndex( |
73 Assembler::kBreakpointRuntimeCPIndex); | 64 Assembler::kBreakpointRuntimeCPIndex); |
(...skipping 21 matching lines...) Expand all Loading... |
95 default: | 86 default: |
96 UNREACHABLE(); | 87 UNREACHABLE(); |
97 } | 88 } |
98 is_enabled_ = false; | 89 is_enabled_ = false; |
99 } | 90 } |
100 | 91 |
101 | 92 |
102 } // namespace dart | 93 } // namespace dart |
103 | 94 |
104 #endif // defined TARGET_ARCH_X64 | 95 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |