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 | 5 // modification, are permitted provided that the following conditions |
6 // are met: | 6 // are 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 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1436 static bool IsMovT(Instr instr); | 1436 static bool IsMovT(Instr instr); |
1437 static bool IsMovW(Instr instr); | 1437 static bool IsMovW(Instr instr); |
1438 | 1438 |
1439 // Constants in pools are accessed via pc relative addressing, which can | 1439 // Constants in pools are accessed via pc relative addressing, which can |
1440 // reach +/-4KB for integer PC-relative loads and +/-1KB for floating-point | 1440 // reach +/-4KB for integer PC-relative loads and +/-1KB for floating-point |
1441 // PC-relative loads, thereby defining a maximum distance between the | 1441 // PC-relative loads, thereby defining a maximum distance between the |
1442 // instruction and the accessed constant. | 1442 // instruction and the accessed constant. |
1443 static const int kMaxDistToIntPool = 4*KB; | 1443 static const int kMaxDistToIntPool = 4*KB; |
1444 static const int kMaxDistToFPPool = 1*KB; | 1444 static const int kMaxDistToFPPool = 1*KB; |
1445 // All relocations could be integer, it therefore acts as the limit. | 1445 // All relocations could be integer, it therefore acts as the limit. |
1446 static const int kMaxNumPendingRelocInfo = kMaxDistToIntPool/kInstrSize; | 1446 static const int kMaxNumPending32RelocInfo = kMaxDistToIntPool/kInstrSize; |
| 1447 static const int kMaxNumPending64RelocInfo = kMaxDistToFPPool/kInstrSize; |
1447 | 1448 |
1448 // Postpone the generation of the constant pool for the specified number of | 1449 // Postpone the generation of the constant pool for the specified number of |
1449 // instructions. | 1450 // instructions. |
1450 void BlockConstPoolFor(int instructions); | 1451 void BlockConstPoolFor(int instructions); |
1451 | 1452 |
1452 // Check if is time to emit a constant pool. | 1453 // Check if is time to emit a constant pool. |
1453 void CheckConstPool(bool force_emit, bool require_jump); | 1454 void CheckConstPool(bool force_emit, bool require_jump); |
1454 | 1455 |
1455 protected: | 1456 protected: |
1456 // Relocation for a type-recording IC has the AST id added to it. This | 1457 // Relocation for a type-recording IC has the AST id added to it. This |
(...skipping 17 matching lines...) Expand all Loading... |
1474 // Prevent constant pool checks happening by setting the next check to | 1475 // Prevent constant pool checks happening by setting the next check to |
1475 // the biggest possible offset. | 1476 // the biggest possible offset. |
1476 next_buffer_check_ = kMaxInt; | 1477 next_buffer_check_ = kMaxInt; |
1477 } | 1478 } |
1478 } | 1479 } |
1479 | 1480 |
1480 // Resume constant pool emission. Need to be called as many time as | 1481 // Resume constant pool emission. Need to be called as many time as |
1481 // StartBlockConstPool to have an effect. | 1482 // StartBlockConstPool to have an effect. |
1482 void EndBlockConstPool() { | 1483 void EndBlockConstPool() { |
1483 if (--const_pool_blocked_nesting_ == 0) { | 1484 if (--const_pool_blocked_nesting_ == 0) { |
| 1485 #ifdef DEBUG |
| 1486 // Max pool start (if we need a jump and an alignment). |
| 1487 int start = pc_offset() + kInstrSize + 2 * kPointerSize; |
1484 // Check the constant pool hasn't been blocked for too long. | 1488 // Check the constant pool hasn't been blocked for too long. |
1485 ASSERT((num_pending_reloc_info_ == 0) || | 1489 ASSERT((num_pending_32_bit_reloc_info_ == 0) || |
1486 (pc_offset() < (first_const_pool_use_ + kMaxDistToIntPool))); | 1490 (start + num_pending_64_bit_reloc_info_ * kDoubleSize < |
| 1491 (first_const_pool_32_use_ + kMaxDistToIntPool))); |
1487 ASSERT((num_pending_64_bit_reloc_info_ == 0) || | 1492 ASSERT((num_pending_64_bit_reloc_info_ == 0) || |
1488 (pc_offset() < (first_const_pool_use_ + kMaxDistToFPPool))); | 1493 (start < (first_const_pool_64_use_ + kMaxDistToFPPool))); |
| 1494 #endif |
1489 // Two cases: | 1495 // Two cases: |
1490 // * no_const_pool_before_ >= next_buffer_check_ and the emission is | 1496 // * no_const_pool_before_ >= next_buffer_check_ and the emission is |
1491 // still blocked | 1497 // still blocked |
1492 // * no_const_pool_before_ < next_buffer_check_ and the next emit will | 1498 // * no_const_pool_before_ < next_buffer_check_ and the next emit will |
1493 // trigger a check. | 1499 // trigger a check. |
1494 next_buffer_check_ = no_const_pool_before_; | 1500 next_buffer_check_ = no_const_pool_before_; |
1495 } | 1501 } |
1496 } | 1502 } |
1497 | 1503 |
1498 bool is_const_pool_blocked() const { | 1504 bool is_const_pool_blocked() const { |
(...skipping 28 matching lines...) Expand all Loading... |
1527 static const int kCheckPoolIntervalInst = 32; | 1533 static const int kCheckPoolIntervalInst = 32; |
1528 static const int kCheckPoolInterval = kCheckPoolIntervalInst * kInstrSize; | 1534 static const int kCheckPoolInterval = kCheckPoolIntervalInst * kInstrSize; |
1529 | 1535 |
1530 | 1536 |
1531 // Emission of the constant pool may be blocked in some code sequences. | 1537 // Emission of the constant pool may be blocked in some code sequences. |
1532 int const_pool_blocked_nesting_; // Block emission if this is not zero. | 1538 int const_pool_blocked_nesting_; // Block emission if this is not zero. |
1533 int no_const_pool_before_; // Block emission before this pc offset. | 1539 int no_const_pool_before_; // Block emission before this pc offset. |
1534 | 1540 |
1535 // Keep track of the first instruction requiring a constant pool entry | 1541 // Keep track of the first instruction requiring a constant pool entry |
1536 // since the previous constant pool was emitted. | 1542 // since the previous constant pool was emitted. |
1537 int first_const_pool_use_; | 1543 int first_const_pool_32_use_; |
| 1544 int first_const_pool_64_use_; |
1538 | 1545 |
1539 // Relocation info generation | 1546 // Relocation info generation |
1540 // Each relocation is encoded as a variable size value | 1547 // Each relocation is encoded as a variable size value |
1541 static const int kMaxRelocSize = RelocInfoWriter::kMaxSize; | 1548 static const int kMaxRelocSize = RelocInfoWriter::kMaxSize; |
1542 RelocInfoWriter reloc_info_writer; | 1549 RelocInfoWriter reloc_info_writer; |
1543 | 1550 |
1544 // Relocation info records are also used during code generation as temporary | 1551 // Relocation info records are also used during code generation as temporary |
1545 // containers for constants and code target addresses until they are emitted | 1552 // containers for constants and code target addresses until they are emitted |
1546 // to the constant pool. These pending relocation info records are temporarily | 1553 // to the constant pool. These pending relocation info records are temporarily |
1547 // stored in a separate buffer until a constant pool is emitted. | 1554 // stored in a separate buffer until a constant pool is emitted. |
1548 // If every instruction in a long sequence is accessing the pool, we need one | 1555 // If every instruction in a long sequence is accessing the pool, we need one |
1549 // pending relocation entry per instruction. | 1556 // pending relocation entry per instruction. |
1550 | 1557 |
1551 // the buffer of pending relocation info | 1558 // The buffers of pending relocation info. |
1552 RelocInfo pending_reloc_info_[kMaxNumPendingRelocInfo]; | 1559 RelocInfo pending_32_bit_reloc_info_[kMaxNumPending32RelocInfo]; |
1553 // number of pending reloc info entries in the buffer | 1560 RelocInfo pending_64_bit_reloc_info_[kMaxNumPending64RelocInfo]; |
1554 int num_pending_reloc_info_; | 1561 // Number of pending reloc info entries in the 32 bits buffer. |
1555 // Number of pending reloc info entries included above which also happen to | 1562 int num_pending_32_bit_reloc_info_; |
1556 // be 64-bit. | 1563 // Number of pending reloc info entries in the 64 bits buffer. |
1557 int num_pending_64_bit_reloc_info_; | 1564 int num_pending_64_bit_reloc_info_; |
1558 | 1565 |
1559 // The bound position, before this we cannot do instruction elimination. | 1566 // The bound position, before this we cannot do instruction elimination. |
1560 int last_bound_pos_; | 1567 int last_bound_pos_; |
1561 | 1568 |
1562 // Code emission | 1569 // Code emission |
1563 inline void CheckBuffer(); | 1570 inline void CheckBuffer(); |
1564 void GrowBuffer(); | 1571 void GrowBuffer(); |
1565 inline void emit(Instr x); | 1572 inline void emit(Instr x); |
1566 | 1573 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1607 public: | 1614 public: |
1608 explicit EnsureSpace(Assembler* assembler) { | 1615 explicit EnsureSpace(Assembler* assembler) { |
1609 assembler->CheckBuffer(); | 1616 assembler->CheckBuffer(); |
1610 } | 1617 } |
1611 }; | 1618 }; |
1612 | 1619 |
1613 | 1620 |
1614 } } // namespace v8::internal | 1621 } } // namespace v8::internal |
1615 | 1622 |
1616 #endif // V8_ARM_ASSEMBLER_ARM_H_ | 1623 #endif // V8_ARM_ASSEMBLER_ARM_H_ |
OLD | NEW |