| 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 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 // LR : points to return address. | 741 // LR : points to return address. |
| 742 // R0 : entrypoint of the Dart function to call. | 742 // R0 : entrypoint of the Dart function to call. |
| 743 // R1 : arguments descriptor array. | 743 // R1 : arguments descriptor array. |
| 744 // R2 : arguments array. | 744 // R2 : arguments array. |
| 745 // R3 : new context containing the current isolate pointer. | 745 // R3 : new context containing the current isolate pointer. |
| 746 void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) { | 746 void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) { |
| 747 __ Comment("InvokeDartCodeStub"); | 747 __ Comment("InvokeDartCodeStub"); |
| 748 __ EnterFrame(0); | 748 __ EnterFrame(0); |
| 749 | 749 |
| 750 // The new context, saved vm tag, the top exit frame, and the old context. | 750 // The new context, saved vm tag, the top exit frame, and the old context. |
| 751 // const intptr_t kPreservedContextSlots = 4; | |
| 752 const intptr_t kNewContextOffsetFromFp = | 751 const intptr_t kNewContextOffsetFromFp = |
| 753 -(1 + kAbiPreservedCpuRegCount + kAbiPreservedFpuRegCount) * kWordSize; | 752 -(1 + kAbiPreservedCpuRegCount + kAbiPreservedFpuRegCount) * kWordSize; |
| 754 // const intptr_t kPreservedRegSpace = | |
| 755 // kWordSize * (kAbiPreservedCpuRegCount + kPreservedContextSlots); | |
| 756 | 753 |
| 757 // Save the callee-saved registers. | 754 // Save the callee-saved registers. |
| 758 for (int i = kAbiFirstPreservedCpuReg; i <= kAbiLastPreservedCpuReg; i++) { | 755 for (int i = kAbiFirstPreservedCpuReg; i <= kAbiLastPreservedCpuReg; i++) { |
| 759 const Register r = static_cast<Register>(i); | 756 const Register r = static_cast<Register>(i); |
| 760 // We use str instead of the Push macro because we will be pushing the PP | 757 // We use str instead of the Push macro because we will be pushing the PP |
| 761 // register when it is not holding a pool-pointer since we are coming from | 758 // register when it is not holding a pool-pointer since we are coming from |
| 762 // C++ code. | 759 // C++ code. |
| 763 __ str(r, Address(SP, -1 * kWordSize, Address::PreIndex)); | 760 __ str(r, Address(SP, -1 * kWordSize, Address::PreIndex)); |
| 764 } | 761 } |
| 765 | 762 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 __ Pop(R6); | 866 __ Pop(R6); |
| 870 __ StoreToOffset(R4, CTX, Isolate::top_context_offset(), PP); | 867 __ StoreToOffset(R4, CTX, Isolate::top_context_offset(), PP); |
| 871 __ StoreToOffset(R6, CTX, Isolate::top_exit_frame_info_offset(), PP); | 868 __ StoreToOffset(R6, CTX, Isolate::top_exit_frame_info_offset(), PP); |
| 872 | 869 |
| 873 __ Pop(R3); | 870 __ Pop(R3); |
| 874 __ Pop(R4); | 871 __ Pop(R4); |
| 875 | 872 |
| 876 // Restore the bottom 64-bits of callee-saved V registers. | 873 // Restore the bottom 64-bits of callee-saved V registers. |
| 877 for (int i = kAbiLastPreservedFpuReg; i >= kAbiFirstPreservedFpuReg; i--) { | 874 for (int i = kAbiLastPreservedFpuReg; i >= kAbiFirstPreservedFpuReg; i--) { |
| 878 const VRegister r = static_cast<VRegister>(i); | 875 const VRegister r = static_cast<VRegister>(i); |
| 879 __ PushDouble(r); | 876 __ PopDouble(r); |
| 880 } | 877 } |
| 881 | 878 |
| 882 // Restore C++ ABI callee-saved registers. | 879 // Restore C++ ABI callee-saved registers. |
| 883 for (int i = kAbiLastPreservedCpuReg; i >= kAbiFirstPreservedCpuReg; i--) { | 880 for (int i = kAbiLastPreservedCpuReg; i >= kAbiFirstPreservedCpuReg; i--) { |
| 884 Register r = static_cast<Register>(i); | 881 Register r = static_cast<Register>(i); |
| 885 // We use ldr instead of the Pop macro because we will be popping the PP | 882 // We use ldr instead of the Pop macro because we will be popping the PP |
| 886 // register when it is not holding a pool-pointer since we are returning to | 883 // register when it is not holding a pool-pointer since we are returning to |
| 887 // C++ code. | 884 // C++ code. |
| 888 __ ldr(r, Address(SP, 1 * kWordSize, Address::PostIndex)); | 885 __ ldr(r, Address(SP, 1 * kWordSize, Address::PostIndex)); |
| 889 } | 886 } |
| (...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1916 const Register right = R0; | 1913 const Register right = R0; |
| 1917 __ LoadFromOffset(left, SP, 1 * kWordSize, kNoPP); | 1914 __ LoadFromOffset(left, SP, 1 * kWordSize, kNoPP); |
| 1918 __ LoadFromOffset(right, SP, 0 * kWordSize, kNoPP); | 1915 __ LoadFromOffset(right, SP, 0 * kWordSize, kNoPP); |
| 1919 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 1916 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
| 1920 __ ret(); | 1917 __ ret(); |
| 1921 } | 1918 } |
| 1922 | 1919 |
| 1923 } // namespace dart | 1920 } // namespace dart |
| 1924 | 1921 |
| 1925 #endif // defined TARGET_ARCH_ARM64 | 1922 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |