| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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" | 5 #include "vm/globals.h" |
| 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_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/heap.h" | 10 #include "vm/heap.h" |
| 11 #include "vm/memory_region.h" | 11 #include "vm/memory_region.h" |
| 12 #include "vm/runtime_entry.h" | 12 #include "vm/runtime_entry.h" |
| 13 #include "vm/stack_frame.h" | |
| 14 #include "vm/stub_code.h" | 13 #include "vm/stub_code.h" |
| 15 | 14 |
| 16 namespace dart { | 15 namespace dart { |
| 17 | 16 |
| 18 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message."); | 17 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message."); |
| 19 DEFINE_FLAG(bool, use_sse41, true, "Use SSE 4.1 if available"); | 18 DEFINE_FLAG(bool, use_sse41, true, "Use SSE 4.1 if available"); |
| 20 DECLARE_FLAG(bool, inline_alloc); | 19 DECLARE_FLAG(bool, inline_alloc); |
| 21 | 20 |
| 22 | 21 |
| 23 bool CPUFeatures::sse2_supported_ = false; | 22 bool CPUFeatures::sse2_supported_ = false; |
| (...skipping 2158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2182 ASSERT(cls.id() != kIllegalCid); | 2181 ASSERT(cls.id() != kIllegalCid); |
| 2183 tags = RawObject::ClassIdTag::update(cls.id(), tags); | 2182 tags = RawObject::ClassIdTag::update(cls.id(), tags); |
| 2184 movl(FieldAddress(instance_reg, Object::tags_offset()), Immediate(tags)); | 2183 movl(FieldAddress(instance_reg, Object::tags_offset()), Immediate(tags)); |
| 2185 } else { | 2184 } else { |
| 2186 jmp(failure); | 2185 jmp(failure); |
| 2187 } | 2186 } |
| 2188 } | 2187 } |
| 2189 | 2188 |
| 2190 | 2189 |
| 2191 void Assembler::EnterDartFrame(intptr_t frame_size) { | 2190 void Assembler::EnterDartFrame(intptr_t frame_size) { |
| 2191 const intptr_t offset = CodeSize(); |
| 2192 EnterFrame(0); | 2192 EnterFrame(0); |
| 2193 Label dart_entry; | 2193 Label dart_entry; |
| 2194 call(&dart_entry); | 2194 call(&dart_entry); |
| 2195 Bind(&dart_entry); | 2195 Bind(&dart_entry); |
| 2196 // The runtime system assumes that the code marker address is | 2196 // Adjust saved PC for any intrinsic code that could have been generated |
| 2197 // kEntryPointToPcMarkerOffset bytes from the entry. If there is any code | 2197 // before a frame is created. |
| 2198 // generated before entering the frame, the address needs to be adjusted. | |
| 2199 const intptr_t offset = kEntryPointToPcMarkerOffset - CodeSize(); | |
| 2200 if (offset != 0) { | 2198 if (offset != 0) { |
| 2201 addl(Address(ESP, 0), Immediate(offset)); | 2199 addl(Address(ESP, 0), Immediate(-offset)); |
| 2202 } | 2200 } |
| 2203 if (frame_size != 0) { | 2201 if (frame_size != 0) { |
| 2204 subl(ESP, Immediate(frame_size)); | 2202 subl(ESP, Immediate(frame_size)); |
| 2205 } | 2203 } |
| 2206 } | 2204 } |
| 2207 | 2205 |
| 2208 | 2206 |
| 2209 // On entry to a function compiled for OSR, the caller's frame pointer, the | |
| 2210 // stack locals, and any copied parameters are already in place. The frame | |
| 2211 // pointer is already set up. The PC marker is not correct for the | |
| 2212 // optimized function and there may be extra space for spill slots to | |
| 2213 // allocate. | |
| 2214 void Assembler::EnterOsrFrame(intptr_t extra_size) { | |
| 2215 Label dart_entry; | |
| 2216 call(&dart_entry); | |
| 2217 Bind(&dart_entry); | |
| 2218 // The runtime system assumes that the code marker address is | |
| 2219 // kEntryPointToPcMarkerOffset bytes from the entry. Since there is no | |
| 2220 // code to set up the frame pointer, the address needs to be adjusted. | |
| 2221 const intptr_t offset = kEntryPointToPcMarkerOffset - CodeSize(); | |
| 2222 if (offset != 0) { | |
| 2223 addl(Address(ESP, 0), Immediate(offset)); | |
| 2224 } | |
| 2225 popl(Address(EBP, kPcMarkerSlotFromFp * kWordSize)); | |
| 2226 if (extra_size != 0) { | |
| 2227 subl(ESP, Immediate(extra_size)); | |
| 2228 } | |
| 2229 } | |
| 2230 | |
| 2231 | |
| 2232 void Assembler::EnterStubFrame() { | 2207 void Assembler::EnterStubFrame() { |
| 2233 EnterFrame(0); | 2208 EnterFrame(0); |
| 2234 pushl(Immediate(0)); // Push 0 in the saved PC area for stub frames. | 2209 pushl(Immediate(0)); // Push 0 in the saved PC area for stub frames. |
| 2235 } | 2210 } |
| 2236 | 2211 |
| 2237 | 2212 |
| 2238 void Assembler::Stop(const char* message) { | 2213 void Assembler::Stop(const char* message) { |
| 2239 if (FLAG_print_stop_message) { | 2214 if (FLAG_print_stop_message) { |
| 2240 pushl(EAX); // Preserve EAX. | 2215 pushl(EAX); // Preserve EAX. |
| 2241 movl(EAX, Immediate(reinterpret_cast<int32_t>(message))); | 2216 movl(EAX, Immediate(reinterpret_cast<int32_t>(message))); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2402 | 2377 |
| 2403 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 2378 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
| 2404 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 2379 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); |
| 2405 return xmm_reg_names[reg]; | 2380 return xmm_reg_names[reg]; |
| 2406 } | 2381 } |
| 2407 | 2382 |
| 2408 | 2383 |
| 2409 } // namespace dart | 2384 } // namespace dart |
| 2410 | 2385 |
| 2411 #endif // defined TARGET_ARCH_IA32 | 2386 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |