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

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

Issue 2014413003: Bump the C stack pointer when building Dart frames to maintain the ARM64 ABI requirements without g… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: assembler test Created 4 years, 6 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
« no previous file with comments | « runtime/vm/assembler_arm64.h ('k') | runtime/vm/assembler_arm64_test.cc » ('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" // NOLINT 5 #include "vm/globals.h" // NOLINT
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/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/longjump.h" 10 #include "vm/longjump.h"
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 ldr(TMP, FieldAddress(CODE_REG, Code::saved_instructions_offset())); 1119 ldr(TMP, FieldAddress(CODE_REG, Code::saved_instructions_offset()));
1120 cmp(R0, Operand(TMP)); 1120 cmp(R0, Operand(TMP));
1121 b(&instructions_ok, EQ); 1121 b(&instructions_ok, EQ);
1122 brk(1); 1122 brk(1);
1123 Bind(&instructions_ok); 1123 Bind(&instructions_ok);
1124 Pop(R0); 1124 Pop(R0);
1125 #endif 1125 #endif
1126 } 1126 }
1127 1127
1128 1128
1129 void Assembler::SetupDartSP() {
1130 mov(SP, CSP);
1131 }
1132
1133
1134 void Assembler::RestoreCSP() {
1135 mov(CSP, SP);
1136 }
1137
1138
1129 void Assembler::EnterFrame(intptr_t frame_size) { 1139 void Assembler::EnterFrame(intptr_t frame_size) {
1140 // The ARM64 ABI requires at all times
1141 // - stack limit < CSP <= stack base
1142 // - CSP mod 16 = 0
1143 // - we do not access stack memory below CSP
1144 // Pratically, this means we need to keep the C stack pointer ahead of the
1145 // Dart stack pointer and 16-byte aligned for signal handlers. If we knew the
1146 // real stack limit, we could just set CSP to a value near it during
1147 // SetupDartSP, but we do not know the real stack limit for the initial
1148 // thread or threads created by the embedder.
1149 // TODO(26472): It would be safer to use CSP as the Dart stack pointer, but
1150 // this requires adjustments to stack handling to maintain the 16-byte
1151 // alignment.
1152 const intptr_t kMaxDartFrameSize = 4096;
1153 sub(TMP, SP, Operand(kMaxDartFrameSize));
1154 andi(CSP, TMP, Immediate(~15));
1155
1130 PushPair(LR, FP); 1156 PushPair(LR, FP);
1131 mov(FP, SP); 1157 mov(FP, SP);
1132 1158
1133 if (frame_size > 0) { 1159 if (frame_size > 0) {
1134 sub(SP, SP, Operand(frame_size)); 1160 sub(SP, SP, Operand(frame_size));
1135 } 1161 }
1136 } 1162 }
1137 1163
1138 1164
1139 void Assembler::LeaveFrame() { 1165 void Assembler::LeaveFrame() {
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 add(base, array, Operand(index, LSL, shift)); 1471 add(base, array, Operand(index, LSL, shift));
1446 } 1472 }
1447 const OperandSize size = Address::OperandSizeFor(cid); 1473 const OperandSize size = Address::OperandSizeFor(cid);
1448 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); 1474 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size));
1449 return Address(base, offset, Address::Offset, size); 1475 return Address(base, offset, Address::Offset, size);
1450 } 1476 }
1451 1477
1452 } // namespace dart 1478 } // namespace dart
1453 1479
1454 #endif // defined TARGET_ARCH_ARM64 1480 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/assembler_arm64.h ('k') | runtime/vm/assembler_arm64_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698