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 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1451 static const int kMaxNumPending32RelocInfo = kMaxDistToIntPool/kInstrSize; | 1451 static const int kMaxNumPending32RelocInfo = kMaxDistToIntPool/kInstrSize; |
1452 static const int kMaxNumPending64RelocInfo = kMaxDistToFPPool/kInstrSize; | 1452 static const int kMaxNumPending64RelocInfo = kMaxDistToFPPool/kInstrSize; |
1453 | 1453 |
1454 // Postpone the generation of the constant pool for the specified number of | 1454 // Postpone the generation of the constant pool for the specified number of |
1455 // instructions. | 1455 // instructions. |
1456 void BlockConstPoolFor(int instructions); | 1456 void BlockConstPoolFor(int instructions); |
1457 | 1457 |
1458 // Check if is time to emit a constant pool. | 1458 // Check if is time to emit a constant pool. |
1459 void CheckConstPool(bool force_emit, bool require_jump); | 1459 void CheckConstPool(bool force_emit, bool require_jump); |
1460 | 1460 |
| 1461 bool can_use_constant_pool() const { |
| 1462 return is_constant_pool_available() && !constant_pool_full_; |
| 1463 } |
| 1464 |
| 1465 void set_constant_pool_full() { |
| 1466 constant_pool_full_ = true; |
| 1467 } |
| 1468 |
1461 protected: | 1469 protected: |
1462 // Relocation for a type-recording IC has the AST id added to it. This | 1470 // Relocation for a type-recording IC has the AST id added to it. This |
1463 // member variable is a way to pass the information from the call site to | 1471 // member variable is a way to pass the information from the call site to |
1464 // the relocation info. | 1472 // the relocation info. |
1465 TypeFeedbackId recorded_ast_id_; | 1473 TypeFeedbackId recorded_ast_id_; |
1466 | 1474 |
1467 int buffer_space() const { return reloc_info_writer.pos() - pc_; } | 1475 int buffer_space() const { return reloc_info_writer.pos() - pc_; } |
1468 | 1476 |
1469 // Decode branch instruction at pos and return branch target pos | 1477 // Decode branch instruction at pos and return branch target pos |
1470 int target_at(int pos); | 1478 int target_at(int pos); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1504 // trigger a check. | 1512 // trigger a check. |
1505 next_buffer_check_ = no_const_pool_before_; | 1513 next_buffer_check_ = no_const_pool_before_; |
1506 } | 1514 } |
1507 } | 1515 } |
1508 | 1516 |
1509 bool is_const_pool_blocked() const { | 1517 bool is_const_pool_blocked() const { |
1510 return (const_pool_blocked_nesting_ > 0) || | 1518 return (const_pool_blocked_nesting_ > 0) || |
1511 (pc_offset() < no_const_pool_before_); | 1519 (pc_offset() < no_const_pool_before_); |
1512 } | 1520 } |
1513 | 1521 |
| 1522 bool is_constant_pool_available() const { |
| 1523 return constant_pool_available_; |
| 1524 } |
| 1525 |
| 1526 void set_constant_pool_available(bool available) { |
| 1527 constant_pool_available_ = available; |
| 1528 } |
| 1529 |
1514 private: | 1530 private: |
1515 int next_buffer_check_; // pc offset of next buffer check | 1531 int next_buffer_check_; // pc offset of next buffer check |
1516 | 1532 |
1517 // Code generation | 1533 // Code generation |
1518 // The relocation writer's position is at least kGap bytes below the end of | 1534 // The relocation writer's position is at least kGap bytes below the end of |
1519 // the generated instructions. This is so that multi-instruction sequences do | 1535 // the generated instructions. This is so that multi-instruction sequences do |
1520 // not have to check for overflow. The same is true for writes of large | 1536 // not have to check for overflow. The same is true for writes of large |
1521 // relocation info entries. | 1537 // relocation info entries. |
1522 static const int kGap = 32; | 1538 static const int kGap = 32; |
1523 | 1539 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1564 RelocInfo pending_32_bit_reloc_info_[kMaxNumPending32RelocInfo]; | 1580 RelocInfo pending_32_bit_reloc_info_[kMaxNumPending32RelocInfo]; |
1565 RelocInfo pending_64_bit_reloc_info_[kMaxNumPending64RelocInfo]; | 1581 RelocInfo pending_64_bit_reloc_info_[kMaxNumPending64RelocInfo]; |
1566 // Number of pending reloc info entries in the 32 bits buffer. | 1582 // Number of pending reloc info entries in the 32 bits buffer. |
1567 int num_pending_32_bit_reloc_info_; | 1583 int num_pending_32_bit_reloc_info_; |
1568 // Number of pending reloc info entries in the 64 bits buffer. | 1584 // Number of pending reloc info entries in the 64 bits buffer. |
1569 int num_pending_64_bit_reloc_info_; | 1585 int num_pending_64_bit_reloc_info_; |
1570 | 1586 |
1571 // The bound position, before this we cannot do instruction elimination. | 1587 // The bound position, before this we cannot do instruction elimination. |
1572 int last_bound_pos_; | 1588 int last_bound_pos_; |
1573 | 1589 |
| 1590 // Indicates whether the constant pool can be accessed, which is only possible |
| 1591 // if the pp register points to the current code object's constant pool. |
| 1592 bool constant_pool_available_; |
| 1593 // Indicates whether the constant pool is too full to accept new entries due |
| 1594 // to the ldr instruction's limitted immediate offset range. |
| 1595 bool constant_pool_full_; |
| 1596 |
1574 // Code emission | 1597 // Code emission |
1575 inline void CheckBuffer(); | 1598 inline void CheckBuffer(); |
1576 void GrowBuffer(); | 1599 void GrowBuffer(); |
1577 inline void emit(Instr x); | 1600 inline void emit(Instr x); |
1578 | 1601 |
1579 // 32-bit immediate values | 1602 // 32-bit immediate values |
1580 void move_32_bit_immediate(Register rd, | 1603 void move_32_bit_immediate(Register rd, |
1581 const Operand& x, | 1604 const Operand& x, |
1582 Condition cond = al); | 1605 Condition cond = al); |
1583 | 1606 |
(...skipping 16 matching lines...) Expand all Loading... |
1600 | 1623 |
1601 // Record reloc info for current pc_ | 1624 // Record reloc info for current pc_ |
1602 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0, | 1625 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0, |
1603 UseConstantPoolMode mode = USE_CONSTANT_POOL); | 1626 UseConstantPoolMode mode = USE_CONSTANT_POOL); |
1604 void RecordRelocInfo(double data); | 1627 void RecordRelocInfo(double data); |
1605 void RecordRelocInfoConstantPoolEntryHelper(const RelocInfo& rinfo); | 1628 void RecordRelocInfoConstantPoolEntryHelper(const RelocInfo& rinfo); |
1606 | 1629 |
1607 friend class RelocInfo; | 1630 friend class RelocInfo; |
1608 friend class CodePatcher; | 1631 friend class CodePatcher; |
1609 friend class BlockConstPoolScope; | 1632 friend class BlockConstPoolScope; |
| 1633 friend class FrameAndConstantPoolScope; |
| 1634 friend class ConstantPoolUnavailableScope; |
1610 | 1635 |
1611 PositionsRecorder positions_recorder_; | 1636 PositionsRecorder positions_recorder_; |
1612 friend class PositionsRecorder; | 1637 friend class PositionsRecorder; |
1613 friend class EnsureSpace; | 1638 friend class EnsureSpace; |
1614 }; | 1639 }; |
1615 | 1640 |
1616 | 1641 |
1617 class EnsureSpace BASE_EMBEDDED { | 1642 class EnsureSpace BASE_EMBEDDED { |
1618 public: | 1643 public: |
1619 explicit EnsureSpace(Assembler* assembler) { | 1644 explicit EnsureSpace(Assembler* assembler) { |
1620 assembler->CheckBuffer(); | 1645 assembler->CheckBuffer(); |
1621 } | 1646 } |
1622 }; | 1647 }; |
1623 | 1648 |
1624 | 1649 |
1625 } } // namespace v8::internal | 1650 } } // namespace v8::internal |
1626 | 1651 |
1627 #endif // V8_ARM_ASSEMBLER_ARM_H_ | 1652 #endif // V8_ARM_ASSEMBLER_ARM_H_ |
OLD | NEW |