Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: runtime/vm/stub_code_arm64.cc

Issue 583683002: Fixes for the profiler on arm64. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/signal_handler_win.cc ('k') | runtime/vm/thread_interrupter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 86
87 // There are no runtime calls to closures, so we do not need to set the tag 87 // There are no runtime calls to closures, so we do not need to set the tag
88 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_. 88 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_.
89 ASSERT(argc_tag_offset == 1 * kWordSize); 89 ASSERT(argc_tag_offset == 1 * kWordSize);
90 __ mov(R1, R4); // Set argc in NativeArguments. 90 __ mov(R1, R4); // Set argc in NativeArguments.
91 91
92 ASSERT(argv_offset == 2 * kWordSize); 92 ASSERT(argv_offset == 2 * kWordSize);
93 __ add(R2, ZR, Operand(R4, LSL, 3)); 93 __ add(R2, ZR, Operand(R4, LSL, 3));
94 __ add(R2, FP, Operand(R2)); // Compute argv. 94 __ add(R2, FP, Operand(R2)); // Compute argv.
95 // Set argv in NativeArguments. 95 // Set argv in NativeArguments.
96 __ AddImmediate(R2, R2, exitframe_last_param_slot_from_fp * kWordSize, 96 __ AddImmediate(R2, R2, exitframe_last_param_slot_from_fp * kWordSize, kNoPP);
97 kNoPP);
98 97
99 ASSERT(retval_offset == 3 * kWordSize); 98 ASSERT(retval_offset == 3 * kWordSize);
100 __ AddImmediate(R3, R2, kWordSize, kNoPP); 99 __ AddImmediate(R3, R2, kWordSize, kNoPP);
101 100
102 __ StoreToOffset(R0, SP, isolate_offset, kNoPP); 101 __ StoreToOffset(R0, SP, isolate_offset, kNoPP);
103 __ StoreToOffset(R1, SP, argc_tag_offset, kNoPP); 102 __ StoreToOffset(R1, SP, argc_tag_offset, kNoPP);
104 __ StoreToOffset(R2, SP, argv_offset, kNoPP); 103 __ StoreToOffset(R2, SP, argv_offset, kNoPP);
105 __ StoreToOffset(R3, SP, retval_offset, kNoPP); 104 __ StoreToOffset(R3, SP, retval_offset, kNoPP);
106 __ mov(R0, SP); // Pass the pointer to the NativeArguments. 105 __ mov(R0, SP); // Pass the pointer to the NativeArguments.
107 106
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 // R0 : entrypoint of the Dart function to call. 775 // R0 : entrypoint of the Dart function to call.
777 // R1 : arguments descriptor array. 776 // R1 : arguments descriptor array.
778 // R2 : arguments array. 777 // R2 : arguments array.
779 // R3 : new context containing the current isolate pointer. 778 // R3 : new context containing the current isolate pointer.
780 void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) { 779 void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) {
781 __ Comment("InvokeDartCodeStub"); 780 __ Comment("InvokeDartCodeStub");
782 // The new context, saved vm tag, the top exit frame, and the old context. 781 // The new context, saved vm tag, the top exit frame, and the old context.
783 const intptr_t kNewContextOffsetFromFp = 782 const intptr_t kNewContextOffsetFromFp =
784 -(1 + kAbiPreservedCpuRegCount + kAbiPreservedFpuRegCount) * kWordSize; 783 -(1 + kAbiPreservedCpuRegCount + kAbiPreservedFpuRegCount) * kWordSize;
785 784
786 // Amount of space to reserve with the system stack pointer before setting it
787 // to the stack limit.
788 const intptr_t kRegSaveSpace = Utils::RoundUp(-kNewContextOffsetFromFp, 16);
789
790 // Copy the C stack pointer (R31) into the stack pointer we'll actually use 785 // Copy the C stack pointer (R31) into the stack pointer we'll actually use
791 // to access the stack. 786 // to access the stack, and put the C stack pointer at the stack limit.
792 __ SetupDartSP(kRegSaveSpace); 787 __ SetupDartSP(Isolate::GetSpecifiedStackSize());
793 __ EnterFrame(0); 788 __ EnterFrame(0);
794 789
795 // Save the callee-saved registers. 790 // Save the callee-saved registers.
796 for (int i = kAbiFirstPreservedCpuReg; i <= kAbiLastPreservedCpuReg; i++) { 791 for (int i = kAbiFirstPreservedCpuReg; i <= kAbiLastPreservedCpuReg; i++) {
797 const Register r = static_cast<Register>(i); 792 const Register r = static_cast<Register>(i);
798 // We use str instead of the Push macro because we will be pushing the PP 793 // We use str instead of the Push macro because we will be pushing the PP
799 // register when it is not holding a pool-pointer since we are coming from 794 // register when it is not holding a pool-pointer since we are coming from
800 // C++ code. 795 // C++ code.
801 __ str(r, Address(SP, -1 * kWordSize, Address::PreIndex)); 796 __ str(r, Address(SP, -1 * kWordSize, Address::PreIndex));
802 } 797 }
803 798
804 // Save the bottom 64-bits of callee-saved V registers. 799 // Save the bottom 64-bits of callee-saved V registers.
805 for (int i = kAbiFirstPreservedFpuReg; i <= kAbiLastPreservedFpuReg; i++) { 800 for (int i = kAbiFirstPreservedFpuReg; i <= kAbiLastPreservedFpuReg; i++) {
806 const VRegister r = static_cast<VRegister>(i); 801 const VRegister r = static_cast<VRegister>(i);
807 __ PushDouble(r); 802 __ PushDouble(r);
808 } 803 }
809 804
810 // Push new context. 805 // Push new context.
811 __ Push(R3); 806 __ Push(R3);
807 #if defined(DEBUG)
808 {
809 Label ok;
810 __ AddImmediate(R4, FP, kNewContextOffsetFromFp, kNoPP);
811 __ CompareRegisters(R4, SP);
812 __ b(&ok, EQ);
813 __ Stop("kNewContextOffsetFromFp mismatch");
814 __ Bind(&ok);
815 }
816 #endif
812 817
813 // We now load the pool pointer(PP) as we are about to invoke dart code and we 818 // We now load the pool pointer(PP) as we are about to invoke dart code and we
814 // could potentially invoke some intrinsic functions which need the PP to be 819 // could potentially invoke some intrinsic functions which need the PP to be
815 // set up. 820 // set up.
816 __ LoadPoolPointer(PP); 821 __ LoadPoolPointer(PP);
817 822
818 // The new Context structure contains a pointer to the current Isolate 823 // The new Context structure contains a pointer to the current Isolate
819 // structure. Cache the Context pointer in the CTX register so that it is 824 // structure. Cache the Context pointer in the CTX register so that it is
820 // available in generated code and calls to Isolate::Current() need not be 825 // available in generated code and calls to Isolate::Current() need not be
821 // done. The assumption is that this register will never be clobbered by 826 // done. The assumption is that this register will never be clobbered by
822 // compiled or runtime stub code. 827 // compiled or runtime stub code.
823 828
824 // Cache the new Context pointer into CTX while executing Dart code. 829 // Cache the new Context pointer into CTX while executing Dart code.
825 __ LoadFromOffset(CTX, R3, VMHandles::kOffsetOfRawPtrInHandle, PP); 830 __ LoadFromOffset(CTX, R3, VMHandles::kOffsetOfRawPtrInHandle, PP);
826 831
827 // Load Isolate pointer into temporary register R5. 832 // Load Isolate pointer into temporary register R5.
828 __ LoadImmediate(R5, Isolate::CurrentAddress(), PP); 833 __ LoadImmediate(R5, Isolate::CurrentAddress(), PP);
829 834
830 // Load the stack limit address into the C stack pointer register.
831 __ LoadFromOffset(CSP, R5, Isolate::stack_limit_offset(), PP);
832
833 // Cache the new Context pointer into CTX while executing Dart code. 835 // Cache the new Context pointer into CTX while executing Dart code.
834 __ LoadFromOffset(CTX, R3, VMHandles::kOffsetOfRawPtrInHandle, PP); 836 __ LoadFromOffset(CTX, R3, VMHandles::kOffsetOfRawPtrInHandle, PP);
835 837
836 // Save the current VMTag on the stack. 838 // Save the current VMTag on the stack.
837 ASSERT(kSavedVMTagSlotFromEntryFp == -20); 839 ASSERT(kSavedVMTagSlotFromEntryFp == -20);
838 __ LoadFromOffset(R4, R5, Isolate::vm_tag_offset(), PP); 840 __ LoadFromOffset(R4, R5, Isolate::vm_tag_offset(), PP);
839 __ Push(R4); 841 __ Push(R4);
840 842
841 // Mark that the isolate is executing Dart code. 843 // Mark that the isolate is executing Dart code.
842 __ LoadImmediate(R6, VMTag::kDartTagId, PP); 844 __ LoadImmediate(R6, VMTag::kDartTagId, PP);
(...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after
2081 const Register right = R0; 2083 const Register right = R0;
2082 __ LoadFromOffset(left, SP, 1 * kWordSize, kNoPP); 2084 __ LoadFromOffset(left, SP, 1 * kWordSize, kNoPP);
2083 __ LoadFromOffset(right, SP, 0 * kWordSize, kNoPP); 2085 __ LoadFromOffset(right, SP, 0 * kWordSize, kNoPP);
2084 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); 2086 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp);
2085 __ ret(); 2087 __ ret();
2086 } 2088 }
2087 2089
2088 } // namespace dart 2090 } // namespace dart
2089 2091
2090 #endif // defined TARGET_ARCH_ARM64 2092 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/signal_handler_win.cc ('k') | runtime/vm/thread_interrupter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698