| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 | 768 |
| 769 // Called when invoking Dart code from C++ (VM code). | 769 // Called when invoking Dart code from C++ (VM code). |
| 770 // Input parameters: | 770 // Input parameters: |
| 771 // LR : points to return address. | 771 // LR : points to return address. |
| 772 // R0 : entrypoint of the Dart function to call. | 772 // R0 : entrypoint of the Dart function to call. |
| 773 // R1 : arguments descriptor array. | 773 // R1 : arguments descriptor array. |
| 774 // R2 : arguments array. | 774 // R2 : arguments array. |
| 775 // R3 : new context containing the current isolate pointer. | 775 // R3 : new context containing the current isolate pointer. |
| 776 void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) { | 776 void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) { |
| 777 __ Comment("InvokeDartCodeStub"); | 777 __ Comment("InvokeDartCodeStub"); |
| 778 // Copy the C stack pointer (R31) into the stack pointer we'll actually use | |
| 779 // to access the stack. | |
| 780 __ mov(SP, CSP); | |
| 781 __ EnterFrame(0); | |
| 782 | |
| 783 // The new context, saved vm tag, the top exit frame, and the old context. | 778 // The new context, saved vm tag, the top exit frame, and the old context. |
| 784 const intptr_t kNewContextOffsetFromFp = | 779 const intptr_t kNewContextOffsetFromFp = |
| 785 -(1 + kAbiPreservedCpuRegCount + kAbiPreservedFpuRegCount) * kWordSize; | 780 -(1 + kAbiPreservedCpuRegCount + kAbiPreservedFpuRegCount) * kWordSize; |
| 786 | 781 |
| 782 // Amount of space to reserve with the system stack pointer before setting it |
| 783 // to the stack limit. |
| 784 const intptr_t kRegSaveSpace = Utils::RoundUp(-kNewContextOffsetFromFp, 16); |
| 785 |
| 786 // Copy the C stack pointer (R31) into the stack pointer we'll actually use |
| 787 // to access the stack. |
| 788 __ SetupDartSP(kRegSaveSpace); |
| 789 __ EnterFrame(0); |
| 790 |
| 787 // Save the callee-saved registers. | 791 // Save the callee-saved registers. |
| 788 for (int i = kAbiFirstPreservedCpuReg; i <= kAbiLastPreservedCpuReg; i++) { | 792 for (int i = kAbiFirstPreservedCpuReg; i <= kAbiLastPreservedCpuReg; i++) { |
| 789 const Register r = static_cast<Register>(i); | 793 const Register r = static_cast<Register>(i); |
| 790 // We use str instead of the Push macro because we will be pushing the PP | 794 // We use str instead of the Push macro because we will be pushing the PP |
| 791 // register when it is not holding a pool-pointer since we are coming from | 795 // register when it is not holding a pool-pointer since we are coming from |
| 792 // C++ code. | 796 // C++ code. |
| 793 __ str(r, Address(SP, -1 * kWordSize, Address::PreIndex)); | 797 __ str(r, Address(SP, -1 * kWordSize, Address::PreIndex)); |
| 794 } | 798 } |
| 795 | 799 |
| 796 // Save the bottom 64-bits of callee-saved V registers. | 800 // Save the bottom 64-bits of callee-saved V registers. |
| (...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1963 const Register right = R0; | 1967 const Register right = R0; |
| 1964 __ LoadFromOffset(left, SP, 1 * kWordSize, kNoPP); | 1968 __ LoadFromOffset(left, SP, 1 * kWordSize, kNoPP); |
| 1965 __ LoadFromOffset(right, SP, 0 * kWordSize, kNoPP); | 1969 __ LoadFromOffset(right, SP, 0 * kWordSize, kNoPP); |
| 1966 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 1970 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
| 1967 __ ret(); | 1971 __ ret(); |
| 1968 } | 1972 } |
| 1969 | 1973 |
| 1970 } // namespace dart | 1974 } // namespace dart |
| 1971 | 1975 |
| 1972 #endif // defined TARGET_ARCH_ARM64 | 1976 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |