| 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 bool constant_pool_available_; | 1633 bool constant_pool_available_; |
| 1591 bool constant_pool_full_; | 1634 bool constant_pool_full_; |
| 1592 | 1635 |
| 1593 // Code emission | 1636 // Code emission |
| 1594 inline void CheckBuffer(); | 1637 inline void CheckBuffer(); |
| 1595 void GrowBuffer(); | 1638 void GrowBuffer(); |
| 1596 inline void emit(Instr x); | 1639 inline void emit(Instr x); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1611 void print(Label* L); | 1654 void print(Label* L); |
| 1612 void bind_to(Label* L, int pos); | 1655 void bind_to(Label* L, int pos); |
| 1613 void next(Label* L); | 1656 void next(Label* L); |
| 1614 | 1657 |
| 1615 enum UseConstantPoolMode { | 1658 enum UseConstantPoolMode { |
| 1616 USE_CONSTANT_POOL, | 1659 USE_CONSTANT_POOL, |
| 1617 DONT_USE_CONSTANT_POOL | 1660 DONT_USE_CONSTANT_POOL |
| 1618 }; | 1661 }; |
| 1619 | 1662 |
| 1620 // Record reloc info for current pc_ | 1663 // Record reloc info for current pc_ |
| 1621 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0, | 1664 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0); |
| 1622 UseConstantPoolMode mode = USE_CONSTANT_POOL); | 1665 void RecordRelocInfo(const RelocInfo& rinfo); |
| 1623 void RecordRelocInfo(double data); | 1666 void ConstantPoolAddEntry(const RelocInfo& rinfo); |
| 1624 void RecordRelocInfoConstantPoolEntryHelper(const RelocInfo& rinfo); | |
| 1625 | 1667 |
| 1626 friend class RelocInfo; | 1668 friend class RelocInfo; |
| 1627 friend class CodePatcher; | 1669 friend class CodePatcher; |
| 1628 friend class BlockConstPoolScope; | 1670 friend class BlockConstPoolScope; |
| 1629 friend class FrameAndConstantPoolScope; | 1671 friend class FrameAndConstantPoolScope; |
| 1630 friend class ConstantPoolUnavailableScope; | 1672 friend class ConstantPoolUnavailableScope; |
| 1631 | 1673 |
| 1632 PositionsRecorder positions_recorder_; | 1674 PositionsRecorder positions_recorder_; |
| 1633 friend class PositionsRecorder; | 1675 friend class PositionsRecorder; |
| 1634 friend class EnsureSpace; | 1676 friend class EnsureSpace; |
| 1635 }; | 1677 }; |
| 1636 | 1678 |
| 1637 | 1679 |
| 1638 class EnsureSpace BASE_EMBEDDED { | 1680 class EnsureSpace BASE_EMBEDDED { |
| 1639 public: | 1681 public: |
| 1640 explicit EnsureSpace(Assembler* assembler) { | 1682 explicit EnsureSpace(Assembler* assembler) { |
| 1641 assembler->CheckBuffer(); | 1683 assembler->CheckBuffer(); |
| 1642 } | 1684 } |
| 1643 }; | 1685 }; |
| 1644 | 1686 |
| 1645 | 1687 |
| 1646 } } // namespace v8::internal | 1688 } } // namespace v8::internal |
| 1647 | 1689 |
| 1648 #endif // V8_ARM_ASSEMBLER_ARM_H_ | 1690 #endif // V8_ARM_ASSEMBLER_ARM_H_ |
| OLD | NEW |