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 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 class NeonListOperand BASE_EMBEDDED { | 695 class NeonListOperand BASE_EMBEDDED { |
696 public: | 696 public: |
697 explicit NeonListOperand(DoubleRegister base, int registers_count = 1); | 697 explicit NeonListOperand(DoubleRegister base, int registers_count = 1); |
698 DoubleRegister base() const { return base_; } | 698 DoubleRegister base() const { return base_; } |
699 NeonListType type() const { return type_; } | 699 NeonListType type() const { return type_; } |
700 private: | 700 private: |
701 DoubleRegister base_; | 701 DoubleRegister base_; |
702 NeonListType type_; | 702 NeonListType type_; |
703 }; | 703 }; |
704 | 704 |
| 705 |
| 706 // Class used to build a constant pool. |
| 707 class ConstantPoolBuilder BASE_EMBEDDED { |
| 708 public: |
| 709 explicit ConstantPoolBuilder(); |
| 710 ~ConstantPoolBuilder(); |
| 711 void AddEntry(Assembler* assm, const RelocInfo& rinfo); |
| 712 void Relocate(int pc_delta); |
| 713 bool IsEmpty(); |
| 714 void Populate(Assembler* assm, ConstantPoolArray* constant_pool); |
| 715 |
| 716 inline int count_of_64bit() const { return count_of_64bit_; } |
| 717 inline int count_of_code_ptr() const { return count_of_code_ptr_; } |
| 718 inline int count_of_heap_ptr() const { return count_of_heap_ptr_; } |
| 719 inline int count_of_32bit() const { return count_of_32bit_; } |
| 720 |
| 721 private: |
| 722 bool Is64BitEntry(RelocInfo::Mode rmode); |
| 723 bool Is32BitEntry(RelocInfo::Mode rmode); |
| 724 bool IsCodePtrEntry(RelocInfo::Mode rmode); |
| 725 bool IsHeapPtrEntry(RelocInfo::Mode rmode); |
| 726 void GrowBuffer(); |
| 727 |
| 728 RelocInfo* entries_; |
| 729 int* merged_indexes_; |
| 730 int buffer_size_; |
| 731 int number_of_entries_; |
| 732 int count_of_64bit_; |
| 733 int count_of_code_ptr_; |
| 734 int count_of_heap_ptr_; |
| 735 int count_of_32bit_; |
| 736 }; |
| 737 |
| 738 |
705 extern const Instr kMovLrPc; | 739 extern const Instr kMovLrPc; |
706 extern const Instr kLdrPCMask; | 740 extern const Instr kLdrPCMask; |
707 extern const Instr kLdrPCPattern; | 741 extern const Instr kLdrPCPattern; |
| 742 extern const Instr kLdrPpMask; |
| 743 extern const Instr kLdrPpPattern; |
708 extern const Instr kBlxRegMask; | 744 extern const Instr kBlxRegMask; |
709 extern const Instr kBlxRegPattern; | 745 extern const Instr kBlxRegPattern; |
710 extern const Instr kBlxIp; | 746 extern const Instr kBlxIp; |
711 | 747 |
712 extern const Instr kMovMvnMask; | 748 extern const Instr kMovMvnMask; |
713 extern const Instr kMovMvnPattern; | 749 extern const Instr kMovMvnPattern; |
714 extern const Instr kMovMvnFlip; | 750 extern const Instr kMovMvnFlip; |
715 | 751 |
716 extern const Instr kMovLeaveCCMask; | 752 extern const Instr kMovLeaveCCMask; |
717 extern const Instr kMovLeaveCCPattern; | 753 extern const Instr kMovLeaveCCPattern; |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1406 } | 1442 } |
1407 static Instr instr_at(byte* pc) { return *reinterpret_cast<Instr*>(pc); } | 1443 static Instr instr_at(byte* pc) { return *reinterpret_cast<Instr*>(pc); } |
1408 static void instr_at_put(byte* pc, Instr instr) { | 1444 static void instr_at_put(byte* pc, Instr instr) { |
1409 *reinterpret_cast<Instr*>(pc) = instr; | 1445 *reinterpret_cast<Instr*>(pc) = instr; |
1410 } | 1446 } |
1411 static Condition GetCondition(Instr instr); | 1447 static Condition GetCondition(Instr instr); |
1412 static bool IsBranch(Instr instr); | 1448 static bool IsBranch(Instr instr); |
1413 static int GetBranchOffset(Instr instr); | 1449 static int GetBranchOffset(Instr instr); |
1414 static bool IsLdrRegisterImmediate(Instr instr); | 1450 static bool IsLdrRegisterImmediate(Instr instr); |
1415 static bool IsVldrDRegisterImmediate(Instr instr); | 1451 static bool IsVldrDRegisterImmediate(Instr instr); |
| 1452 static bool IsLdrPpImmediateOffset(Instr instr); |
| 1453 static bool IsVldrDPpImmediateOffset(Instr instr); |
1416 static int GetLdrRegisterImmediateOffset(Instr instr); | 1454 static int GetLdrRegisterImmediateOffset(Instr instr); |
1417 static int GetVldrDRegisterImmediateOffset(Instr instr); | 1455 static int GetVldrDRegisterImmediateOffset(Instr instr); |
1418 static Instr SetLdrRegisterImmediateOffset(Instr instr, int offset); | 1456 static Instr SetLdrRegisterImmediateOffset(Instr instr, int offset); |
1419 static Instr SetVldrDRegisterImmediateOffset(Instr instr, int offset); | 1457 static Instr SetVldrDRegisterImmediateOffset(Instr instr, int offset); |
1420 static bool IsStrRegisterImmediate(Instr instr); | 1458 static bool IsStrRegisterImmediate(Instr instr); |
1421 static Instr SetStrRegisterImmediateOffset(Instr instr, int offset); | 1459 static Instr SetStrRegisterImmediateOffset(Instr instr, int offset); |
1422 static bool IsAddRegisterImmediate(Instr instr); | 1460 static bool IsAddRegisterImmediate(Instr instr); |
1423 static Instr SetAddRegisterImmediateOffset(Instr instr, int offset); | 1461 static Instr SetAddRegisterImmediateOffset(Instr instr, int offset); |
1424 static Register GetRd(Instr instr); | 1462 static Register GetRd(Instr instr); |
1425 static Register GetRn(Instr instr); | 1463 static Register GetRn(Instr instr); |
(...skipping 25 matching lines...) Expand all Loading... |
1451 static const int kMaxNumPending32RelocInfo = kMaxDistToIntPool/kInstrSize; | 1489 static const int kMaxNumPending32RelocInfo = kMaxDistToIntPool/kInstrSize; |
1452 static const int kMaxNumPending64RelocInfo = kMaxDistToFPPool/kInstrSize; | 1490 static const int kMaxNumPending64RelocInfo = kMaxDistToFPPool/kInstrSize; |
1453 | 1491 |
1454 // Postpone the generation of the constant pool for the specified number of | 1492 // Postpone the generation of the constant pool for the specified number of |
1455 // instructions. | 1493 // instructions. |
1456 void BlockConstPoolFor(int instructions); | 1494 void BlockConstPoolFor(int instructions); |
1457 | 1495 |
1458 // Check if is time to emit a constant pool. | 1496 // Check if is time to emit a constant pool. |
1459 void CheckConstPool(bool force_emit, bool require_jump); | 1497 void CheckConstPool(bool force_emit, bool require_jump); |
1460 | 1498 |
| 1499 // Generate the constant pool for the generated code. |
| 1500 void PopulateConstantPool(ConstantPoolArray* constant_pool); |
| 1501 |
1461 bool can_use_constant_pool() const { | 1502 bool can_use_constant_pool() const { |
1462 return is_constant_pool_available() && !constant_pool_full_; | 1503 return is_constant_pool_available() && !constant_pool_full_; |
1463 } | 1504 } |
1464 | 1505 |
1465 void set_constant_pool_full() { | 1506 void set_constant_pool_full() { |
1466 constant_pool_full_ = true; | 1507 constant_pool_full_ = true; |
1467 } | 1508 } |
1468 | 1509 |
1469 protected: | 1510 protected: |
1470 // Relocation for a type-recording IC has the AST id added to it. This | 1511 // Relocation for a type-recording IC has the AST id added to it. This |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1577 // pending relocation entry per instruction. | 1618 // pending relocation entry per instruction. |
1578 | 1619 |
1579 // The buffers of pending relocation info. | 1620 // The buffers of pending relocation info. |
1580 RelocInfo pending_32_bit_reloc_info_[kMaxNumPending32RelocInfo]; | 1621 RelocInfo pending_32_bit_reloc_info_[kMaxNumPending32RelocInfo]; |
1581 RelocInfo pending_64_bit_reloc_info_[kMaxNumPending64RelocInfo]; | 1622 RelocInfo pending_64_bit_reloc_info_[kMaxNumPending64RelocInfo]; |
1582 // Number of pending reloc info entries in the 32 bits buffer. | 1623 // Number of pending reloc info entries in the 32 bits buffer. |
1583 int num_pending_32_bit_reloc_info_; | 1624 int num_pending_32_bit_reloc_info_; |
1584 // Number of pending reloc info entries in the 64 bits buffer. | 1625 // Number of pending reloc info entries in the 64 bits buffer. |
1585 int num_pending_64_bit_reloc_info_; | 1626 int num_pending_64_bit_reloc_info_; |
1586 | 1627 |
| 1628 ConstantPoolBuilder constant_pool_builder_; |
| 1629 |
1587 // The bound position, before this we cannot do instruction elimination. | 1630 // The bound position, before this we cannot do instruction elimination. |
1588 int last_bound_pos_; | 1631 int last_bound_pos_; |
1589 | 1632 |
1590 // Indicates whether the constant pool can be accessed, which is only possible | 1633 // 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. | 1634 // if the pp register points to the current code object's constant pool. |
1592 bool constant_pool_available_; | 1635 bool constant_pool_available_; |
1593 // Indicates whether the constant pool is too full to accept new entries due | 1636 // Indicates whether the constant pool is too full to accept new entries due |
1594 // to the ldr instruction's limitted immediate offset range. | 1637 // to the ldr instruction's limitted immediate offset range. |
1595 bool constant_pool_full_; | 1638 bool constant_pool_full_; |
1596 | 1639 |
(...skipping 18 matching lines...) Expand all Loading... |
1615 void print(Label* L); | 1658 void print(Label* L); |
1616 void bind_to(Label* L, int pos); | 1659 void bind_to(Label* L, int pos); |
1617 void next(Label* L); | 1660 void next(Label* L); |
1618 | 1661 |
1619 enum UseConstantPoolMode { | 1662 enum UseConstantPoolMode { |
1620 USE_CONSTANT_POOL, | 1663 USE_CONSTANT_POOL, |
1621 DONT_USE_CONSTANT_POOL | 1664 DONT_USE_CONSTANT_POOL |
1622 }; | 1665 }; |
1623 | 1666 |
1624 // Record reloc info for current pc_ | 1667 // Record reloc info for current pc_ |
1625 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0, | 1668 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0); |
1626 UseConstantPoolMode mode = USE_CONSTANT_POOL); | 1669 void RecordRelocInfo(const RelocInfo& rinfo); |
1627 void RecordRelocInfo(double data); | 1670 void ConstantPoolAddEntry(const RelocInfo& rinfo); |
1628 void RecordRelocInfoConstantPoolEntryHelper(const RelocInfo& rinfo); | |
1629 | 1671 |
1630 friend class RelocInfo; | 1672 friend class RelocInfo; |
1631 friend class CodePatcher; | 1673 friend class CodePatcher; |
1632 friend class BlockConstPoolScope; | 1674 friend class BlockConstPoolScope; |
1633 friend class FrameAndConstantPoolScope; | 1675 friend class FrameAndConstantPoolScope; |
1634 friend class ConstantPoolUnavailableScope; | 1676 friend class ConstantPoolUnavailableScope; |
1635 | 1677 |
1636 PositionsRecorder positions_recorder_; | 1678 PositionsRecorder positions_recorder_; |
1637 friend class PositionsRecorder; | 1679 friend class PositionsRecorder; |
1638 friend class EnsureSpace; | 1680 friend class EnsureSpace; |
1639 }; | 1681 }; |
1640 | 1682 |
1641 | 1683 |
1642 class EnsureSpace BASE_EMBEDDED { | 1684 class EnsureSpace BASE_EMBEDDED { |
1643 public: | 1685 public: |
1644 explicit EnsureSpace(Assembler* assembler) { | 1686 explicit EnsureSpace(Assembler* assembler) { |
1645 assembler->CheckBuffer(); | 1687 assembler->CheckBuffer(); |
1646 } | 1688 } |
1647 }; | 1689 }; |
1648 | 1690 |
1649 | 1691 |
1650 } } // namespace v8::internal | 1692 } } // namespace v8::internal |
1651 | 1693 |
1652 #endif // V8_ARM_ASSEMBLER_ARM_H_ | 1694 #endif // V8_ARM_ASSEMBLER_ARM_H_ |
OLD | NEW |