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