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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 } | 286 } |
287 return call.target(); | 287 return call.target(); |
288 } | 288 } |
289 | 289 |
290 | 290 |
291 intptr_t CodePatcher::InstanceCallSizeInBytes() { | 291 intptr_t CodePatcher::InstanceCallSizeInBytes() { |
292 return InstanceCall::kCallPatternSize; | 292 return InstanceCall::kCallPatternSize; |
293 } | 293 } |
294 | 294 |
295 | 295 |
296 void CodePatcher::InsertDeoptimizationCallAt(uword start, uword target) { | 296 void CodePatcher::InsertDeoptimizationCallAt(uword start) { |
297 // The inserted call should not overlap the lazy deopt jump code. | 297 UNREACHABLE(); |
298 ASSERT(start + ShortCallPattern::pattern_length_in_bytes() <= target); | |
299 *reinterpret_cast<uint8_t*>(start) = 0xE8; | |
300 ShortCallPattern call(start); | |
301 call.SetTargetAddress(target); | |
302 CPU::FlushICache(start, ShortCallPattern::pattern_length_in_bytes()); | |
303 } | 298 } |
304 | 299 |
305 | 300 |
306 RawFunction* CodePatcher::GetUnoptimizedStaticCallAt( | 301 RawFunction* CodePatcher::GetUnoptimizedStaticCallAt( |
307 uword return_address, const Code& code, ICData* ic_data_result) { | 302 uword return_address, const Code& code, ICData* ic_data_result) { |
308 ASSERT(code.ContainsInstructionAt(return_address)); | 303 ASSERT(code.ContainsInstructionAt(return_address)); |
309 UnoptimizedStaticCall static_call(return_address, code); | 304 UnoptimizedStaticCall static_call(return_address, code); |
310 ICData& ic_data = ICData::Handle(); | 305 ICData& ic_data = ICData::Handle(); |
311 ic_data ^= static_call.ic_data(); | 306 ic_data ^= static_call.ic_data(); |
312 if (ic_data_result != NULL) { | 307 if (ic_data_result != NULL) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 NativeFunction* target) { | 354 NativeFunction* target) { |
360 ASSERT(code.ContainsInstructionAt(return_address)); | 355 ASSERT(code.ContainsInstructionAt(return_address)); |
361 NativeCall call(return_address, code); | 356 NativeCall call(return_address, code); |
362 *target = call.native_function(); | 357 *target = call.native_function(); |
363 return call.target(); | 358 return call.target(); |
364 } | 359 } |
365 | 360 |
366 } // namespace dart | 361 } // namespace dart |
367 | 362 |
368 #endif // defined TARGET_ARCH_X64 | 363 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |