OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 *function = call.function(); | 154 *function = call.function(); |
155 } | 155 } |
156 | 156 |
157 | 157 |
158 void CodePatcher::PatchStaticCallAt(uword return_address, uword new_target) { | 158 void CodePatcher::PatchStaticCallAt(uword return_address, uword new_target) { |
159 StaticCall call(return_address); | 159 StaticCall call(return_address); |
160 call.set_target(new_target); | 160 call.set_target(new_target); |
161 } | 161 } |
162 | 162 |
163 | 163 |
| 164 void CodePatcher::PatchInstanceCallAt(uword return_address, uword new_target) { |
| 165 InstanceCall call(return_address); |
| 166 call.set_target(new_target); |
| 167 } |
| 168 |
| 169 |
164 static void SwapCode(intptr_t num_bytes, char* a, char* b) { | 170 static void SwapCode(intptr_t num_bytes, char* a, char* b) { |
165 for (intptr_t i = 0; i < num_bytes; i++) { | 171 for (intptr_t i = 0; i < num_bytes; i++) { |
166 char tmp = *a; | 172 char tmp = *a; |
167 *a = *b; | 173 *a = *b; |
168 *b = tmp; | 174 *b = tmp; |
169 a++; | 175 a++; |
170 b++; | 176 b++; |
171 } | 177 } |
172 } | 178 } |
173 | 179 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 } | 266 } |
261 | 267 |
262 | 268 |
263 intptr_t CodePatcher::InstanceCallSizeInBytes() { | 269 intptr_t CodePatcher::InstanceCallSizeInBytes() { |
264 return DartCallPattern::kNumInstructions * DartCallPattern::kInstructionSize; | 270 return DartCallPattern::kNumInstructions * DartCallPattern::kInstructionSize; |
265 } | 271 } |
266 | 272 |
267 } // namespace dart | 273 } // namespace dart |
268 | 274 |
269 #endif // defined TARGET_ARCH_IA32 | 275 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |