| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 const Code& code, | 170 const Code& code, |
| 171 const Code& new_target) { | 171 const Code& new_target) { |
| 172 const Instructions& instrs = Instructions::Handle(code.instructions()); | 172 const Instructions& instrs = Instructions::Handle(code.instructions()); |
| 173 WritableInstructionsScope writable(instrs.PayloadStart(), instrs.size()); | 173 WritableInstructionsScope writable(instrs.PayloadStart(), instrs.size()); |
| 174 ASSERT(code.ContainsInstructionAt(return_address)); | 174 ASSERT(code.ContainsInstructionAt(return_address)); |
| 175 StaticCall call(return_address); | 175 StaticCall call(return_address); |
| 176 call.set_target(new_target); | 176 call.set_target(new_target); |
| 177 } | 177 } |
| 178 | 178 |
| 179 | 179 |
| 180 void CodePatcher::InsertDeoptimizationCallAt(uword start) { | 180 void CodePatcher::InsertDeoptimizationCallAt(uword start, uword target) { |
| 181 UNREACHABLE(); | 181 // The inserted call should not overlap the lazy deopt jump code. |
| 182 ASSERT(start + CallPattern::pattern_length_in_bytes() <= target); |
| 183 *reinterpret_cast<uint8_t*>(start) = 0xE8; |
| 184 CallPattern call(start); |
| 185 call.SetTargetAddress(target); |
| 186 CPU::FlushICache(start, CallPattern::pattern_length_in_bytes()); |
| 182 } | 187 } |
| 183 | 188 |
| 184 | 189 |
| 185 RawCode* CodePatcher::GetInstanceCallAt( | 190 RawCode* CodePatcher::GetInstanceCallAt( |
| 186 uword return_address, const Code& code, ICData* ic_data) { | 191 uword return_address, const Code& code, ICData* ic_data) { |
| 187 ASSERT(code.ContainsInstructionAt(return_address)); | 192 ASSERT(code.ContainsInstructionAt(return_address)); |
| 188 InstanceCall call(return_address); | 193 InstanceCall call(return_address); |
| 189 if (ic_data != NULL) { | 194 if (ic_data != NULL) { |
| 190 *ic_data ^= call.ic_data(); | 195 *ic_data ^= call.ic_data(); |
| 191 } | 196 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 | 253 |
| 249 | 254 |
| 250 | 255 |
| 251 intptr_t CodePatcher::InstanceCallSizeInBytes() { | 256 intptr_t CodePatcher::InstanceCallSizeInBytes() { |
| 252 return InstanceCall::kPatternSize; | 257 return InstanceCall::kPatternSize; |
| 253 } | 258 } |
| 254 | 259 |
| 255 } // namespace dart | 260 } // namespace dart |
| 256 | 261 |
| 257 #endif // defined TARGET_ARCH_IA32 | 262 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |