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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 193 |
194 void CodePatcher::PatchInstanceCallAt(uword return_address, | 194 void CodePatcher::PatchInstanceCallAt(uword return_address, |
195 const Code& code, | 195 const Code& code, |
196 uword new_target) { | 196 uword new_target) { |
197 ASSERT(code.ContainsInstructionAt(return_address)); | 197 ASSERT(code.ContainsInstructionAt(return_address)); |
198 InstanceCall call(return_address); | 198 InstanceCall call(return_address); |
199 call.set_target(new_target); | 199 call.set_target(new_target); |
200 } | 200 } |
201 | 201 |
202 | 202 |
203 void CodePatcher::InsertCallAt(uword start, uword target) { | 203 void CodePatcher::InsertDeoptimizationCallAt(uword start, uword target) { |
204 // The inserted call should not overlap the lazy deopt jump code. | 204 // The inserted call should not overlap the lazy deopt jump code. |
205 ASSERT(start + CallPattern::pattern_length_in_bytes() <= target); | 205 ASSERT(start + CallPattern::pattern_length_in_bytes() <= target); |
206 *reinterpret_cast<uint8_t*>(start) = 0xE8; | 206 *reinterpret_cast<uint8_t*>(start) = 0xE8; |
207 CallPattern call(start); | 207 CallPattern call(start); |
208 call.SetTargetAddress(target); | 208 call.SetTargetAddress(target); |
209 CPU::FlushICache(start, CallPattern::pattern_length_in_bytes()); | 209 CPU::FlushICache(start, CallPattern::pattern_length_in_bytes()); |
210 } | 210 } |
211 | 211 |
212 | 212 |
213 uword CodePatcher::GetInstanceCallAt( | 213 uword CodePatcher::GetInstanceCallAt( |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 285 |
286 RawObject* CodePatcher::GetEdgeCounterAt(uword pc, const Code& code) { | 286 RawObject* CodePatcher::GetEdgeCounterAt(uword pc, const Code& code) { |
287 ASSERT(code.ContainsInstructionAt(pc)); | 287 ASSERT(code.ContainsInstructionAt(pc)); |
288 EdgeCounter counter(pc, code); | 288 EdgeCounter counter(pc, code); |
289 return counter.edge_counter(); | 289 return counter.edge_counter(); |
290 } | 290 } |
291 | 291 |
292 } // namespace dart | 292 } // namespace dart |
293 | 293 |
294 #endif // defined TARGET_ARCH_IA32 | 294 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |