| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 InstanceCall call(return_address); | 253 InstanceCall call(return_address); |
| 254 return call.ic_data(); | 254 return call.ic_data(); |
| 255 } | 255 } |
| 256 | 256 |
| 257 | 257 |
| 258 intptr_t CodePatcher::InstanceCallSizeInBytes() { | 258 intptr_t CodePatcher::InstanceCallSizeInBytes() { |
| 259 return DartCallPattern::kNumInstructions * DartCallPattern::kInstructionSize; | 259 return DartCallPattern::kNumInstructions * DartCallPattern::kInstructionSize; |
| 260 } | 260 } |
| 261 | 261 |
| 262 | 262 |
| 263 RawArray* CodePatcher::GetTypeTestArray(uword instruction_address) { | 263 void CodePatcher::InsertCallAt(uword start, uword target) { |
| 264 Array& result = Array::Handle(); | 264 *reinterpret_cast<uint8_t*>(start) = 0xE8; |
| 265 uint32_t* target_addr = reinterpret_cast<uint32_t*>(instruction_address + 1); | 265 CallPattern call(start); |
| 266 result ^= reinterpret_cast<RawObject*>(*target_addr); | 266 call.SetTargetAddress(target); |
| 267 return result.raw(); | |
| 268 } | |
| 269 | |
| 270 | |
| 271 void CodePatcher::SetTypeTestArray(uword instruction_address, | |
| 272 const Array& value) { | |
| 273 uint32_t* target_addr = reinterpret_cast<uint32_t*>(instruction_address + 1); | |
| 274 *target_addr = reinterpret_cast<uint32_t>(value.raw()); | |
| 275 } | 267 } |
| 276 | 268 |
| 277 | 269 |
| 278 } // namespace dart | 270 } // namespace dart |
| 279 | 271 |
| 280 #endif // defined TARGET_ARCH_IA32 | 272 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |