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 #ifndef VM_ASSEMBLER_ARM64_H_ | 5 #ifndef VM_ASSEMBLER_ARM64_H_ |
6 #define VM_ASSEMBLER_ARM64_H_ | 6 #define VM_ASSEMBLER_ARM64_H_ |
7 | 7 |
8 #ifndef VM_ASSEMBLER_H_ | 8 #ifndef VM_ASSEMBLER_H_ |
9 #error Do not include assembler_arm64.h directly; use assembler.h instead. | 9 #error Do not include assembler_arm64.h directly; use assembler.h instead. |
10 #endif | 10 #endif |
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 fldrd(reg, Address(SP, 1 * kDoubleSize, Address::PostIndex)); | 1145 fldrd(reg, Address(SP, 1 * kDoubleSize, Address::PostIndex)); |
1146 } | 1146 } |
1147 void PopQuad(VRegister reg) { | 1147 void PopQuad(VRegister reg) { |
1148 fldrq(reg, Address(SP, 1 * kQuadSize, Address::PostIndex)); | 1148 fldrq(reg, Address(SP, 1 * kQuadSize, Address::PostIndex)); |
1149 } | 1149 } |
1150 void TagAndPushPP() { | 1150 void TagAndPushPP() { |
1151 // Add the heap object tag back to PP before putting it on the stack. | 1151 // Add the heap object tag back to PP before putting it on the stack. |
1152 add(TMP, PP, Operand(kHeapObjectTag)); | 1152 add(TMP, PP, Operand(kHeapObjectTag)); |
1153 str(TMP, Address(SP, -1 * kWordSize, Address::PreIndex)); | 1153 str(TMP, Address(SP, -1 * kWordSize, Address::PreIndex)); |
1154 } | 1154 } |
1155 void TagAndPushPPAndPcMarker() { | 1155 void TagAndPushPPAndPcMarker(Register pc_marker_reg) { |
1156 COMPILE_ASSERT(CODE_REG != TMP2); | 1156 ASSERT(pc_marker_reg != TMP2); |
1157 // Add the heap object tag back to PP before putting it on the stack. | 1157 // Add the heap object tag back to PP before putting it on the stack. |
1158 add(TMP2, PP, Operand(kHeapObjectTag)); | 1158 add(TMP2, PP, Operand(kHeapObjectTag)); |
1159 stp(TMP2, CODE_REG, | 1159 stp(TMP2, pc_marker_reg, |
1160 Address(SP, -2 * kWordSize, Address::PairPreIndex)); | 1160 Address(SP, -2 * kWordSize, Address::PairPreIndex)); |
1161 } | 1161 } |
1162 void PopAndUntagPP() { | 1162 void PopAndUntagPP() { |
1163 ldr(PP, Address(SP, 1 * kWordSize, Address::PostIndex)); | 1163 ldr(PP, Address(SP, 1 * kWordSize, Address::PostIndex)); |
1164 sub(PP, PP, Operand(kHeapObjectTag)); | 1164 sub(PP, PP, Operand(kHeapObjectTag)); |
1165 // The caller of PopAndUntagPP() must explicitly allow use of popped PP. | 1165 // The caller of PopAndUntagPP() must explicitly allow use of popped PP. |
1166 set_constant_pool_allowed(false); | 1166 set_constant_pool_allowed(false); |
1167 } | 1167 } |
1168 void tst(Register rn, Operand o) { | 1168 void tst(Register rn, Operand o) { |
1169 ands(ZR, rn, o); | 1169 ands(ZR, rn, o); |
(...skipping 21 matching lines...) Expand all Loading... |
1191 void SmiUntag(Register dst, Register src) { | 1191 void SmiUntag(Register dst, Register src) { |
1192 AsrImmediate(dst, src, kSmiTagSize); | 1192 AsrImmediate(dst, src, kSmiTagSize); |
1193 } | 1193 } |
1194 void SmiTag(Register reg) { | 1194 void SmiTag(Register reg) { |
1195 LslImmediate(reg, reg, kSmiTagSize); | 1195 LslImmediate(reg, reg, kSmiTagSize); |
1196 } | 1196 } |
1197 void SmiTag(Register dst, Register src) { | 1197 void SmiTag(Register dst, Register src) { |
1198 LslImmediate(dst, src, kSmiTagSize); | 1198 LslImmediate(dst, src, kSmiTagSize); |
1199 } | 1199 } |
1200 | 1200 |
1201 void Branch(const StubEntry& stub_entry, | 1201 void Branch(const StubEntry& stub_entry); |
1202 Register pp, | |
1203 Patchability patchable = kNotPatchable); | |
1204 void BranchPatchable(const StubEntry& stub_entry); | 1202 void BranchPatchable(const StubEntry& stub_entry); |
1205 | 1203 |
1206 void BranchLink(const StubEntry& stub_entry, | 1204 void BranchLink(const ExternalLabel* label); |
1207 Patchability patchable = kNotPatchable); | 1205 void BranchLink(const StubEntry& stub_entry); |
1208 | 1206 |
| 1207 // BranchLinkPatchable must be a fixed-length sequence so we can patch it |
| 1208 // with the debugger. |
1209 void BranchLinkPatchable(const StubEntry& stub_entry); | 1209 void BranchLinkPatchable(const StubEntry& stub_entry); |
1210 | 1210 |
1211 // Macros accepting a pp Register argument may attempt to load values from | 1211 // Macros accepting a pp Register argument may attempt to load values from |
1212 // the object pool when possible. Unless you are sure that the untagged object | 1212 // the object pool when possible. Unless you are sure that the untagged object |
1213 // pool pointer is in another register, or that it is not available at all, | 1213 // pool pointer is in another register, or that it is not available at all, |
1214 // PP should be passed for pp. | 1214 // PP should be passed for pp. |
1215 void AddImmediate(Register dest, Register rn, int64_t imm); | 1215 void AddImmediate(Register dest, Register rn, int64_t imm); |
1216 void AddImmediateSetFlags(Register dest, Register rn, int64_t imm); | 1216 void AddImmediateSetFlags(Register dest, Register rn, int64_t imm); |
1217 void SubImmediateSetFlags(Register dest, Register rn, int64_t imm); | 1217 void SubImmediateSetFlags(Register dest, Register rn, int64_t imm); |
1218 void AndImmediate(Register rd, Register rn, int64_t imm); | 1218 void AndImmediate(Register rd, Register rn, int64_t imm); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 // Object pool, loading from pool, etc. | 1276 // Object pool, loading from pool, etc. |
1277 void LoadPoolPointer(Register pp = PP); | 1277 void LoadPoolPointer(Register pp = PP); |
1278 | 1278 |
1279 bool constant_pool_allowed() const { | 1279 bool constant_pool_allowed() const { |
1280 return constant_pool_allowed_; | 1280 return constant_pool_allowed_; |
1281 } | 1281 } |
1282 void set_constant_pool_allowed(bool b) { | 1282 void set_constant_pool_allowed(bool b) { |
1283 constant_pool_allowed_ = b; | 1283 constant_pool_allowed_ = b; |
1284 } | 1284 } |
1285 | 1285 |
| 1286 void LoadWordFromPoolOffset(Register dst, uint32_t offset); |
| 1287 void LoadWordFromPoolOffsetFixed(Register dst, uint32_t offset); |
1286 intptr_t FindImmediate(int64_t imm); | 1288 intptr_t FindImmediate(int64_t imm); |
1287 bool CanLoadFromObjectPool(const Object& object) const; | 1289 bool CanLoadFromObjectPool(const Object& object) const; |
1288 void LoadExternalLabel(Register dst, const ExternalLabel* label); | 1290 void LoadExternalLabel(Register dst, const ExternalLabel* label); |
1289 void LoadNativeEntry(Register dst, const ExternalLabel* label); | 1291 void LoadNativeEntry(Register dst, const ExternalLabel* label); |
1290 void LoadExternalLabelFixed(Register dst, | 1292 void LoadExternalLabelFixed(Register dst, |
1291 const ExternalLabel* label, | 1293 const ExternalLabel* label, |
1292 Patchability patchable); | 1294 Patchability patchable); |
1293 void LoadFunctionFromCalleePool(Register dst, | 1295 void LoadFunctionFromCalleePool(Register dst, |
1294 const Function& function, | 1296 const Function& function, |
1295 Register new_pp); | 1297 Register new_pp); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 | 1333 |
1332 // When entering Dart code from C++, we copy the system stack pointer (CSP) | 1334 // When entering Dart code from C++, we copy the system stack pointer (CSP) |
1333 // to the Dart stack pointer (SP), and reserve a little space for the stack | 1335 // to the Dart stack pointer (SP), and reserve a little space for the stack |
1334 // to grow. | 1336 // to grow. |
1335 void SetupDartSP(intptr_t reserved_space) { | 1337 void SetupDartSP(intptr_t reserved_space) { |
1336 ASSERT(Utils::IsAligned(reserved_space, 16)); | 1338 ASSERT(Utils::IsAligned(reserved_space, 16)); |
1337 mov(SP, CSP); | 1339 mov(SP, CSP); |
1338 sub(CSP, CSP, Operand(reserved_space)); | 1340 sub(CSP, CSP, Operand(reserved_space)); |
1339 } | 1341 } |
1340 | 1342 |
1341 void CheckCodePointer(); | |
1342 void RestoreCodePointer(); | |
1343 | |
1344 void EnterDartFrame(intptr_t frame_size, Register new_pp = kNoRegister); | 1343 void EnterDartFrame(intptr_t frame_size, Register new_pp = kNoRegister); |
1345 void EnterOsrFrame(intptr_t extra_size, Register new_pp); | 1344 void EnterOsrFrame(intptr_t extra_size, Register new_pp); |
1346 void LeaveDartFrame(RestorePP restore_pp = kRestoreCallerPP); | 1345 void LeaveDartFrame(); |
1347 | 1346 |
1348 void EnterCallRuntimeFrame(intptr_t frame_size); | 1347 void EnterCallRuntimeFrame(intptr_t frame_size); |
1349 void LeaveCallRuntimeFrame(); | 1348 void LeaveCallRuntimeFrame(); |
1350 void CallRuntime(const RuntimeEntry& entry, intptr_t argument_count); | 1349 void CallRuntime(const RuntimeEntry& entry, intptr_t argument_count); |
1351 | 1350 |
1352 // Set up a stub frame so that the stack traversal code can easily identify | 1351 // Set up a stub frame so that the stack traversal code can easily identify |
1353 // a stub frame. | 1352 // a stub frame. |
1354 void EnterStubFrame(); | 1353 void EnterStubFrame(); |
1355 void LeaveStubFrame(); | 1354 void LeaveStubFrame(); |
1356 | 1355 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1420 intptr_t pc_offset_; | 1419 intptr_t pc_offset_; |
1421 const String& comment_; | 1420 const String& comment_; |
1422 | 1421 |
1423 DISALLOW_COPY_AND_ASSIGN(CodeComment); | 1422 DISALLOW_COPY_AND_ASSIGN(CodeComment); |
1424 }; | 1423 }; |
1425 | 1424 |
1426 GrowableArray<CodeComment*> comments_; | 1425 GrowableArray<CodeComment*> comments_; |
1427 | 1426 |
1428 bool constant_pool_allowed_; | 1427 bool constant_pool_allowed_; |
1429 | 1428 |
1430 void LoadWordFromPoolOffset(Register dst, uint32_t offset, Register pp = PP); | 1429 void Branch(const ExternalLabel* label); |
1431 void LoadWordFromPoolOffsetFixed(Register dst, uint32_t offset); | 1430 void BranchPatchable(const ExternalLabel* label); |
| 1431 void BranchLinkPatchable(const ExternalLabel* label); |
1432 | 1432 |
1433 void LoadObjectHelper(Register dst, const Object& obj, bool is_unique); | 1433 void LoadObjectHelper(Register dst, const Object& obj, bool is_unique); |
1434 | 1434 |
1435 void AddSubHelper(OperandSize os, bool set_flags, bool subtract, | 1435 void AddSubHelper(OperandSize os, bool set_flags, bool subtract, |
1436 Register rd, Register rn, Operand o) { | 1436 Register rd, Register rn, Operand o) { |
1437 ASSERT((rd != R31) && (rn != R31)); | 1437 ASSERT((rd != R31) && (rn != R31)); |
1438 const Register crd = ConcreteRegister(rd); | 1438 const Register crd = ConcreteRegister(rd); |
1439 const Register crn = ConcreteRegister(rn); | 1439 const Register crn = ConcreteRegister(rn); |
1440 if (o.type() == Operand::Immediate) { | 1440 if (o.type() == Operand::Immediate) { |
1441 ASSERT(rn != ZR); | 1441 ASSERT(rn != ZR); |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1924 Register value, | 1924 Register value, |
1925 Label* no_update); | 1925 Label* no_update); |
1926 | 1926 |
1927 DISALLOW_ALLOCATION(); | 1927 DISALLOW_ALLOCATION(); |
1928 DISALLOW_COPY_AND_ASSIGN(Assembler); | 1928 DISALLOW_COPY_AND_ASSIGN(Assembler); |
1929 }; | 1929 }; |
1930 | 1930 |
1931 } // namespace dart | 1931 } // namespace dart |
1932 | 1932 |
1933 #endif // VM_ASSEMBLER_ARM64_H_ | 1933 #endif // VM_ASSEMBLER_ARM64_H_ |
OLD | NEW |