| 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 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 const Register kNewContextReg = CallingConventions::kArg4Reg; | 740 const Register kNewContextReg = CallingConventions::kArg4Reg; |
| 741 | 741 |
| 742 // At this point, the stack looks like: | 742 // At this point, the stack looks like: |
| 743 // | saved RBP | <-- RBP | 743 // | saved RBP | <-- RBP |
| 744 // | saved PC (return to DartEntry::InvokeFunction) | | 744 // | saved PC (return to DartEntry::InvokeFunction) | |
| 745 | 745 |
| 746 const intptr_t kInitialOffset = 1; | 746 const intptr_t kInitialOffset = 1; |
| 747 // Save arguments descriptor array and new context. | 747 // Save arguments descriptor array and new context. |
| 748 const intptr_t kArgumentsDescOffset = -(kInitialOffset) * kWordSize; | 748 const intptr_t kArgumentsDescOffset = -(kInitialOffset) * kWordSize; |
| 749 __ pushq(kArgDescReg); | 749 __ pushq(kArgDescReg); |
| 750 const intptr_t kNewContextOffset = -(kInitialOffset + 1) * kWordSize; | |
| 751 __ pushq(kNewContextReg); | 750 __ pushq(kNewContextReg); |
| 752 | 751 |
| 753 // Save C++ ABI callee-saved registers. | 752 // Save C++ ABI callee-saved registers. |
| 754 __ PushRegisters(CallingConventions::kCalleeSaveCpuRegisters, | 753 __ PushRegisters(CallingConventions::kCalleeSaveCpuRegisters, |
| 755 CallingConventions::kCalleeSaveXmmRegisters); | 754 CallingConventions::kCalleeSaveXmmRegisters); |
| 756 | 755 |
| 757 // We now load the pool pointer(PP) as we are about to invoke dart code and we | 756 // We now load the pool pointer(PP) as we are about to invoke dart code and we |
| 758 // could potentially invoke some intrinsic functions which need the PP to be | 757 // could potentially invoke some intrinsic functions which need the PP to be |
| 759 // set up. | 758 // set up. |
| 760 __ LoadPoolPointer(PP); | 759 __ LoadPoolPointer(PP); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 __ Bind(&push_arguments); | 857 __ Bind(&push_arguments); |
| 859 __ pushq(Address(RDX, RAX, TIMES_8, 0)); | 858 __ pushq(Address(RDX, RAX, TIMES_8, 0)); |
| 860 __ incq(RAX); | 859 __ incq(RAX); |
| 861 __ cmpq(RAX, RBX); | 860 __ cmpq(RAX, RBX); |
| 862 __ j(LESS, &push_arguments, Assembler::kNearJump); | 861 __ j(LESS, &push_arguments, Assembler::kNearJump); |
| 863 __ Bind(&done_push_arguments); | 862 __ Bind(&done_push_arguments); |
| 864 | 863 |
| 865 // Call the Dart code entrypoint. | 864 // Call the Dart code entrypoint. |
| 866 __ call(kEntryPointReg); // R10 is the arguments descriptor array. | 865 __ call(kEntryPointReg); // R10 is the arguments descriptor array. |
| 867 | 866 |
| 868 // Restore CTX from the saved context handle. | |
| 869 __ movq(CTX, Address(RBP, kNewContextOffset)); | |
| 870 __ movq(CTX, Address(CTX, VMHandles::kOffsetOfRawPtrInHandle)); | |
| 871 | |
| 872 // Read the saved arguments descriptor array to obtain the number of passed | 867 // Read the saved arguments descriptor array to obtain the number of passed |
| 873 // arguments. | 868 // arguments. |
| 874 __ movq(kArgDescReg, Address(RBP, kArgumentsDescOffset)); | 869 __ movq(kArgDescReg, Address(RBP, kArgumentsDescOffset)); |
| 875 __ movq(R10, Address(kArgDescReg, VMHandles::kOffsetOfRawPtrInHandle)); | 870 __ movq(R10, Address(kArgDescReg, VMHandles::kOffsetOfRawPtrInHandle)); |
| 876 __ movq(RDX, FieldAddress(R10, ArgumentsDescriptor::count_offset())); | 871 __ movq(RDX, FieldAddress(R10, ArgumentsDescriptor::count_offset())); |
| 877 // Get rid of arguments pushed on the stack. | 872 // Get rid of arguments pushed on the stack. |
| 878 __ leaq(RSP, Address(RSP, RDX, TIMES_4, 0)); // RDX is a Smi. | 873 __ leaq(RSP, Address(RSP, RDX, TIMES_4, 0)); // RDX is a Smi. |
| 879 | 874 |
| 880 __ LoadIsolate(kIsolateReg); | 875 __ LoadIsolate(kIsolateReg); |
| 881 // Restore the saved Context pointer into the Isolate structure. | 876 // Restore the saved Context pointer into the Isolate structure. |
| (...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2045 | 2040 |
| 2046 __ movq(left, Address(RSP, 2 * kWordSize)); | 2041 __ movq(left, Address(RSP, 2 * kWordSize)); |
| 2047 __ movq(right, Address(RSP, 1 * kWordSize)); | 2042 __ movq(right, Address(RSP, 1 * kWordSize)); |
| 2048 GenerateIdenticalWithNumberCheckStub(assembler, left, right); | 2043 GenerateIdenticalWithNumberCheckStub(assembler, left, right); |
| 2049 __ ret(); | 2044 __ ret(); |
| 2050 } | 2045 } |
| 2051 | 2046 |
| 2052 } // namespace dart | 2047 } // namespace dart |
| 2053 | 2048 |
| 2054 #endif // defined TARGET_ARCH_X64 | 2049 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |