| 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_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 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/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 // LR : points to return address. | 778 // LR : points to return address. |
| 779 // R0 : entrypoint of the Dart function to call. | 779 // R0 : entrypoint of the Dart function to call. |
| 780 // R1 : arguments descriptor array. | 780 // R1 : arguments descriptor array. |
| 781 // R2 : arguments array. | 781 // R2 : arguments array. |
| 782 // R3 : new context containing the current isolate pointer. | 782 // R3 : new context containing the current isolate pointer. |
| 783 void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) { | 783 void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) { |
| 784 // Save frame pointer coming in. | 784 // Save frame pointer coming in. |
| 785 __ EnterFrame((1 << FP) | (1 << LR), 0); | 785 __ EnterFrame((1 << FP) | (1 << LR), 0); |
| 786 | 786 |
| 787 // Save new context and C++ ABI callee-saved registers. | 787 // Save new context and C++ ABI callee-saved registers. |
| 788 const intptr_t kNewContextOffsetFromFp = | |
| 789 -(1 + kAbiPreservedCpuRegCount) * kWordSize; | |
| 790 __ PushList((1 << R3) | kAbiPreservedCpuRegs); | 788 __ PushList((1 << R3) | kAbiPreservedCpuRegs); |
| 791 | 789 |
| 792 const DRegister firstd = EvenDRegisterOf(kAbiFirstPreservedFpuReg); | 790 const DRegister firstd = EvenDRegisterOf(kAbiFirstPreservedFpuReg); |
| 793 if (TargetCPUFeatures::vfp_supported()) { | 791 if (TargetCPUFeatures::vfp_supported()) { |
| 794 ASSERT(2 * kAbiPreservedFpuRegCount < 16); | 792 ASSERT(2 * kAbiPreservedFpuRegCount < 16); |
| 795 // Save FPU registers. 2 D registers per Q register. | 793 // Save FPU registers. 2 D registers per Q register. |
| 796 __ vstmd(DB_W, SP, firstd, 2 * kAbiPreservedFpuRegCount); | 794 __ vstmd(DB_W, SP, firstd, 2 * kAbiPreservedFpuRegCount); |
| 797 } else { | 795 } else { |
| 798 __ sub(SP, SP, Operand(kAbiPreservedFpuRegCount * kFpuRegisterSize)); | 796 __ sub(SP, SP, Operand(kAbiPreservedFpuRegCount * kFpuRegisterSize)); |
| 799 } | 797 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 __ Push(R3); | 862 __ Push(R3); |
| 865 __ AddImmediate(R2, kWordSize); | 863 __ AddImmediate(R2, kWordSize); |
| 866 __ AddImmediate(R1, 1); | 864 __ AddImmediate(R1, 1); |
| 867 __ cmp(R1, Operand(R5)); | 865 __ cmp(R1, Operand(R5)); |
| 868 __ b(&push_arguments, LT); | 866 __ b(&push_arguments, LT); |
| 869 __ Bind(&done_push_arguments); | 867 __ Bind(&done_push_arguments); |
| 870 | 868 |
| 871 // Call the Dart code entrypoint. | 869 // Call the Dart code entrypoint. |
| 872 __ blx(R0); // R4 is the arguments descriptor array. | 870 __ blx(R0); // R4 is the arguments descriptor array. |
| 873 | 871 |
| 874 // Read the saved new Context pointer. | |
| 875 __ ldr(CTX, Address(FP, kNewContextOffsetFromFp)); | |
| 876 __ ldr(CTX, Address(CTX, VMHandles::kOffsetOfRawPtrInHandle)); | |
| 877 | |
| 878 // Get rid of arguments pushed on the stack. | 872 // Get rid of arguments pushed on the stack. |
| 879 __ AddImmediate(SP, FP, kSavedContextSlotFromEntryFp * kWordSize); | 873 __ AddImmediate(SP, FP, kSavedContextSlotFromEntryFp * kWordSize); |
| 880 | 874 |
| 881 // Load Isolate pointer into CTX. Drop Context. | 875 // Load Isolate pointer into CTX. |
| 882 __ LoadIsolate(CTX); | 876 __ LoadIsolate(CTX); |
| 883 | 877 |
| 884 // Restore the saved Context pointer into the Isolate structure. | 878 // Restore the saved Context pointer into the Isolate structure. |
| 885 // Uses R4 as a temporary register for this. | 879 // Uses R4 as a temporary register for this. |
| 886 // Restore the saved top exit frame info back into the Isolate structure. | 880 // Restore the saved top exit frame info back into the Isolate structure. |
| 887 // Uses R5 as a temporary register for this. | 881 // Uses R5 as a temporary register for this. |
| 888 __ PopList((1 << R4) | (1 << R5)); | 882 __ PopList((1 << R4) | (1 << R5)); |
| 889 __ StoreToOffset(kWord, R4, CTX, Isolate::top_context_offset()); | 883 __ StoreToOffset(kWord, R4, CTX, Isolate::top_context_offset()); |
| 890 __ StoreToOffset(kWord, R5, CTX, Isolate::top_exit_frame_info_offset()); | 884 __ StoreToOffset(kWord, R5, CTX, Isolate::top_exit_frame_info_offset()); |
| 891 | 885 |
| (...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2041 const Register right = R0; | 2035 const Register right = R0; |
| 2042 __ ldr(left, Address(SP, 1 * kWordSize)); | 2036 __ ldr(left, Address(SP, 1 * kWordSize)); |
| 2043 __ ldr(right, Address(SP, 0 * kWordSize)); | 2037 __ ldr(right, Address(SP, 0 * kWordSize)); |
| 2044 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 2038 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
| 2045 __ Ret(); | 2039 __ Ret(); |
| 2046 } | 2040 } |
| 2047 | 2041 |
| 2048 } // namespace dart | 2042 } // namespace dart |
| 2049 | 2043 |
| 2050 #endif // defined TARGET_ARCH_ARM | 2044 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |