| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 ICData& ic_data = ICData::Handle(); | 132 ICData& ic_data = ICData::Handle(); |
| 133 ic_data ^= reinterpret_cast<RawObject*>(immediate_one()); | 133 ic_data ^= reinterpret_cast<RawObject*>(immediate_one()); |
| 134 return ic_data.raw(); | 134 return ic_data.raw(); |
| 135 } | 135 } |
| 136 | 136 |
| 137 private: | 137 private: |
| 138 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceCall); | 138 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceCall); |
| 139 }; | 139 }; |
| 140 | 140 |
| 141 | 141 |
| 142 void CodePatcher::GetStaticCallAt(uword return_address, | 142 uword CodePatcher::GetStaticCallTargetAt(uword return_address) { |
| 143 Function* function, | |
| 144 uword* target) { | |
| 145 ASSERT(function != NULL); | |
| 146 ASSERT(target != NULL); | |
| 147 StaticCall call(return_address); | 143 StaticCall call(return_address); |
| 148 *target = call.target(); | 144 return call.target(); |
| 149 *function = call.function(); | |
| 150 } | 145 } |
| 151 | 146 |
| 152 | 147 |
| 153 void CodePatcher::PatchStaticCallAt(uword return_address, uword new_target) { | 148 void CodePatcher::PatchStaticCallAt(uword return_address, uword new_target) { |
| 154 StaticCall call(return_address); | 149 StaticCall call(return_address); |
| 155 call.set_target(new_target); | 150 call.set_target(new_target); |
| 156 } | 151 } |
| 157 | 152 |
| 158 | 153 |
| 159 void CodePatcher::PatchInstanceCallAt(uword return_address, uword new_target) { | 154 void CodePatcher::PatchInstanceCallAt(uword return_address, uword new_target) { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 *reinterpret_cast<uint8_t*>(start) = 0xE8; | 259 *reinterpret_cast<uint8_t*>(start) = 0xE8; |
| 265 CallPattern call(start); | 260 CallPattern call(start); |
| 266 call.SetTargetAddress(target); | 261 call.SetTargetAddress(target); |
| 267 CPU::FlushICache(start, CallPattern::InstructionLength()); | 262 CPU::FlushICache(start, CallPattern::InstructionLength()); |
| 268 } | 263 } |
| 269 | 264 |
| 270 | 265 |
| 271 } // namespace dart | 266 } // namespace dart |
| 272 | 267 |
| 273 #endif // defined TARGET_ARCH_IA32 | 268 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |