| 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" |
| (...skipping 2649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2660 } | 2660 } |
| 2661 } | 2661 } |
| 2662 | 2662 |
| 2663 | 2663 |
| 2664 void Assembler::LeaveFrame() { | 2664 void Assembler::LeaveFrame() { |
| 2665 movq(RSP, RBP); | 2665 movq(RSP, RBP); |
| 2666 popq(RBP); | 2666 popq(RBP); |
| 2667 } | 2667 } |
| 2668 | 2668 |
| 2669 | 2669 |
| 2670 void Assembler::LeaveFrameWithPP() { | |
| 2671 movq(PP, Address(RBP, -2 * kWordSize)); | |
| 2672 LeaveFrame(); | |
| 2673 } | |
| 2674 | |
| 2675 | |
| 2676 void Assembler::ReturnPatchable() { | 2670 void Assembler::ReturnPatchable() { |
| 2677 // This sequence must have a fixed size so that it can be patched by the | 2671 // This sequence must have a fixed size so that it can be patched by the |
| 2678 // debugger. | 2672 // debugger. |
| 2679 intptr_t start = buffer_.GetPosition(); | 2673 intptr_t start = buffer_.GetPosition(); |
| 2680 LeaveFrameWithPP(); | 2674 LeaveDartFrame(); |
| 2681 ret(); | 2675 ret(); |
| 2682 nop(4); | 2676 nop(4); |
| 2683 ASSERT((buffer_.GetPosition() - start) == 13); | 2677 ASSERT((buffer_.GetPosition() - start) == 13); |
| 2684 } | 2678 } |
| 2685 | 2679 |
| 2686 | 2680 |
| 2687 void Assembler::ReserveAlignedFrameSpace(intptr_t frame_space) { | 2681 void Assembler::ReserveAlignedFrameSpace(intptr_t frame_space) { |
| 2688 // Reserve space for arguments and align frame before entering | 2682 // Reserve space for arguments and align frame before entering |
| 2689 // the C++ world. | 2683 // the C++ world. |
| 2690 if (frame_space != 0) { | 2684 if (frame_space != 0) { |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2818 pushq(new_pc); | 2812 pushq(new_pc); |
| 2819 pushq(PP); | 2813 pushq(PP); |
| 2820 movq(PP, new_pp); | 2814 movq(PP, new_pp); |
| 2821 if (frame_size != 0) { | 2815 if (frame_size != 0) { |
| 2822 subq(RSP, Immediate(frame_size)); | 2816 subq(RSP, Immediate(frame_size)); |
| 2823 } | 2817 } |
| 2824 } | 2818 } |
| 2825 } | 2819 } |
| 2826 | 2820 |
| 2827 | 2821 |
| 2822 void Assembler::LeaveDartFrame() { |
| 2823 // Restore caller's PP register that was pushed in EnterDartFrame. |
| 2824 movq(PP, Address(RBP, (kSavedCallerPpSlotFromFp * kWordSize))); |
| 2825 LeaveFrame(); |
| 2826 } |
| 2827 |
| 2828 |
| 2828 // On entry to a function compiled for OSR, the caller's frame pointer, the | 2829 // On entry to a function compiled for OSR, the caller's frame pointer, the |
| 2829 // stack locals, and any copied parameters are already in place. The frame | 2830 // stack locals, and any copied parameters are already in place. The frame |
| 2830 // pointer is already set up. The PC marker is not correct for the | 2831 // pointer is already set up. The PC marker is not correct for the |
| 2831 // optimized function and there may be extra space for spill slots to | 2832 // optimized function and there may be extra space for spill slots to |
| 2832 // allocate. | 2833 // allocate. |
| 2833 void Assembler::EnterOsrFrame(intptr_t extra_size, | 2834 void Assembler::EnterOsrFrame(intptr_t extra_size, |
| 2834 Register new_pp, Register new_pc) { | 2835 Register new_pp, Register new_pc) { |
| 2835 if (new_pc == kNoRegister) { | 2836 if (new_pc == kNoRegister) { |
| 2836 Label dart_entry; | 2837 Label dart_entry; |
| 2837 call(&dart_entry); | 2838 call(&dart_entry); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2855 } else { | 2856 } else { |
| 2856 movq(Address(RBP, kPcMarkerSlotFromFp * kWordSize), new_pc); | 2857 movq(Address(RBP, kPcMarkerSlotFromFp * kWordSize), new_pc); |
| 2857 movq(PP, new_pp); | 2858 movq(PP, new_pp); |
| 2858 } | 2859 } |
| 2859 if (extra_size != 0) { | 2860 if (extra_size != 0) { |
| 2860 subq(RSP, Immediate(extra_size)); | 2861 subq(RSP, Immediate(extra_size)); |
| 2861 } | 2862 } |
| 2862 } | 2863 } |
| 2863 | 2864 |
| 2864 | 2865 |
| 2865 void Assembler::EnterStubFrame() { | 2866 void Assembler::EnterStubFrame(bool load_pp) { |
| 2866 EnterFrame(0); | 2867 EnterFrame(0); |
| 2867 pushq(Immediate(0)); // Push 0 in the saved PC area for stub frames. | 2868 pushq(Immediate(0)); // Push 0 in the saved PC area for stub frames. |
| 2869 pushq(PP); // Save caller's pool pointer |
| 2870 if (load_pp) { |
| 2871 LoadPoolPointer(PP); |
| 2872 } |
| 2868 } | 2873 } |
| 2869 | 2874 |
| 2870 | 2875 |
| 2871 void Assembler::EnterStubFrameWithPP() { | 2876 void Assembler::LeaveStubFrame() { |
| 2872 EnterFrame(0); | 2877 // Restore caller's PP register that was pushed in EnterStubFrame. |
| 2873 pushq(Immediate(0)); // Push 0 in the saved PC area for stub frames. | 2878 movq(PP, Address(RBP, (kSavedCallerPpSlotFromFp * kWordSize))); |
| 2874 pushq(PP); // Save caller's pool pointer | 2879 LeaveFrame(); |
| 2875 LoadPoolPointer(PP); | |
| 2876 } | 2880 } |
| 2877 | 2881 |
| 2878 | 2882 |
| 2879 void Assembler::TryAllocate(const Class& cls, | 2883 void Assembler::TryAllocate(const Class& cls, |
| 2880 Label* failure, | 2884 Label* failure, |
| 2881 bool near_jump, | 2885 bool near_jump, |
| 2882 Register instance_reg, | 2886 Register instance_reg, |
| 2883 Register pp) { | 2887 Register pp) { |
| 2884 ASSERT(failure != NULL); | 2888 ASSERT(failure != NULL); |
| 2885 if (FLAG_inline_alloc) { | 2889 if (FLAG_inline_alloc) { |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3096 | 3100 |
| 3097 | 3101 |
| 3098 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3102 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
| 3099 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 3103 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); |
| 3100 return xmm_reg_names[reg]; | 3104 return xmm_reg_names[reg]; |
| 3101 } | 3105 } |
| 3102 | 3106 |
| 3103 } // namespace dart | 3107 } // namespace dart |
| 3104 | 3108 |
| 3105 #endif // defined TARGET_ARCH_X64 | 3109 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |