| 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" |
| 12 #include "vm/stub_code.h" | 13 #include "vm/stub_code.h" |
| 13 | 14 |
| 14 namespace dart { | 15 namespace dart { |
| 15 | 16 |
| 16 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message."); | 17 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message."); |
| 17 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"); |
| 18 DECLARE_FLAG(bool, inline_alloc); | 19 DECLARE_FLAG(bool, inline_alloc); |
| 19 | 20 |
| 20 | 21 |
| 21 bool CPUFeatures::sse4_1_supported_ = false; | 22 bool CPUFeatures::sse4_1_supported_ = false; |
| (...skipping 2250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2272 leave(); | 2273 leave(); |
| 2273 } | 2274 } |
| 2274 | 2275 |
| 2275 | 2276 |
| 2276 void Assembler::CallRuntime(const RuntimeEntry& entry) { | 2277 void Assembler::CallRuntime(const RuntimeEntry& entry) { |
| 2277 entry.Call(this); | 2278 entry.Call(this); |
| 2278 } | 2279 } |
| 2279 | 2280 |
| 2280 | 2281 |
| 2281 void Assembler::EnterDartFrame(intptr_t frame_size) { | 2282 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 // Adjust saved PC for any intrinsic code that could have been generated | 2287 // The runtime system assumes that the code marker address is |
| 2288 // before a frame is created. | 2288 // kEntryPointToPcMarkerOffset bytes from the entry. If there is any code |
| 2289 // generated before entering the frame, the address needs to be adjusted. |
| 2290 const intptr_t offset = kEntryPointToPcMarkerOffset - CodeSize(); |
| 2289 if (offset != 0) { | 2291 if (offset != 0) { |
| 2290 addq(Address(RSP, 0), Immediate(-offset)); | 2292 addq(Address(RSP, 0), Immediate(offset)); |
| 2291 } | 2293 } |
| 2292 if (frame_size != 0) { | 2294 if (frame_size != 0) { |
| 2293 subq(RSP, Immediate(frame_size)); | 2295 subq(RSP, Immediate(frame_size)); |
| 2294 } | 2296 } |
| 2295 } | 2297 } |
| 2296 | 2298 |
| 2297 | 2299 |
| 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 |
| 2298 void Assembler::EnterStubFrame() { | 2323 void Assembler::EnterStubFrame() { |
| 2299 EnterFrame(0); | 2324 EnterFrame(0); |
| 2300 pushq(Immediate(0)); // Push 0 in the saved PC area for stub frames. | 2325 pushq(Immediate(0)); // Push 0 in the saved PC area for stub frames. |
| 2301 } | 2326 } |
| 2302 | 2327 |
| 2303 | 2328 |
| 2304 void Assembler::TryAllocate(const Class& cls, | 2329 void Assembler::TryAllocate(const Class& cls, |
| 2305 Label* failure, | 2330 Label* failure, |
| 2306 bool near_jump, | 2331 bool near_jump, |
| 2307 Register instance_reg) { | 2332 Register instance_reg) { |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2520 | 2545 |
| 2521 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 2546 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
| 2522 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 2547 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); |
| 2523 return xmm_reg_names[reg]; | 2548 return xmm_reg_names[reg]; |
| 2524 } | 2549 } |
| 2525 | 2550 |
| 2526 | 2551 |
| 2527 } // namespace dart | 2552 } // namespace dart |
| 2528 | 2553 |
| 2529 #endif // defined TARGET_ARCH_X64 | 2554 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |