OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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" // Needed here to get TARGET_ARCH_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/code_patcher.h" | 9 #include "vm/code_patcher.h" |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 reinterpret_cast<uint8_t*>(return_address - kCallPatternSize); | 114 reinterpret_cast<uint8_t*>(return_address - kCallPatternSize); |
115 return (code_bytes[0] == 0x41) && (code_bytes[1] == 0xFF) && | 115 return (code_bytes[0] == 0x41) && (code_bytes[1] == 0xFF) && |
116 (code_bytes[2] == 0x97); | 116 (code_bytes[2] == 0x97); |
117 } | 117 } |
118 | 118 |
119 intptr_t pp_index() const { | 119 intptr_t pp_index() const { |
120 return InstructionPattern::IndexFromPPLoad(start_ + 3); | 120 return InstructionPattern::IndexFromPPLoad(start_ + 3); |
121 } | 121 } |
122 | 122 |
123 uword Target() const { | 123 uword Target() const { |
124 return reinterpret_cast<uword>(object_pool_.RawValueAt(pp_index())); | 124 return object_pool_.RawValueAt(pp_index()); |
125 } | 125 } |
126 | 126 |
127 void SetTarget(uword target) const { | 127 void SetTarget(uword target) const { |
128 object_pool_.SetRawValueAt(pp_index(), target); | 128 object_pool_.SetRawValueAt(pp_index(), target); |
129 // No need to flush the instruction cache, since the code is not modified. | 129 // No need to flush the instruction cache, since the code is not modified. |
130 } | 130 } |
131 | 131 |
132 protected: | 132 protected: |
133 uword start_; | 133 uword start_; |
134 const ObjectPool& object_pool_; | 134 const ObjectPool& object_pool_; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 238 |
239 RawObject* CodePatcher::GetEdgeCounterAt(uword pc, const Code& code) { | 239 RawObject* CodePatcher::GetEdgeCounterAt(uword pc, const Code& code) { |
240 ASSERT(code.ContainsInstructionAt(pc)); | 240 ASSERT(code.ContainsInstructionAt(pc)); |
241 EdgeCounter counter(pc, code); | 241 EdgeCounter counter(pc, code); |
242 return counter.edge_counter(); | 242 return counter.edge_counter(); |
243 } | 243 } |
244 | 244 |
245 } // namespace dart | 245 } // namespace dart |
246 | 246 |
247 #endif // defined TARGET_ARCH_X64 | 247 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |