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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 bool CodePatcher::IsDartCall(uword return_address) { | 147 bool CodePatcher::IsDartCall(uword return_address) { |
148 return DartCallPattern::IsValid(return_address); | 148 return DartCallPattern::IsValid(return_address); |
149 } | 149 } |
150 | 150 |
151 | 151 |
152 uword CodePatcher::GetInstanceCallAt(uword return_address, | 152 uword CodePatcher::GetInstanceCallAt(uword return_address, |
153 ICData* ic_data, | 153 ICData* ic_data, |
154 Array* arguments_descriptor) { | 154 Array* arguments_descriptor) { |
155 InstanceCall call(return_address); | 155 InstanceCall call(return_address); |
156 if (ic_data != NULL) { | 156 if (ic_data != NULL) { |
157 *ic_data ^= call.ic_data(); | 157 *ic_data |= call.ic_data(); |
158 } | 158 } |
159 if (arguments_descriptor != NULL) { | 159 if (arguments_descriptor != NULL) { |
160 *arguments_descriptor ^= call.arguments_descriptor(); | 160 *arguments_descriptor ^= call.arguments_descriptor(); |
161 } | 161 } |
162 return call.target(); | 162 return call.target(); |
163 } | 163 } |
164 | 164 |
165 | 165 |
166 intptr_t CodePatcher::InstanceCallSizeInBytes() { | 166 intptr_t CodePatcher::InstanceCallSizeInBytes() { |
167 return DartCallPattern::kCallPatternSize; | 167 return DartCallPattern::kCallPatternSize; |
168 } | 168 } |
169 | 169 |
170 | 170 |
171 void CodePatcher::InsertCallAt(uword start, uword target) { | 171 void CodePatcher::InsertCallAt(uword start, uword target) { |
172 *reinterpret_cast<uint8_t*>(start) = 0xE8; | 172 *reinterpret_cast<uint8_t*>(start) = 0xE8; |
173 ShortCallPattern call(start); | 173 ShortCallPattern call(start); |
174 call.SetTargetAddress(target); | 174 call.SetTargetAddress(target); |
175 CPU::FlushICache(start, ShortCallPattern::InstructionLength()); | 175 CPU::FlushICache(start, ShortCallPattern::InstructionLength()); |
176 } | 176 } |
177 | 177 |
178 | 178 |
179 } // namespace dart | 179 } // namespace dart |
180 | 180 |
181 #endif // defined TARGET_ARCH_X64 | 181 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |