| 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/cpu.h" | 9 #include "vm/cpu.h" |
| 10 #include "vm/heap.h" | 10 #include "vm/heap.h" |
| (...skipping 2881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2892 movq(PP, Address(RSP, 1 * kWordSize)); | 2892 movq(PP, Address(RSP, 1 * kWordSize)); |
| 2893 movq(PP, Address(PP, -object_pool_pc_dist - offset)); | 2893 movq(PP, Address(PP, -object_pool_pc_dist - offset)); |
| 2894 | 2894 |
| 2895 if (frame_size != 0) { | 2895 if (frame_size != 0) { |
| 2896 subq(RSP, Immediate(frame_size)); | 2896 subq(RSP, Immediate(frame_size)); |
| 2897 } | 2897 } |
| 2898 } | 2898 } |
| 2899 | 2899 |
| 2900 | 2900 |
| 2901 void Assembler::EnterDartFrameWithInfo(intptr_t frame_size, | 2901 void Assembler::EnterDartFrameWithInfo(intptr_t frame_size, |
| 2902 Register new_pp, Register new_pc) { | 2902 Register new_pp, |
| 2903 if (new_pc == kNoRegister) { | 2903 Register pc_marker_override) { |
| 2904 EnterDartFrame(0); | 2904 if (pc_marker_override == kNoRegister) { |
| 2905 EnterDartFrame(frame_size); |
| 2905 } else { | 2906 } else { |
| 2906 EnterFrame(0); | 2907 EnterFrame(0); |
| 2907 pushq(new_pc); | 2908 pushq(pc_marker_override); |
| 2908 pushq(PP); | 2909 pushq(PP); |
| 2909 movq(PP, new_pp); | 2910 movq(PP, new_pp); |
| 2910 if (frame_size != 0) { | 2911 if (frame_size != 0) { |
| 2911 subq(RSP, Immediate(frame_size)); | 2912 subq(RSP, Immediate(frame_size)); |
| 2912 } | 2913 } |
| 2913 } | 2914 } |
| 2914 } | 2915 } |
| 2915 | 2916 |
| 2916 | 2917 |
| 2917 void Assembler::LeaveDartFrame() { | 2918 void Assembler::LeaveDartFrame() { |
| 2918 // Restore caller's PP register that was pushed in EnterDartFrame. | 2919 // Restore caller's PP register that was pushed in EnterDartFrame. |
| 2919 movq(PP, Address(RBP, (kSavedCallerPpSlotFromFp * kWordSize))); | 2920 movq(PP, Address(RBP, (kSavedCallerPpSlotFromFp * kWordSize))); |
| 2920 LeaveFrame(); | 2921 LeaveFrame(); |
| 2921 } | 2922 } |
| 2922 | 2923 |
| 2923 | 2924 |
| 2924 // On entry to a function compiled for OSR, the caller's frame pointer, the | 2925 // On entry to a function compiled for OSR, the caller's frame pointer, the |
| 2925 // stack locals, and any copied parameters are already in place. The frame | 2926 // stack locals, and any copied parameters are already in place. The frame |
| 2926 // pointer is already set up. The PC marker is not correct for the | 2927 // pointer is already set up. The PC marker is not correct for the |
| 2927 // optimized function and there may be extra space for spill slots to | 2928 // optimized function and there may be extra space for spill slots to |
| 2928 // allocate. | 2929 // allocate. |
| 2929 void Assembler::EnterOsrFrame(intptr_t extra_size, | 2930 void Assembler::EnterOsrFrame(intptr_t extra_size, |
| 2930 Register new_pp, Register new_pc) { | 2931 Register new_pp, |
| 2931 if (new_pc == kNoRegister) { | 2932 Register pc_marker_override) { |
| 2933 if (pc_marker_override == kNoRegister) { |
| 2932 Label dart_entry; | 2934 Label dart_entry; |
| 2933 call(&dart_entry); | 2935 call(&dart_entry); |
| 2934 Bind(&dart_entry); | 2936 Bind(&dart_entry); |
| 2935 // The runtime system assumes that the code marker address is | 2937 // The runtime system assumes that the code marker address is |
| 2936 // kEntryPointToPcMarkerOffset bytes from the entry. Since there is no | 2938 // kEntryPointToPcMarkerOffset bytes from the entry. Since there is no |
| 2937 // code to set up the frame pointer, the address needs to be adjusted. | 2939 // code to set up the frame pointer, the address needs to be adjusted. |
| 2938 const intptr_t object_pool_pc_dist = | 2940 const intptr_t object_pool_pc_dist = |
| 2939 Instructions::HeaderSize() - Instructions::object_pool_offset() + | 2941 Instructions::HeaderSize() - Instructions::object_pool_offset() + |
| 2940 CodeSize(); | 2942 CodeSize(); |
| 2941 const intptr_t offset = kEntryPointToPcMarkerOffset - CodeSize(); | 2943 const intptr_t offset = kEntryPointToPcMarkerOffset - CodeSize(); |
| 2942 if (offset != 0) { | 2944 if (offset != 0) { |
| 2943 addq(Address(RSP, 0), Immediate(offset)); | 2945 addq(Address(RSP, 0), Immediate(offset)); |
| 2944 } | 2946 } |
| 2945 | 2947 |
| 2946 // Load callee's pool pointer. | 2948 // Load callee's pool pointer. |
| 2947 movq(PP, Address(RSP, 0)); | 2949 movq(PP, Address(RSP, 0)); |
| 2948 movq(PP, Address(PP, -object_pool_pc_dist - offset)); | 2950 movq(PP, Address(PP, -object_pool_pc_dist - offset)); |
| 2949 | 2951 |
| 2950 popq(Address(RBP, kPcMarkerSlotFromFp * kWordSize)); | 2952 popq(Address(RBP, kPcMarkerSlotFromFp * kWordSize)); |
| 2951 } else { | 2953 } else { |
| 2952 movq(Address(RBP, kPcMarkerSlotFromFp * kWordSize), new_pc); | 2954 movq(Address(RBP, kPcMarkerSlotFromFp * kWordSize), pc_marker_override); |
| 2953 movq(PP, new_pp); | 2955 movq(PP, new_pp); |
| 2954 } | 2956 } |
| 2955 if (extra_size != 0) { | 2957 if (extra_size != 0) { |
| 2956 subq(RSP, Immediate(extra_size)); | 2958 subq(RSP, Immediate(extra_size)); |
| 2957 } | 2959 } |
| 2958 } | 2960 } |
| 2959 | 2961 |
| 2960 | 2962 |
| 2961 void Assembler::EnterStubFrame(bool load_pp) { | 2963 void Assembler::EnterStubFrame(bool load_pp) { |
| 2962 EnterFrame(0); | 2964 EnterFrame(0); |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3264 | 3266 |
| 3265 | 3267 |
| 3266 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3268 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
| 3267 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 3269 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); |
| 3268 return xmm_reg_names[reg]; | 3270 return xmm_reg_names[reg]; |
| 3269 } | 3271 } |
| 3270 | 3272 |
| 3271 } // namespace dart | 3273 } // namespace dart |
| 3272 | 3274 |
| 3273 #endif // defined TARGET_ARCH_X64 | 3275 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |