| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 const Code& code, | 171 const Code& code, |
| 172 uword new_target) { | 172 uword new_target) { |
| 173 ASSERT(code.ContainsInstructionAt(return_address)); | 173 ASSERT(code.ContainsInstructionAt(return_address)); |
| 174 InstanceCall call(return_address); | 174 InstanceCall call(return_address); |
| 175 call.set_target(new_target); | 175 call.set_target(new_target); |
| 176 } | 176 } |
| 177 | 177 |
| 178 | 178 |
| 179 void CodePatcher::InsertCallAt(uword start, uword target) { | 179 void CodePatcher::InsertCallAt(uword start, uword target) { |
| 180 // The inserted call should not overlap the lazy deopt jump code. | 180 // The inserted call should not overlap the lazy deopt jump code. |
| 181 ASSERT(start + CallPattern::InstructionLength() <= target); | 181 ASSERT(start + CallPattern::pattern_length_in_bytes() <= target); |
| 182 *reinterpret_cast<uint8_t*>(start) = 0xE8; | 182 *reinterpret_cast<uint8_t*>(start) = 0xE8; |
| 183 CallPattern call(start); | 183 CallPattern call(start); |
| 184 call.SetTargetAddress(target); | 184 call.SetTargetAddress(target); |
| 185 CPU::FlushICache(start, CallPattern::InstructionLength()); | 185 CPU::FlushICache(start, CallPattern::pattern_length_in_bytes()); |
| 186 } | 186 } |
| 187 | 187 |
| 188 | 188 |
| 189 uword CodePatcher::GetInstanceCallAt( | 189 uword CodePatcher::GetInstanceCallAt( |
| 190 uword return_address, const Code& code, ICData* ic_data) { | 190 uword return_address, const Code& code, ICData* ic_data) { |
| 191 ASSERT(code.ContainsInstructionAt(return_address)); | 191 ASSERT(code.ContainsInstructionAt(return_address)); |
| 192 InstanceCall call(return_address); | 192 InstanceCall call(return_address); |
| 193 if (ic_data != NULL) { | 193 if (ic_data != NULL) { |
| 194 *ic_data ^= call.ic_data(); | 194 *ic_data ^= call.ic_data(); |
| 195 } | 195 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 | 239 |
| 240 RawObject* CodePatcher::GetEdgeCounterAt(uword pc, const Code& code) { | 240 RawObject* CodePatcher::GetEdgeCounterAt(uword pc, const Code& code) { |
| 241 ASSERT(code.ContainsInstructionAt(pc)); | 241 ASSERT(code.ContainsInstructionAt(pc)); |
| 242 EdgeCounter counter(pc, code); | 242 EdgeCounter counter(pc, code); |
| 243 return counter.edge_counter(); | 243 return counter.edge_counter(); |
| 244 } | 244 } |
| 245 | 245 |
| 246 } // namespace dart | 246 } // namespace dart |
| 247 | 247 |
| 248 #endif // defined TARGET_ARCH_IA32 | 248 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |