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_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
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 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
904 // A1 : arguments descriptor array. | 904 // A1 : arguments descriptor array. |
905 // A2 : arguments array. | 905 // A2 : arguments array. |
906 // A3 : new context containing the current isolate pointer. | 906 // A3 : new context containing the current isolate pointer. |
907 void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) { | 907 void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) { |
908 // Save frame pointer coming in. | 908 // Save frame pointer coming in. |
909 __ TraceSimMsg("InvokeDartCodeStub"); | 909 __ TraceSimMsg("InvokeDartCodeStub"); |
910 __ EnterStubFrame(); | 910 __ EnterStubFrame(); |
911 | 911 |
912 // Save new context and C++ ABI callee-saved registers. | 912 // Save new context and C++ ABI callee-saved registers. |
913 const intptr_t kNewContextOffset = | 913 const intptr_t kNewContextOffset = |
914 -(1 + kAbiPreservedCpuRegCount) * kWordSize; | 914 -(1 + kAbiPreservedCpuRegCount + kAbiPreservedFpuRegCount) * kWordSize; |
915 const intptr_t kPreservedRegSpace = | |
916 (kAbiPreservedCpuRegCount + kAbiPreservedFpuRegCount + 3) * kWordSize; | |
regis
2013/08/30 01:53:39
What are these 3 registers you save? 1 is the new
zra
2013/09/03 15:09:11
Done.
| |
915 | 917 |
916 __ addiu(SP, SP, Immediate(-(3 + kAbiPreservedCpuRegCount) * kWordSize)); | 918 __ addiu(SP, SP, Immediate(-kPreservedRegSpace)); |
917 for (int i = S0; i <= S7; i++) { | 919 for (int i = S0; i <= S7; i++) { |
918 Register r = static_cast<Register>(i); | 920 Register r = static_cast<Register>(i); |
919 __ sw(r, Address(SP, (i - S0 + 3) * kWordSize)); | 921 __ sw(r, Address(SP, (i - S0 + 3) * kWordSize)); |
920 } | 922 } |
923 | |
924 for (intptr_t i = F20; i <= F31; i++) { | |
925 FRegister r = static_cast<FRegister>(i); | |
926 __ swc1(r, | |
927 Address(SP, (kAbiPreservedCpuRegCount + 3 + i - F20) * kWordSize)); | |
928 } | |
929 | |
921 __ sw(A3, Address(SP, 2 * kWordSize)); | 930 __ sw(A3, Address(SP, 2 * kWordSize)); |
922 | 931 |
923 // The new Context structure contains a pointer to the current Isolate | 932 // The new Context structure contains a pointer to the current Isolate |
924 // structure. Cache the Context pointer in the CTX register so that it is | 933 // structure. Cache the Context pointer in the CTX register so that it is |
925 // available in generated code and calls to Isolate::Current() need not be | 934 // available in generated code and calls to Isolate::Current() need not be |
926 // done. The assumption is that this register will never be clobbered by | 935 // done. The assumption is that this register will never be clobbered by |
927 // compiled or runtime stub code. | 936 // compiled or runtime stub code. |
928 | 937 |
929 // Cache the new Context pointer into CTX while executing Dart code. | 938 // Cache the new Context pointer into CTX while executing Dart code. |
930 __ lw(CTX, Address(A3, VMHandles::kOffsetOfRawPtrInHandle)); | 939 __ lw(CTX, Address(A3, VMHandles::kOffsetOfRawPtrInHandle)); |
931 | 940 |
932 // Load Isolate pointer from Context structure into temporary register R8. | 941 // Load Isolate pointer from Context structure into temporary register R8. |
933 __ lw(T2, FieldAddress(CTX, Context::isolate_offset())); | 942 __ lw(T2, FieldAddress(CTX, Context::isolate_offset())); |
934 | 943 |
935 // Save the top exit frame info. Use T0 as a temporary register. | 944 // Save the top exit frame info. Use T0 as a temporary register. |
936 // StackFrameIterator reads the top exit frame info saved in this frame. | 945 // StackFrameIterator reads the top exit frame info saved in this frame. |
937 __ lw(T0, Address(T2, Isolate::top_exit_frame_info_offset())); | 946 __ lw(T0, Address(T2, Isolate::top_exit_frame_info_offset())); |
938 __ sw(ZR, Address(T2, Isolate::top_exit_frame_info_offset())); | 947 __ sw(ZR, Address(T2, Isolate::top_exit_frame_info_offset())); |
939 | 948 |
940 // Save the old Context pointer. Use T1 as a temporary register. | 949 // Save the old Context pointer. Use T1 as a temporary register. |
941 // Note that VisitObjectPointers will find this saved Context pointer during | 950 // Note that VisitObjectPointers will find this saved Context pointer during |
942 // GC marking, since it traverses any information between SP and | 951 // GC marking, since it traverses any information between SP and |
943 // FP - kExitLinkSlotFromEntryFp. | 952 // FP - kExitLinkSlotFromEntryFp. |
944 // EntryFrame::SavedContext reads the context saved in this frame. | 953 // EntryFrame::SavedContext reads the context saved in this frame. |
945 __ lw(T1, Address(T2, Isolate::top_context_offset())); | 954 __ lw(T1, Address(T2, Isolate::top_context_offset())); |
946 | 955 |
947 // The constants kSavedContextSlotFromEntryFp and | 956 // The constants kSavedContextSlotFromEntryFp and |
948 // kExitLinkSlotFromEntryFp must be kept in sync with the code below. | 957 // kExitLinkSlotFromEntryFp must be kept in sync with the code below. |
949 ASSERT(kExitLinkSlotFromEntryFp == -10); | 958 ASSERT(kExitLinkSlotFromEntryFp == -22); |
950 ASSERT(kSavedContextSlotFromEntryFp == -11); | 959 ASSERT(kSavedContextSlotFromEntryFp == -23); |
951 __ sw(T0, Address(SP, 1 * kWordSize)); | 960 __ sw(T0, Address(SP, 1 * kWordSize)); |
952 __ sw(T1, Address(SP, 0 * kWordSize)); | 961 __ sw(T1, Address(SP, 0 * kWordSize)); |
953 | 962 |
954 // After the call, The stack pointer is restored to this location. | 963 // After the call, The stack pointer is restored to this location. |
955 // Pushed A3, S0-7, T0, T1 = 11. | 964 // Pushed A3, S0-7, F20-31, T0, T1 = 23. |
956 | 965 |
957 // Load arguments descriptor array into S4, which is passed to Dart code. | 966 // Load arguments descriptor array into S4, which is passed to Dart code. |
958 __ lw(S4, Address(A1, VMHandles::kOffsetOfRawPtrInHandle)); | 967 __ lw(S4, Address(A1, VMHandles::kOffsetOfRawPtrInHandle)); |
959 | 968 |
960 // Load number of arguments into S5. | 969 // Load number of arguments into S5. |
961 __ lw(T1, FieldAddress(S4, ArgumentsDescriptor::count_offset())); | 970 __ lw(T1, FieldAddress(S4, ArgumentsDescriptor::count_offset())); |
962 __ SmiUntag(T1); | 971 __ SmiUntag(T1); |
963 | 972 |
964 // Compute address of 'arguments array' data area into A2. | 973 // Compute address of 'arguments array' data area into A2. |
965 __ lw(A2, Address(A2, VMHandles::kOffsetOfRawPtrInHandle)); | 974 __ lw(A2, Address(A2, VMHandles::kOffsetOfRawPtrInHandle)); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1001 __ lw(T1, Address(SP, 0 * kWordSize)); | 1010 __ lw(T1, Address(SP, 0 * kWordSize)); |
1002 __ lw(T0, Address(SP, 1 * kWordSize)); | 1011 __ lw(T0, Address(SP, 1 * kWordSize)); |
1003 __ sw(T1, Address(CTX, Isolate::top_context_offset())); | 1012 __ sw(T1, Address(CTX, Isolate::top_context_offset())); |
1004 __ sw(T0, Address(CTX, Isolate::top_exit_frame_info_offset())); | 1013 __ sw(T0, Address(CTX, Isolate::top_exit_frame_info_offset())); |
1005 | 1014 |
1006 // Restore C++ ABI callee-saved registers. | 1015 // Restore C++ ABI callee-saved registers. |
1007 for (int i = S0; i <= S7; i++) { | 1016 for (int i = S0; i <= S7; i++) { |
1008 Register r = static_cast<Register>(i); | 1017 Register r = static_cast<Register>(i); |
1009 __ lw(r, Address(SP, (i - S0 + 3) * kWordSize)); | 1018 __ lw(r, Address(SP, (i - S0 + 3) * kWordSize)); |
1010 } | 1019 } |
1020 | |
1021 for (intptr_t i = F20; i <= F31; i++) { | |
1022 FRegister r = static_cast<FRegister>(i); | |
1023 __ lwc1(r, | |
1024 Address(SP, (kAbiPreservedCpuRegCount + 3 + i - F20) * kWordSize)); | |
regis
2013/08/30 01:53:39
3 -> named constant defined above.
zra
2013/09/03 15:09:11
Done.
| |
1025 } | |
1026 | |
1011 __ lw(A3, Address(SP, 2 * kWordSize)); | 1027 __ lw(A3, Address(SP, 2 * kWordSize)); |
1012 __ addiu(SP, SP, Immediate((3 + kAbiPreservedCpuRegCount) * kWordSize)); | 1028 __ addiu(SP, SP, Immediate(kPreservedRegSpace)); |
1013 | 1029 |
1014 // Restore the frame pointer and return. | 1030 // Restore the frame pointer and return. |
1015 __ LeaveStubFrameAndReturn(); | 1031 __ LeaveStubFrameAndReturn(); |
1016 } | 1032 } |
1017 | 1033 |
1018 | 1034 |
1019 // Called for inline allocation of contexts. | 1035 // Called for inline allocation of contexts. |
1020 // Input: | 1036 // Input: |
1021 // T1: number of context variables. | 1037 // T1: number of context variables. |
1022 // Output: | 1038 // Output: |
(...skipping 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2463 __ lw(left, Address(SP, 1 * kWordSize)); | 2479 __ lw(left, Address(SP, 1 * kWordSize)); |
2464 __ lw(temp2, Address(SP, 2 * kWordSize)); | 2480 __ lw(temp2, Address(SP, 2 * kWordSize)); |
2465 __ lw(temp1, Address(SP, 3 * kWordSize)); | 2481 __ lw(temp1, Address(SP, 3 * kWordSize)); |
2466 __ Ret(); | 2482 __ Ret(); |
2467 __ delay_slot()->addiu(SP, SP, Immediate(4 * kWordSize)); | 2483 __ delay_slot()->addiu(SP, SP, Immediate(4 * kWordSize)); |
2468 } | 2484 } |
2469 | 2485 |
2470 } // namespace dart | 2486 } // namespace dart |
2471 | 2487 |
2472 #endif // defined TARGET_ARCH_MIPS | 2488 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |