| 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/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 // Save current Context pointer into Isolate structure. | 56 // Save current Context pointer into Isolate structure. |
| 57 __ movq(Address(RAX, Isolate::top_context_offset()), CTX); | 57 __ movq(Address(RAX, Isolate::top_context_offset()), CTX); |
| 58 | 58 |
| 59 // Cache Isolate pointer into CTX while executing runtime code. | 59 // Cache Isolate pointer into CTX while executing runtime code. |
| 60 __ movq(CTX, RAX); | 60 __ movq(CTX, RAX); |
| 61 | 61 |
| 62 #if defined(DEBUG) | 62 #if defined(DEBUG) |
| 63 { Label ok; | 63 { Label ok; |
| 64 // Check that we are always entering from Dart code. | 64 // Check that we are always entering from Dart code. |
| 65 __ movq(RAX, Immediate(VMTag::kScriptTagId)); | 65 __ movq(RAX, Immediate(VMTag::kDartTagId)); |
| 66 __ cmpq(RAX, Address(CTX, Isolate::vm_tag_offset())); | 66 __ cmpq(RAX, Address(CTX, Isolate::vm_tag_offset())); |
| 67 __ j(EQUAL, &ok, Assembler::kNearJump); | 67 __ j(EQUAL, &ok, Assembler::kNearJump); |
| 68 __ Stop("Not coming from Dart code."); | 68 __ Stop("Not coming from Dart code."); |
| 69 __ Bind(&ok); | 69 __ Bind(&ok); |
| 70 } | 70 } |
| 71 #endif | 71 #endif |
| 72 | 72 |
| 73 // Mark that the isolate is executing VM code. | 73 // Mark that the isolate is executing VM code. |
| 74 __ movq(Address(CTX, Isolate::vm_tag_offset()), RBX); | 74 __ movq(Address(CTX, Isolate::vm_tag_offset()), RBX); |
| 75 | 75 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 89 __ addq(RAX, Immediate(1 * kWordSize)); // Retval is next to 1st argument. | 89 __ addq(RAX, Immediate(1 * kWordSize)); // Retval is next to 1st argument. |
| 90 __ movq(Address(RSP, retval_offset), RAX); // Set retval in NativeArguments. | 90 __ movq(Address(RSP, retval_offset), RAX); // Set retval in NativeArguments. |
| 91 #if defined(_WIN64) | 91 #if defined(_WIN64) |
| 92 ASSERT(sizeof(NativeArguments) > CallingConventions::kRegisterTransferLimit); | 92 ASSERT(sizeof(NativeArguments) > CallingConventions::kRegisterTransferLimit); |
| 93 __ movq(CallingConventions::kArg1Reg, RSP); | 93 __ movq(CallingConventions::kArg1Reg, RSP); |
| 94 #endif | 94 #endif |
| 95 __ CallCFunction(RBX); | 95 __ CallCFunction(RBX); |
| 96 | 96 |
| 97 // Mark that the isolate is executing Dart code. | 97 // Mark that the isolate is executing Dart code. |
| 98 __ movq(Address(CTX, Isolate::vm_tag_offset()), | 98 __ movq(Address(CTX, Isolate::vm_tag_offset()), |
| 99 Immediate(VMTag::kScriptTagId)); | 99 Immediate(VMTag::kDartTagId)); |
| 100 | 100 |
| 101 // Reset exit frame information in Isolate structure. | 101 // Reset exit frame information in Isolate structure. |
| 102 __ movq(Address(CTX, Isolate::top_exit_frame_info_offset()), Immediate(0)); | 102 __ movq(Address(CTX, Isolate::top_exit_frame_info_offset()), Immediate(0)); |
| 103 | 103 |
| 104 // Load Context pointer from Isolate structure into RBX. | 104 // Load Context pointer from Isolate structure into RBX. |
| 105 __ movq(RBX, Address(CTX, Isolate::top_context_offset())); | 105 __ movq(RBX, Address(CTX, Isolate::top_context_offset())); |
| 106 | 106 |
| 107 // Reset Context pointer in Isolate structure. | 107 // Reset Context pointer in Isolate structure. |
| 108 __ LoadObject(R12, Object::null_object(), PP); | 108 __ LoadObject(R12, Object::null_object(), PP); |
| 109 __ movq(Address(CTX, Isolate::top_context_offset()), R12); | 109 __ movq(Address(CTX, Isolate::top_context_offset()), R12); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 167 |
| 168 // Save current Context pointer into Isolate structure. | 168 // Save current Context pointer into Isolate structure. |
| 169 __ movq(Address(R8, Isolate::top_context_offset()), CTX); | 169 __ movq(Address(R8, Isolate::top_context_offset()), CTX); |
| 170 | 170 |
| 171 // Cache Isolate pointer into CTX while executing native code. | 171 // Cache Isolate pointer into CTX while executing native code. |
| 172 __ movq(CTX, R8); | 172 __ movq(CTX, R8); |
| 173 | 173 |
| 174 #if defined(DEBUG) | 174 #if defined(DEBUG) |
| 175 { Label ok; | 175 { Label ok; |
| 176 // Check that we are always entering from Dart code. | 176 // Check that we are always entering from Dart code. |
| 177 __ movq(R8, Immediate(VMTag::kScriptTagId)); | 177 __ movq(R8, Immediate(VMTag::kDartTagId)); |
| 178 __ cmpq(R8, Address(CTX, Isolate::vm_tag_offset())); | 178 __ cmpq(R8, Address(CTX, Isolate::vm_tag_offset())); |
| 179 __ j(EQUAL, &ok, Assembler::kNearJump); | 179 __ j(EQUAL, &ok, Assembler::kNearJump); |
| 180 __ Stop("Not coming from Dart code."); | 180 __ Stop("Not coming from Dart code."); |
| 181 __ Bind(&ok); | 181 __ Bind(&ok); |
| 182 } | 182 } |
| 183 #endif | 183 #endif |
| 184 | 184 |
| 185 // Mark that the isolate is executing Native code. | 185 // Mark that the isolate is executing Native code. |
| 186 __ movq(Address(CTX, Isolate::vm_tag_offset()), RBX); | 186 __ movq(Address(CTX, Isolate::vm_tag_offset()), RBX); |
| 187 | 187 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 201 __ movq(Address(RSP, retval_offset), RAX); // Set retval in NativeArguments. | 201 __ movq(Address(RSP, retval_offset), RAX); // Set retval in NativeArguments. |
| 202 | 202 |
| 203 // Pass the pointer to the NativeArguments. | 203 // Pass the pointer to the NativeArguments. |
| 204 __ movq(CallingConventions::kArg1Reg, RSP); | 204 __ movq(CallingConventions::kArg1Reg, RSP); |
| 205 // Pass pointer to function entrypoint. | 205 // Pass pointer to function entrypoint. |
| 206 __ movq(CallingConventions::kArg2Reg, RBX); | 206 __ movq(CallingConventions::kArg2Reg, RBX); |
| 207 __ CallCFunction(&NativeEntry::NativeCallWrapperLabel()); | 207 __ CallCFunction(&NativeEntry::NativeCallWrapperLabel()); |
| 208 | 208 |
| 209 // Mark that the isolate is executing Dart code. | 209 // Mark that the isolate is executing Dart code. |
| 210 __ movq(Address(CTX, Isolate::vm_tag_offset()), | 210 __ movq(Address(CTX, Isolate::vm_tag_offset()), |
| 211 Immediate(VMTag::kScriptTagId)); | 211 Immediate(VMTag::kDartTagId)); |
| 212 | 212 |
| 213 // Reset exit frame information in Isolate structure. | 213 // Reset exit frame information in Isolate structure. |
| 214 __ movq(Address(CTX, Isolate::top_exit_frame_info_offset()), Immediate(0)); | 214 __ movq(Address(CTX, Isolate::top_exit_frame_info_offset()), Immediate(0)); |
| 215 | 215 |
| 216 // Load Context pointer from Isolate structure into R8. | 216 // Load Context pointer from Isolate structure into R8. |
| 217 __ movq(R8, Address(CTX, Isolate::top_context_offset())); | 217 __ movq(R8, Address(CTX, Isolate::top_context_offset())); |
| 218 | 218 |
| 219 // Reset Context pointer in Isolate structure. | 219 // Reset Context pointer in Isolate structure. |
| 220 __ LoadObject(R12, Object::null_object(), PP); | 220 __ LoadObject(R12, Object::null_object(), PP); |
| 221 __ movq(Address(CTX, Isolate::top_context_offset()), R12); | 221 __ movq(Address(CTX, Isolate::top_context_offset()), R12); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 | 256 |
| 257 // Save current Context pointer into Isolate structure. | 257 // Save current Context pointer into Isolate structure. |
| 258 __ movq(Address(R8, Isolate::top_context_offset()), CTX); | 258 __ movq(Address(R8, Isolate::top_context_offset()), CTX); |
| 259 | 259 |
| 260 // Cache Isolate pointer into CTX while executing native code. | 260 // Cache Isolate pointer into CTX while executing native code. |
| 261 __ movq(CTX, R8); | 261 __ movq(CTX, R8); |
| 262 | 262 |
| 263 #if defined(DEBUG) | 263 #if defined(DEBUG) |
| 264 { Label ok; | 264 { Label ok; |
| 265 // Check that we are always entering from Dart code. | 265 // Check that we are always entering from Dart code. |
| 266 __ movq(R8, Immediate(VMTag::kScriptTagId)); | 266 __ movq(R8, Immediate(VMTag::kDartTagId)); |
| 267 __ cmpq(R8, Address(CTX, Isolate::vm_tag_offset())); | 267 __ cmpq(R8, Address(CTX, Isolate::vm_tag_offset())); |
| 268 __ j(EQUAL, &ok, Assembler::kNearJump); | 268 __ j(EQUAL, &ok, Assembler::kNearJump); |
| 269 __ Stop("Not coming from Dart code."); | 269 __ Stop("Not coming from Dart code."); |
| 270 __ Bind(&ok); | 270 __ Bind(&ok); |
| 271 } | 271 } |
| 272 #endif | 272 #endif |
| 273 | 273 |
| 274 // Mark that the isolate is executing Native code. | 274 // Mark that the isolate is executing Native code. |
| 275 __ movq(Address(CTX, Isolate::vm_tag_offset()), RBX); | 275 __ movq(Address(CTX, Isolate::vm_tag_offset()), RBX); |
| 276 | 276 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 288 __ movq(Address(RSP, argv_offset), RAX); // Set argv in NativeArguments. | 288 __ movq(Address(RSP, argv_offset), RAX); // Set argv in NativeArguments. |
| 289 __ leaq(RAX, Address(RBP, 2 * kWordSize)); // Compute return value addr. | 289 __ leaq(RAX, Address(RBP, 2 * kWordSize)); // Compute return value addr. |
| 290 __ movq(Address(RSP, retval_offset), RAX); // Set retval in NativeArguments. | 290 __ movq(Address(RSP, retval_offset), RAX); // Set retval in NativeArguments. |
| 291 | 291 |
| 292 // Pass the pointer to the NativeArguments. | 292 // Pass the pointer to the NativeArguments. |
| 293 __ movq(CallingConventions::kArg1Reg, RSP); | 293 __ movq(CallingConventions::kArg1Reg, RSP); |
| 294 __ CallCFunction(RBX); | 294 __ CallCFunction(RBX); |
| 295 | 295 |
| 296 // Mark that the isolate is executing Dart code. | 296 // Mark that the isolate is executing Dart code. |
| 297 __ movq(Address(CTX, Isolate::vm_tag_offset()), | 297 __ movq(Address(CTX, Isolate::vm_tag_offset()), |
| 298 Immediate(VMTag::kScriptTagId)); | 298 Immediate(VMTag::kDartTagId)); |
| 299 | 299 |
| 300 // Reset exit frame information in Isolate structure. | 300 // Reset exit frame information in Isolate structure. |
| 301 __ movq(Address(CTX, Isolate::top_exit_frame_info_offset()), Immediate(0)); | 301 __ movq(Address(CTX, Isolate::top_exit_frame_info_offset()), Immediate(0)); |
| 302 | 302 |
| 303 // Load Context pointer from Isolate structure into R8. | 303 // Load Context pointer from Isolate structure into R8. |
| 304 __ movq(R8, Address(CTX, Isolate::top_context_offset())); | 304 __ movq(R8, Address(CTX, Isolate::top_context_offset())); |
| 305 | 305 |
| 306 // Reset Context pointer in Isolate structure. | 306 // Reset Context pointer in Isolate structure. |
| 307 __ LoadObject(R12, Object::null_object(), PP); | 307 __ LoadObject(R12, Object::null_object(), PP); |
| 308 __ movq(Address(CTX, Isolate::top_context_offset()), R12); | 308 __ movq(Address(CTX, Isolate::top_context_offset()), R12); |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 __ leaq(RAX, Address(RBP, kSavedVMTagSlotFromEntryFp * kWordSize)); | 743 __ leaq(RAX, Address(RBP, kSavedVMTagSlotFromEntryFp * kWordSize)); |
| 744 __ cmpq(RAX, RSP); | 744 __ cmpq(RAX, RSP); |
| 745 __ j(EQUAL, &ok); | 745 __ j(EQUAL, &ok); |
| 746 __ Stop("kSavedVMTagSlotFromEntryFp mismatch"); | 746 __ Stop("kSavedVMTagSlotFromEntryFp mismatch"); |
| 747 __ Bind(&ok); | 747 __ Bind(&ok); |
| 748 } | 748 } |
| 749 #endif | 749 #endif |
| 750 | 750 |
| 751 // Mark that the isolate is executing Dart code. | 751 // Mark that the isolate is executing Dart code. |
| 752 __ movq(Address(kIsolateReg, Isolate::vm_tag_offset()), | 752 __ movq(Address(kIsolateReg, Isolate::vm_tag_offset()), |
| 753 Immediate(VMTag::kScriptTagId)); | 753 Immediate(VMTag::kDartTagId)); |
| 754 | 754 |
| 755 // Save the top exit frame info. Use RAX as a temporary register. | 755 // Save the top exit frame info. Use RAX as a temporary register. |
| 756 // StackFrameIterator reads the top exit frame info saved in this frame. | 756 // StackFrameIterator reads the top exit frame info saved in this frame. |
| 757 // The constant kExitLinkSlotFromEntryFp must be kept in sync with the | 757 // The constant kExitLinkSlotFromEntryFp must be kept in sync with the |
| 758 // code below. | 758 // code below. |
| 759 __ movq(RAX, Address(kIsolateReg, Isolate::top_exit_frame_info_offset())); | 759 __ movq(RAX, Address(kIsolateReg, Isolate::top_exit_frame_info_offset())); |
| 760 __ pushq(RAX); | 760 __ pushq(RAX); |
| 761 #if defined(DEBUG) | 761 #if defined(DEBUG) |
| 762 { | 762 { |
| 763 Label ok; | 763 Label ok; |
| (...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1767 Register stacktrace_reg = CallingConventions::kArg5Reg; | 1767 Register stacktrace_reg = CallingConventions::kArg5Reg; |
| 1768 Register isolate_reg = CallingConventions::kArg6Reg; | 1768 Register isolate_reg = CallingConventions::kArg6Reg; |
| 1769 #endif | 1769 #endif |
| 1770 | 1770 |
| 1771 __ movq(RBP, CallingConventions::kArg3Reg); | 1771 __ movq(RBP, CallingConventions::kArg3Reg); |
| 1772 __ movq(RSP, CallingConventions::kArg2Reg); | 1772 __ movq(RSP, CallingConventions::kArg2Reg); |
| 1773 __ movq(kStackTraceObjectReg, stacktrace_reg); | 1773 __ movq(kStackTraceObjectReg, stacktrace_reg); |
| 1774 __ movq(kExceptionObjectReg, CallingConventions::kArg4Reg); | 1774 __ movq(kExceptionObjectReg, CallingConventions::kArg4Reg); |
| 1775 // Set the tag. | 1775 // Set the tag. |
| 1776 __ movq(Address(isolate_reg, Isolate::vm_tag_offset()), | 1776 __ movq(Address(isolate_reg, Isolate::vm_tag_offset()), |
| 1777 Immediate(VMTag::kScriptTagId)); | 1777 Immediate(VMTag::kDartTagId)); |
| 1778 // Clear top exit frame. | 1778 // Clear top exit frame. |
| 1779 __ movq(Address(isolate_reg, Isolate::top_exit_frame_info_offset()), | 1779 __ movq(Address(isolate_reg, Isolate::top_exit_frame_info_offset()), |
| 1780 Immediate(0)); | 1780 Immediate(0)); |
| 1781 __ jmp(CallingConventions::kArg1Reg); // Jump to the exception handler code. | 1781 __ jmp(CallingConventions::kArg1Reg); // Jump to the exception handler code. |
| 1782 } | 1782 } |
| 1783 | 1783 |
| 1784 | 1784 |
| 1785 // Calls to the runtime to optimize the given function. | 1785 // Calls to the runtime to optimize the given function. |
| 1786 // RDI: function to be reoptimized. | 1786 // RDI: function to be reoptimized. |
| 1787 // R10: argument descriptor (preserved). | 1787 // R10: argument descriptor (preserved). |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1910 | 1910 |
| 1911 __ movq(left, Address(RSP, 2 * kWordSize)); | 1911 __ movq(left, Address(RSP, 2 * kWordSize)); |
| 1912 __ movq(right, Address(RSP, 1 * kWordSize)); | 1912 __ movq(right, Address(RSP, 1 * kWordSize)); |
| 1913 GenerateIdenticalWithNumberCheckStub(assembler, left, right); | 1913 GenerateIdenticalWithNumberCheckStub(assembler, left, right); |
| 1914 __ ret(); | 1914 __ ret(); |
| 1915 } | 1915 } |
| 1916 | 1916 |
| 1917 } // namespace dart | 1917 } // namespace dart |
| 1918 | 1918 |
| 1919 #endif // defined TARGET_ARCH_X64 | 1919 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |