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" // 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 Loading... | |
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 const intptr_t kMaxDartFrameSize = 256; | |
rmacnak
2016/05/27 04:44:51
Not sure where in the compiler to check this isn't
Vyacheslav Egorov (Google)
2016/05/27 15:34:52
It's not that easy.
FlowGraphCompiler::StackSize
| |
1150 sub(TMP, SP, Operand(kMaxDartFrameSize)); | |
1151 andi(CSP, TMP, Immediate(~15)); | |
1152 | |
1130 PushPair(LR, FP); | 1153 PushPair(LR, FP); |
1131 mov(FP, SP); | 1154 mov(FP, SP); |
1132 | 1155 |
1133 if (frame_size > 0) { | 1156 if (frame_size > 0) { |
1134 sub(SP, SP, Operand(frame_size)); | 1157 sub(SP, SP, Operand(frame_size)); |
1135 } | 1158 } |
1136 } | 1159 } |
1137 | 1160 |
1138 | 1161 |
1139 void Assembler::LeaveFrame() { | 1162 void Assembler::LeaveFrame() { |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1445 add(base, array, Operand(index, LSL, shift)); | 1468 add(base, array, Operand(index, LSL, shift)); |
1446 } | 1469 } |
1447 const OperandSize size = Address::OperandSizeFor(cid); | 1470 const OperandSize size = Address::OperandSizeFor(cid); |
1448 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); | 1471 ASSERT(Address::CanHoldOffset(offset, Address::Offset, size)); |
1449 return Address(base, offset, Address::Offset, size); | 1472 return Address(base, offset, Address::Offset, size); |
1450 } | 1473 } |
1451 | 1474 |
1452 } // namespace dart | 1475 } // namespace dart |
1453 | 1476 |
1454 #endif // defined TARGET_ARCH_ARM64 | 1477 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |