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, uword target) { | 180 void CodePatcher::InsertDeoptimizationCallAt(uword start) { |
181 // The inserted call should not overlap the lazy deopt jump code. | 181 UNREACHABLE(); |
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()); | |
187 } | 182 } |
188 | 183 |
189 | 184 |
190 RawCode* CodePatcher::GetInstanceCallAt( | 185 RawCode* CodePatcher::GetInstanceCallAt( |
191 uword return_address, const Code& code, ICData* ic_data) { | 186 uword return_address, const Code& code, ICData* ic_data) { |
192 ASSERT(code.ContainsInstructionAt(return_address)); | 187 ASSERT(code.ContainsInstructionAt(return_address)); |
193 InstanceCall call(return_address); | 188 InstanceCall call(return_address); |
194 if (ic_data != NULL) { | 189 if (ic_data != NULL) { |
195 *ic_data ^= call.ic_data(); | 190 *ic_data ^= call.ic_data(); |
196 } | 191 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 248 |
254 | 249 |
255 | 250 |
256 intptr_t CodePatcher::InstanceCallSizeInBytes() { | 251 intptr_t CodePatcher::InstanceCallSizeInBytes() { |
257 return InstanceCall::kPatternSize; | 252 return InstanceCall::kPatternSize; |
258 } | 253 } |
259 | 254 |
260 } // namespace dart | 255 } // namespace dart |
261 | 256 |
262 #endif // defined TARGET_ARCH_IA32 | 257 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |