| 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_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/heap.h" | 9 #include "vm/heap.h" |
| 10 #include "vm/memory_region.h" | 10 #include "vm/memory_region.h" |
| 11 #include "vm/runtime_entry.h" | 11 #include "vm/runtime_entry.h" |
| 12 #include "vm/stack_frame.h" | |
| 13 #include "vm/stub_code.h" | 12 #include "vm/stub_code.h" |
| 14 | 13 |
| 15 namespace dart { | 14 namespace dart { |
| 16 | 15 |
| 17 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message."); | 16 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message."); |
| 18 DEFINE_FLAG(bool, use_sse41, true, "Use SSE 4.1 if available"); | 17 DEFINE_FLAG(bool, use_sse41, true, "Use SSE 4.1 if available"); |
| 19 DECLARE_FLAG(bool, inline_alloc); | 18 DECLARE_FLAG(bool, inline_alloc); |
| 20 | 19 |
| 21 | 20 |
| 22 bool CPUFeatures::sse4_1_supported_ = false; | 21 bool CPUFeatures::sse4_1_supported_ = false; |
| (...skipping 2250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2273 leave(); | 2272 leave(); |
| 2274 } | 2273 } |
| 2275 | 2274 |
| 2276 | 2275 |
| 2277 void Assembler::CallRuntime(const RuntimeEntry& entry) { | 2276 void Assembler::CallRuntime(const RuntimeEntry& entry) { |
| 2278 entry.Call(this); | 2277 entry.Call(this); |
| 2279 } | 2278 } |
| 2280 | 2279 |
| 2281 | 2280 |
| 2282 void Assembler::EnterDartFrame(intptr_t frame_size) { | 2281 void Assembler::EnterDartFrame(intptr_t frame_size) { |
| 2282 const intptr_t offset = CodeSize(); |
| 2283 EnterFrame(0); | 2283 EnterFrame(0); |
| 2284 Label dart_entry; | 2284 Label dart_entry; |
| 2285 call(&dart_entry); | 2285 call(&dart_entry); |
| 2286 Bind(&dart_entry); | 2286 Bind(&dart_entry); |
| 2287 // The runtime system assumes that the code marker address is | 2287 // Adjust saved PC for any intrinsic code that could have been generated |
| 2288 // kEntryPointToPcMarkerOffset bytes from the entry. If there is any code | 2288 // before a frame is created. |
| 2289 // generated before entering the frame, the address needs to be adjusted. | |
| 2290 const intptr_t offset = kEntryPointToPcMarkerOffset - CodeSize(); | |
| 2291 if (offset != 0) { | 2289 if (offset != 0) { |
| 2292 addq(Address(RSP, 0), Immediate(offset)); | 2290 addq(Address(RSP, 0), Immediate(-offset)); |
| 2293 } | 2291 } |
| 2294 if (frame_size != 0) { | 2292 if (frame_size != 0) { |
| 2295 subq(RSP, Immediate(frame_size)); | 2293 subq(RSP, Immediate(frame_size)); |
| 2296 } | 2294 } |
| 2297 } | 2295 } |
| 2298 | 2296 |
| 2299 | 2297 |
| 2300 // On entry to a function compiled for OSR, the caller's frame pointer, the | |
| 2301 // stack locals, and any copied parameters are already in place. The frame | |
| 2302 // pointer is already set up. The PC marker is not correct for the | |
| 2303 // optimized function and there may be extra space for spill slots to | |
| 2304 // allocate. | |
| 2305 void Assembler::EnterOsrFrame(intptr_t extra_size) { | |
| 2306 Label dart_entry; | |
| 2307 call(&dart_entry); | |
| 2308 Bind(&dart_entry); | |
| 2309 // The runtime system assumes that the code marker address is | |
| 2310 // kEntryPointToPcMarkerOffset bytes from the entry. Since there is no | |
| 2311 // code to set up the frame pointer, the address needs to be adjusted. | |
| 2312 const intptr_t offset = kEntryPointToPcMarkerOffset - CodeSize(); | |
| 2313 if (offset != 0) { | |
| 2314 addq(Address(RSP, 0), Immediate(offset)); | |
| 2315 } | |
| 2316 popq(Address(RBP, kPcMarkerSlotFromFp * kWordSize)); | |
| 2317 if (extra_size != 0) { | |
| 2318 subq(RSP, Immediate(extra_size)); | |
| 2319 } | |
| 2320 } | |
| 2321 | |
| 2322 | |
| 2323 void Assembler::EnterStubFrame() { | 2298 void Assembler::EnterStubFrame() { |
| 2324 EnterFrame(0); | 2299 EnterFrame(0); |
| 2325 pushq(Immediate(0)); // Push 0 in the saved PC area for stub frames. | 2300 pushq(Immediate(0)); // Push 0 in the saved PC area for stub frames. |
| 2326 } | 2301 } |
| 2327 | 2302 |
| 2328 | 2303 |
| 2329 void Assembler::TryAllocate(const Class& cls, | 2304 void Assembler::TryAllocate(const Class& cls, |
| 2330 Label* failure, | 2305 Label* failure, |
| 2331 bool near_jump, | 2306 bool near_jump, |
| 2332 Register instance_reg) { | 2307 Register instance_reg) { |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2545 | 2520 |
| 2546 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 2521 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
| 2547 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 2522 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); |
| 2548 return xmm_reg_names[reg]; | 2523 return xmm_reg_names[reg]; |
| 2549 } | 2524 } |
| 2550 | 2525 |
| 2551 | 2526 |
| 2552 } // namespace dart | 2527 } // namespace dart |
| 2553 | 2528 |
| 2554 #endif // defined TARGET_ARCH_X64 | 2529 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |