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 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1439 static const int kMaxNumPending32RelocInfo = kMaxDistToIntPool/kInstrSize; | 1439 static const int kMaxNumPending32RelocInfo = kMaxDistToIntPool/kInstrSize; |
1440 static const int kMaxNumPending64RelocInfo = kMaxDistToFPPool/kInstrSize; | 1440 static const int kMaxNumPending64RelocInfo = kMaxDistToFPPool/kInstrSize; |
1441 | 1441 |
1442 // Postpone the generation of the constant pool for the specified number of | 1442 // Postpone the generation of the constant pool for the specified number of |
1443 // instructions. | 1443 // instructions. |
1444 void BlockConstPoolFor(int instructions); | 1444 void BlockConstPoolFor(int instructions); |
1445 | 1445 |
1446 // Check if is time to emit a constant pool. | 1446 // Check if is time to emit a constant pool. |
1447 void CheckConstPool(bool force_emit, bool require_jump); | 1447 void CheckConstPool(bool force_emit, bool require_jump); |
1448 | 1448 |
1449 bool can_use_constant_pool() const { | |
1450 return is_constant_pool_available() && !constant_pool_full_; | |
1451 } | |
1452 | |
1453 void set_constant_pool_full() { | |
1454 constant_pool_full_ = true; | |
1455 } | |
1456 | |
1449 protected: | 1457 protected: |
1450 // Relocation for a type-recording IC has the AST id added to it. This | 1458 // Relocation for a type-recording IC has the AST id added to it. This |
1451 // member variable is a way to pass the information from the call site to | 1459 // member variable is a way to pass the information from the call site to |
1452 // the relocation info. | 1460 // the relocation info. |
1453 TypeFeedbackId recorded_ast_id_; | 1461 TypeFeedbackId recorded_ast_id_; |
1454 | 1462 |
1455 int buffer_space() const { return reloc_info_writer.pos() - pc_; } | 1463 int buffer_space() const { return reloc_info_writer.pos() - pc_; } |
1456 | 1464 |
1457 // Decode branch instruction at pos and return branch target pos | 1465 // Decode branch instruction at pos and return branch target pos |
1458 int target_at(int pos); | 1466 int target_at(int pos); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1492 // trigger a check. | 1500 // trigger a check. |
1493 next_buffer_check_ = no_const_pool_before_; | 1501 next_buffer_check_ = no_const_pool_before_; |
1494 } | 1502 } |
1495 } | 1503 } |
1496 | 1504 |
1497 bool is_const_pool_blocked() const { | 1505 bool is_const_pool_blocked() const { |
1498 return (const_pool_blocked_nesting_ > 0) || | 1506 return (const_pool_blocked_nesting_ > 0) || |
1499 (pc_offset() < no_const_pool_before_); | 1507 (pc_offset() < no_const_pool_before_); |
1500 } | 1508 } |
1501 | 1509 |
1510 bool is_constant_pool_available() const { | |
1511 return constant_pool_available_; | |
1512 } | |
1513 | |
1514 void set_constant_pool_available(bool available) { | |
1515 constant_pool_available_ = available; | |
1516 } | |
1517 | |
1502 private: | 1518 private: |
1503 int next_buffer_check_; // pc offset of next buffer check | 1519 int next_buffer_check_; // pc offset of next buffer check |
1504 | 1520 |
1505 // Code generation | 1521 // Code generation |
1506 // The relocation writer's position is at least kGap bytes below the end of | 1522 // The relocation writer's position is at least kGap bytes below the end of |
1507 // the generated instructions. This is so that multi-instruction sequences do | 1523 // the generated instructions. This is so that multi-instruction sequences do |
1508 // not have to check for overflow. The same is true for writes of large | 1524 // not have to check for overflow. The same is true for writes of large |
1509 // relocation info entries. | 1525 // relocation info entries. |
1510 static const int kGap = 32; | 1526 static const int kGap = 32; |
1511 | 1527 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1552 RelocInfo pending_32_bit_reloc_info_[kMaxNumPending32RelocInfo]; | 1568 RelocInfo pending_32_bit_reloc_info_[kMaxNumPending32RelocInfo]; |
1553 RelocInfo pending_64_bit_reloc_info_[kMaxNumPending64RelocInfo]; | 1569 RelocInfo pending_64_bit_reloc_info_[kMaxNumPending64RelocInfo]; |
1554 // Number of pending reloc info entries in the 32 bits buffer. | 1570 // Number of pending reloc info entries in the 32 bits buffer. |
1555 int num_pending_32_bit_reloc_info_; | 1571 int num_pending_32_bit_reloc_info_; |
1556 // Number of pending reloc info entries in the 64 bits buffer. | 1572 // Number of pending reloc info entries in the 64 bits buffer. |
1557 int num_pending_64_bit_reloc_info_; | 1573 int num_pending_64_bit_reloc_info_; |
1558 | 1574 |
1559 // The bound position, before this we cannot do instruction elimination. | 1575 // The bound position, before this we cannot do instruction elimination. |
1560 int last_bound_pos_; | 1576 int last_bound_pos_; |
1561 | 1577 |
1578 bool constant_pool_available_; | |
1579 bool constant_pool_full_; | |
ulan
2014/03/11 13:00:46
Could you add a comment explaining what constant_p
rmcilroy
2014/03/11 16:36:34
Done (and for constant_pool_available)
| |
1580 | |
1562 // Code emission | 1581 // Code emission |
1563 inline void CheckBuffer(); | 1582 inline void CheckBuffer(); |
1564 void GrowBuffer(); | 1583 void GrowBuffer(); |
1565 inline void emit(Instr x); | 1584 inline void emit(Instr x); |
1566 | 1585 |
1567 // 32-bit immediate values | 1586 // 32-bit immediate values |
1568 void move_32_bit_immediate(Condition cond, | 1587 void move_32_bit_immediate(Condition cond, |
1569 Register rd, | 1588 Register rd, |
1570 SBit s, | 1589 SBit s, |
1571 const Operand& x); | 1590 const Operand& x); |
(...skipping 17 matching lines...) Expand all Loading... | |
1589 | 1608 |
1590 // Record reloc info for current pc_ | 1609 // Record reloc info for current pc_ |
1591 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0, | 1610 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0, |
1592 UseConstantPoolMode mode = USE_CONSTANT_POOL); | 1611 UseConstantPoolMode mode = USE_CONSTANT_POOL); |
1593 void RecordRelocInfo(double data); | 1612 void RecordRelocInfo(double data); |
1594 void RecordRelocInfoConstantPoolEntryHelper(const RelocInfo& rinfo); | 1613 void RecordRelocInfoConstantPoolEntryHelper(const RelocInfo& rinfo); |
1595 | 1614 |
1596 friend class RelocInfo; | 1615 friend class RelocInfo; |
1597 friend class CodePatcher; | 1616 friend class CodePatcher; |
1598 friend class BlockConstPoolScope; | 1617 friend class BlockConstPoolScope; |
1618 friend class FrameAndConstantPoolScope; | |
1619 friend class ConstantPoolUnavailableScope; | |
1599 | 1620 |
1600 PositionsRecorder positions_recorder_; | 1621 PositionsRecorder positions_recorder_; |
1601 friend class PositionsRecorder; | 1622 friend class PositionsRecorder; |
1602 friend class EnsureSpace; | 1623 friend class EnsureSpace; |
1603 }; | 1624 }; |
1604 | 1625 |
1605 | 1626 |
1606 class EnsureSpace BASE_EMBEDDED { | 1627 class EnsureSpace BASE_EMBEDDED { |
1607 public: | 1628 public: |
1608 explicit EnsureSpace(Assembler* assembler) { | 1629 explicit EnsureSpace(Assembler* assembler) { |
1609 assembler->CheckBuffer(); | 1630 assembler->CheckBuffer(); |
1610 } | 1631 } |
1611 }; | 1632 }; |
1612 | 1633 |
1613 | 1634 |
1614 } } // namespace v8::internal | 1635 } } // namespace v8::internal |
1615 | 1636 |
1616 #endif // V8_ARM_ASSEMBLER_ARM_H_ | 1637 #endif // V8_ARM_ASSEMBLER_ARM_H_ |
OLD | NEW |