OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 static const int kPcLoadDelta = 4; | 545 static const int kPcLoadDelta = 4; |
546 | 546 |
547 #ifdef _MIPS_ARCH_MIPS32R6 | 547 #ifdef _MIPS_ARCH_MIPS32R6 |
548 static const int kDebugBreakSlotInstructions = 3; | 548 static const int kDebugBreakSlotInstructions = 3; |
549 #else | 549 #else |
550 static const int kDebugBreakSlotInstructions = 4; | 550 static const int kDebugBreakSlotInstructions = 4; |
551 #endif | 551 #endif |
552 static const int kDebugBreakSlotLength = | 552 static const int kDebugBreakSlotLength = |
553 kDebugBreakSlotInstructions * kInstrSize; | 553 kDebugBreakSlotInstructions * kInstrSize; |
554 | 554 |
| 555 // Max offset for instructions with 16-bit offset field |
| 556 static const int kMaxBranchOffset = (1 << (18 - 1)) - 1; |
| 557 |
| 558 // Max offset for compact branch instructions with 26-bit offset field |
| 559 static const int kMaxCompactBranchOffset = (1 << (28 - 1)) - 1; |
| 560 |
| 561 #ifdef _MIPS_ARCH_MIPS32R6 |
| 562 static const int kTrampolineSlotsSize = 2 * kInstrSize; |
| 563 #else |
| 564 static const int kTrampolineSlotsSize = 4 * kInstrSize; |
| 565 #endif |
555 | 566 |
556 // --------------------------------------------------------------------------- | 567 // --------------------------------------------------------------------------- |
557 // Code generation. | 568 // Code generation. |
558 | 569 |
559 // Insert the smallest number of nop instructions | 570 // Insert the smallest number of nop instructions |
560 // possible to align the pc offset to a multiple | 571 // possible to align the pc offset to a multiple |
561 // of m. m must be a power of 2 (>= 4). | 572 // of m. m must be a power of 2 (>= 4). |
562 void Align(int m); | 573 void Align(int m); |
563 // Insert the smallest number of zero bytes possible to align the pc offset | 574 // Insert the smallest number of zero bytes possible to align the pc offset |
564 // to a mulitple of m. m must be a power of 2 (>= 2). | 575 // to a mulitple of m. m must be a power of 2 (>= 2). |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 void CheckTrampolinePool(); | 1170 void CheckTrampolinePool(); |
1160 | 1171 |
1161 void PatchConstantPoolAccessInstruction(int pc_offset, int offset, | 1172 void PatchConstantPoolAccessInstruction(int pc_offset, int offset, |
1162 ConstantPoolEntry::Access access, | 1173 ConstantPoolEntry::Access access, |
1163 ConstantPoolEntry::Type type) { | 1174 ConstantPoolEntry::Type type) { |
1164 // No embedded constant pool support. | 1175 // No embedded constant pool support. |
1165 UNREACHABLE(); | 1176 UNREACHABLE(); |
1166 } | 1177 } |
1167 | 1178 |
1168 bool IsPrevInstrCompactBranch() { return prev_instr_compact_branch_; } | 1179 bool IsPrevInstrCompactBranch() { return prev_instr_compact_branch_; } |
| 1180 static bool IsCompactBranchSupported() { |
| 1181 return IsMipsArchVariant(kMips32r6); |
| 1182 } |
1169 | 1183 |
1170 inline int UnboundLabelsCount() { return unbound_labels_count_; } | 1184 inline int UnboundLabelsCount() { return unbound_labels_count_; } |
1171 | 1185 |
1172 protected: | 1186 protected: |
1173 // Load Scaled Address instruction. | 1187 // Load Scaled Address instruction. |
1174 void lsa(Register rd, Register rt, Register rs, uint8_t sa); | 1188 void lsa(Register rd, Register rt, Register rs, uint8_t sa); |
1175 | 1189 |
1176 // Helpers. | 1190 // Helpers. |
1177 void LoadRegPlusOffsetToAt(const MemOperand& src); | 1191 void LoadRegPlusOffsetToAt(const MemOperand& src); |
1178 int32_t LoadRegPlusUpperOffsetPartToAt(const MemOperand& src); | 1192 int32_t LoadRegPlusUpperOffsetPartToAt(const MemOperand& src); |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1433 }; | 1447 }; |
1434 | 1448 |
1435 int32_t get_trampoline_entry(int32_t pos); | 1449 int32_t get_trampoline_entry(int32_t pos); |
1436 int unbound_labels_count_; | 1450 int unbound_labels_count_; |
1437 // If trampoline is emitted, generated code is becoming large. As this is | 1451 // If trampoline is emitted, generated code is becoming large. As this is |
1438 // already a slow case which can possibly break our code generation for the | 1452 // already a slow case which can possibly break our code generation for the |
1439 // extreme case, we use this information to trigger different mode of | 1453 // extreme case, we use this information to trigger different mode of |
1440 // branch instruction generation, where we use jump instructions rather | 1454 // branch instruction generation, where we use jump instructions rather |
1441 // than regular branch instructions. | 1455 // than regular branch instructions. |
1442 bool trampoline_emitted_; | 1456 bool trampoline_emitted_; |
1443 #ifdef _MIPS_ARCH_MIPS32R6 | |
1444 static const int kTrampolineSlotsSize = 2 * kInstrSize; | |
1445 #else | |
1446 static const int kTrampolineSlotsSize = 4 * kInstrSize; | |
1447 #endif | |
1448 static const int kMaxBranchOffset = (1 << (18 - 1)) - 1; | |
1449 static const int kMaxCompactBranchOffset = (1 << (28 - 1)) - 1; | |
1450 static const int kInvalidSlotPos = -1; | 1457 static const int kInvalidSlotPos = -1; |
1451 | 1458 |
1452 // Internal reference positions, required for unbounded internal reference | 1459 // Internal reference positions, required for unbounded internal reference |
1453 // labels. | 1460 // labels. |
1454 std::set<int> internal_reference_positions_; | 1461 std::set<int> internal_reference_positions_; |
1455 bool is_internal_reference(Label* L) { | 1462 bool is_internal_reference(Label* L) { |
1456 return internal_reference_positions_.find(L->pos()) != | 1463 return internal_reference_positions_.find(L->pos()) != |
1457 internal_reference_positions_.end(); | 1464 internal_reference_positions_.end(); |
1458 } | 1465 } |
1459 | 1466 |
(...skipping 16 matching lines...) Expand all Loading... |
1476 public: | 1483 public: |
1477 explicit EnsureSpace(Assembler* assembler) { | 1484 explicit EnsureSpace(Assembler* assembler) { |
1478 assembler->CheckBuffer(); | 1485 assembler->CheckBuffer(); |
1479 } | 1486 } |
1480 }; | 1487 }; |
1481 | 1488 |
1482 } // namespace internal | 1489 } // namespace internal |
1483 } // namespace v8 | 1490 } // namespace v8 |
1484 | 1491 |
1485 #endif // V8_ARM_ASSEMBLER_MIPS_H_ | 1492 #endif // V8_ARM_ASSEMBLER_MIPS_H_ |
OLD | NEW |