Chromium Code Reviews| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 const int kRegister_fp_Code = 11; | 87 const int kRegister_fp_Code = 11; |
| 88 const int kRegister_ip_Code = 12; | 88 const int kRegister_ip_Code = 12; |
| 89 const int kRegister_sp_Code = 13; | 89 const int kRegister_sp_Code = 13; |
| 90 const int kRegister_lr_Code = 14; | 90 const int kRegister_lr_Code = 14; |
| 91 const int kRegister_pc_Code = 15; | 91 const int kRegister_pc_Code = 15; |
| 92 | 92 |
| 93 // Core register | 93 // Core register |
| 94 struct Register { | 94 struct Register { |
| 95 static const int kNumRegisters = 16; | 95 static const int kNumRegisters = 16; |
| 96 static const int kMaxNumAllocatableRegisters = | 96 static const int kMaxNumAllocatableRegisters = |
| 97 FLAG_enable_ool_constant_pool ? 8 : 9; | 97 FLAG_enable_embedded_constant_pool ? 8 : 9; |
| 98 static const int kSizeInBytes = 4; | 98 static const int kSizeInBytes = 4; |
| 99 | 99 |
| 100 inline static int NumAllocatableRegisters(); | 100 inline static int NumAllocatableRegisters(); |
| 101 | 101 |
| 102 static int ToAllocationIndex(Register reg) { | 102 static int ToAllocationIndex(Register reg) { |
| 103 DCHECK(reg.code() < kMaxNumAllocatableRegisters); | 103 DCHECK(reg.code() < kMaxNumAllocatableRegisters); |
| 104 return reg.code(); | 104 return reg.code(); |
| 105 } | 105 } |
| 106 | 106 |
| 107 static Register FromAllocationIndex(int index) { | 107 static Register FromAllocationIndex(int index) { |
| 108 DCHECK(index >= 0 && index < kMaxNumAllocatableRegisters); | 108 DCHECK(index >= 0 && index < kMaxNumAllocatableRegisters); |
| 109 return from_code(index); | 109 return from_code(index); |
| 110 } | 110 } |
| 111 | 111 |
| 112 static const char* AllocationIndexToString(int index) { | 112 static const char* AllocationIndexToString(int index) { |
| 113 DCHECK(index >= 0 && index < kMaxNumAllocatableRegisters); | 113 DCHECK(index >= 0 && index < kMaxNumAllocatableRegisters); |
| 114 const char* const names[] = { | 114 const char* const names[] = { |
| 115 "r0", | 115 "r0", |
| 116 "r1", | 116 "r1", |
| 117 "r2", | 117 "r2", |
| 118 "r3", | 118 "r3", |
| 119 "r4", | 119 "r4", |
| 120 "r5", | 120 "r5", |
| 121 "r6", | 121 "r6", |
| 122 "r7", | 122 "r7", |
| 123 "r8", | 123 "r8", |
| 124 }; | 124 }; |
| 125 if (FLAG_enable_ool_constant_pool && (index >= 7)) { | 125 if (FLAG_enable_embedded_constant_pool && (index >= 7)) { |
| 126 return names[index + 1]; | 126 return names[index + 1]; |
| 127 } | 127 } |
| 128 return names[index]; | 128 return names[index]; |
| 129 } | 129 } |
| 130 | 130 |
| 131 static Register from_code(int code) { | 131 static Register from_code(int code) { |
| 132 Register r = { code }; | 132 Register r = { code }; |
| 133 return r; | 133 return r; |
| 134 } | 134 } |
| 135 | 135 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 157 | 157 |
| 158 const Register r0 = { kRegister_r0_Code }; | 158 const Register r0 = { kRegister_r0_Code }; |
| 159 const Register r1 = { kRegister_r1_Code }; | 159 const Register r1 = { kRegister_r1_Code }; |
| 160 const Register r2 = { kRegister_r2_Code }; | 160 const Register r2 = { kRegister_r2_Code }; |
| 161 const Register r3 = { kRegister_r3_Code }; | 161 const Register r3 = { kRegister_r3_Code }; |
| 162 const Register r4 = { kRegister_r4_Code }; | 162 const Register r4 = { kRegister_r4_Code }; |
| 163 const Register r5 = { kRegister_r5_Code }; | 163 const Register r5 = { kRegister_r5_Code }; |
| 164 const Register r6 = { kRegister_r6_Code }; | 164 const Register r6 = { kRegister_r6_Code }; |
| 165 // Used as context register. | 165 // Used as context register. |
| 166 const Register r7 = {kRegister_r7_Code}; | 166 const Register r7 = {kRegister_r7_Code}; |
| 167 // Used as constant pool pointer register if FLAG_enable_ool_constant_pool. | 167 // Used as constant pool pointer register if FLAG_enable_embedded_constant_pool. |
| 168 const Register r8 = { kRegister_r8_Code }; | 168 const Register r8 = { kRegister_r8_Code }; |
| 169 // Used as lithium codegen scratch register. | 169 // Used as lithium codegen scratch register. |
| 170 const Register r9 = { kRegister_r9_Code }; | 170 const Register r9 = { kRegister_r9_Code }; |
| 171 // Used as roots register. | 171 // Used as roots register. |
| 172 const Register r10 = { kRegister_r10_Code }; | 172 const Register r10 = { kRegister_r10_Code }; |
| 173 const Register fp = { kRegister_fp_Code }; | 173 const Register fp = { kRegister_fp_Code }; |
| 174 const Register ip = { kRegister_ip_Code }; | 174 const Register ip = { kRegister_ip_Code }; |
| 175 const Register sp = { kRegister_sp_Code }; | 175 const Register sp = { kRegister_sp_Code }; |
| 176 const Register lr = { kRegister_lr_Code }; | 176 const Register lr = { kRegister_lr_Code }; |
| 177 const Register pc = { kRegister_pc_Code }; | 177 const Register pc = { kRegister_pc_Code }; |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 644 public: | 644 public: |
| 645 explicit NeonListOperand(DoubleRegister base, int registers_count = 1); | 645 explicit NeonListOperand(DoubleRegister base, int registers_count = 1); |
| 646 DoubleRegister base() const { return base_; } | 646 DoubleRegister base() const { return base_; } |
| 647 NeonListType type() const { return type_; } | 647 NeonListType type() const { return type_; } |
| 648 private: | 648 private: |
| 649 DoubleRegister base_; | 649 DoubleRegister base_; |
| 650 NeonListType type_; | 650 NeonListType type_; |
| 651 }; | 651 }; |
| 652 | 652 |
| 653 | 653 |
| 654 // Class used to build a constant pool. | |
| 655 class ConstantPoolBuilder BASE_EMBEDDED { | |
| 656 public: | |
| 657 ConstantPoolBuilder(); | |
| 658 ConstantPoolArray::LayoutSection AddEntry(Assembler* assm, | |
| 659 const RelocInfo& rinfo); | |
| 660 void Relocate(int pc_delta); | |
| 661 bool IsEmpty(); | |
| 662 Handle<ConstantPoolArray> New(Isolate* isolate); | |
| 663 void Populate(Assembler* assm, ConstantPoolArray* constant_pool); | |
| 664 | |
| 665 inline ConstantPoolArray::LayoutSection current_section() const { | |
| 666 return current_section_; | |
| 667 } | |
| 668 | |
| 669 inline ConstantPoolArray::NumberOfEntries* number_of_entries( | |
| 670 ConstantPoolArray::LayoutSection section) { | |
| 671 return &number_of_entries_[section]; | |
| 672 } | |
| 673 | |
| 674 inline ConstantPoolArray::NumberOfEntries* small_entries() { | |
| 675 return number_of_entries(ConstantPoolArray::SMALL_SECTION); | |
| 676 } | |
| 677 | |
| 678 inline ConstantPoolArray::NumberOfEntries* extended_entries() { | |
| 679 return number_of_entries(ConstantPoolArray::EXTENDED_SECTION); | |
| 680 } | |
| 681 | |
| 682 private: | |
| 683 struct ConstantPoolEntry { | |
| 684 ConstantPoolEntry(RelocInfo rinfo, ConstantPoolArray::LayoutSection section, | |
| 685 int merged_index) | |
| 686 : rinfo_(rinfo), section_(section), merged_index_(merged_index) {} | |
| 687 | |
| 688 RelocInfo rinfo_; | |
| 689 ConstantPoolArray::LayoutSection section_; | |
| 690 int merged_index_; | |
| 691 }; | |
| 692 | |
| 693 ConstantPoolArray::Type GetConstantPoolType(RelocInfo::Mode rmode); | |
| 694 | |
| 695 std::vector<ConstantPoolEntry> entries_; | |
| 696 ConstantPoolArray::LayoutSection current_section_; | |
| 697 ConstantPoolArray::NumberOfEntries number_of_entries_[2]; | |
| 698 }; | |
| 699 | |
| 700 struct VmovIndex { | 654 struct VmovIndex { |
| 701 unsigned char index; | 655 unsigned char index; |
| 702 }; | 656 }; |
| 703 const VmovIndex VmovIndexLo = { 0 }; | 657 const VmovIndex VmovIndexLo = { 0 }; |
| 704 const VmovIndex VmovIndexHi = { 1 }; | 658 const VmovIndex VmovIndexHi = { 1 }; |
| 705 | 659 |
| 706 class Assembler : public AssemblerBase { | 660 class Assembler : public AssemblerBase { |
| 707 public: | 661 public: |
| 708 // Create an assembler. Instructions and relocation information are emitted | 662 // Create an assembler. Instructions and relocation information are emitted |
| 709 // into a buffer, with the instructions starting from the beginning and the | 663 // into a buffer, with the instructions starting from the beginning and the |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 747 // Links the label to the current position if it is still unbound | 701 // Links the label to the current position if it is still unbound |
| 748 // Manages the jump elimination optimization if the second parameter is true. | 702 // Manages the jump elimination optimization if the second parameter is true. |
| 749 int branch_offset(Label* L, bool jump_elimination_allowed); | 703 int branch_offset(Label* L, bool jump_elimination_allowed); |
| 750 | 704 |
| 751 // Returns true if the given pc address is the start of a constant pool load | 705 // Returns true if the given pc address is the start of a constant pool load |
| 752 // instruction sequence. | 706 // instruction sequence. |
| 753 INLINE(static bool is_constant_pool_load(Address pc)); | 707 INLINE(static bool is_constant_pool_load(Address pc)); |
| 754 | 708 |
| 755 // Return the address in the constant pool of the code target address used by | 709 // Return the address in the constant pool of the code target address used by |
| 756 // the branch/call instruction at pc, or the object in a mov. | 710 // the branch/call instruction at pc, or the object in a mov. |
| 757 INLINE(static Address constant_pool_entry_address( | 711 INLINE(static Address constant_pool_entry_address(Address pc, |
| 758 Address pc, ConstantPoolArray* constant_pool)); | 712 Address constant_pool)); |
| 759 | 713 |
| 760 // Read/Modify the code target address in the branch/call instruction at pc. | 714 // Read/Modify the code target address in the branch/call instruction at pc. |
| 761 INLINE(static Address target_address_at(Address pc, | 715 INLINE(static Address target_address_at(Address pc, Address constant_pool)); |
| 762 ConstantPoolArray* constant_pool)); | 716 INLINE(static void set_target_address_at( |
| 763 INLINE(static void set_target_address_at(Address pc, | 717 Address pc, Address constant_pool, Address target, |
| 764 ConstantPoolArray* constant_pool, | 718 ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED)); |
| 765 Address target, | |
| 766 ICacheFlushMode icache_flush_mode = | |
| 767 FLUSH_ICACHE_IF_NEEDED)); | |
| 768 INLINE(static Address target_address_at(Address pc, Code* code)) { | 719 INLINE(static Address target_address_at(Address pc, Code* code)) { |
| 769 ConstantPoolArray* constant_pool = code ? code->constant_pool() : NULL; | 720 Address constant_pool = code ? code->constant_pool() : NULL; |
| 770 return target_address_at(pc, constant_pool); | 721 return target_address_at(pc, constant_pool); |
| 771 } | 722 } |
| 772 INLINE(static void set_target_address_at(Address pc, | 723 INLINE(static void set_target_address_at(Address pc, |
| 773 Code* code, | 724 Code* code, |
| 774 Address target, | 725 Address target, |
| 775 ICacheFlushMode icache_flush_mode = | 726 ICacheFlushMode icache_flush_mode = |
| 776 FLUSH_ICACHE_IF_NEEDED)) { | 727 FLUSH_ICACHE_IF_NEEDED)) { |
| 777 ConstantPoolArray* constant_pool = code ? code->constant_pool() : NULL; | 728 Address constant_pool = code ? code->constant_pool() : NULL; |
| 778 set_target_address_at(pc, constant_pool, target, icache_flush_mode); | 729 set_target_address_at(pc, constant_pool, target, icache_flush_mode); |
| 779 } | 730 } |
| 780 | 731 |
| 781 // Return the code target address at a call site from the return address | 732 // Return the code target address at a call site from the return address |
| 782 // of that call in the instruction stream. | 733 // of that call in the instruction stream. |
| 783 INLINE(static Address target_address_from_return_address(Address pc)); | 734 INLINE(static Address target_address_from_return_address(Address pc)); |
| 784 | 735 |
| 785 // Given the address of the beginning of a call, return the address | 736 // Given the address of the beginning of a call, return the address |
| 786 // in the instruction stream that the call will return from. | 737 // in the instruction stream that the call will return from. |
| 787 INLINE(static Address return_address_from_call_start(Address pc)); | 738 INLINE(static Address return_address_from_call_start(Address pc)); |
| (...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1444 // Recording the position and size of emitted constant pools allows to | 1395 // Recording the position and size of emitted constant pools allows to |
| 1445 // correctly compute the offset mappings between the different versions of a | 1396 // correctly compute the offset mappings between the different versions of a |
| 1446 // function in all situations. | 1397 // function in all situations. |
| 1447 // | 1398 // |
| 1448 // The parameter indicates the size of the constant pool (in bytes), including | 1399 // The parameter indicates the size of the constant pool (in bytes), including |
| 1449 // the marker and branch over the data. | 1400 // the marker and branch over the data. |
| 1450 void RecordConstPool(int size); | 1401 void RecordConstPool(int size); |
| 1451 | 1402 |
| 1452 // Writes a single byte or word of data in the code stream. Used | 1403 // Writes a single byte or word of data in the code stream. Used |
| 1453 // for inline tables, e.g., jump-tables. The constant pool should be | 1404 // for inline tables, e.g., jump-tables. The constant pool should be |
| 1454 // emitted before any use of db and dd to ensure that constant pools | 1405 // emitted before any use of db and dd to ensure that constant pools |
|
rmcilroy
2015/05/20 14:32:10
nit - update comment to include dq, dp and change
MTBrandyberry
2015/05/20 22:28:21
Done.
| |
| 1455 // are not emitted as part of the tables generated. | 1406 // are not emitted as part of the tables generated. |
| 1456 void db(uint8_t data); | 1407 void db(uint8_t data); |
| 1457 void dd(uint32_t data); | 1408 void dd(uint32_t data); |
| 1409 void dq(uint64_t data); | |
| 1410 void dp(uintptr_t data) { dd(data); } | |
| 1458 | 1411 |
| 1459 // Emits the address of the code stub's first instruction. | 1412 // Emits the address of the code stub's first instruction. |
| 1460 void emit_code_stub_address(Code* stub); | 1413 void emit_code_stub_address(Code* stub); |
| 1461 | 1414 |
| 1462 PositionsRecorder* positions_recorder() { return &positions_recorder_; } | 1415 PositionsRecorder* positions_recorder() { return &positions_recorder_; } |
| 1463 | 1416 |
| 1464 // Read/patch instructions | 1417 // Read/patch instructions |
| 1465 Instr instr_at(int pos) { return *reinterpret_cast<Instr*>(buffer_ + pos); } | 1418 Instr instr_at(int pos) { return *reinterpret_cast<Instr*>(buffer_ + pos); } |
| 1466 void instr_at_put(int pos, Instr instr) { | 1419 void instr_at_put(int pos, Instr instr) { |
| 1467 *reinterpret_cast<Instr*>(buffer_ + pos) = instr; | 1420 *reinterpret_cast<Instr*>(buffer_ + pos) = instr; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1519 static int DecodeShiftImm(Instr instr); | 1472 static int DecodeShiftImm(Instr instr); |
| 1520 static Instr PatchShiftImm(Instr instr, int immed); | 1473 static Instr PatchShiftImm(Instr instr, int immed); |
| 1521 | 1474 |
| 1522 // Constants in pools are accessed via pc relative addressing, which can | 1475 // Constants in pools are accessed via pc relative addressing, which can |
| 1523 // reach +/-4KB for integer PC-relative loads and +/-1KB for floating-point | 1476 // reach +/-4KB for integer PC-relative loads and +/-1KB for floating-point |
| 1524 // PC-relative loads, thereby defining a maximum distance between the | 1477 // PC-relative loads, thereby defining a maximum distance between the |
| 1525 // instruction and the accessed constant. | 1478 // instruction and the accessed constant. |
| 1526 static const int kMaxDistToIntPool = 4*KB; | 1479 static const int kMaxDistToIntPool = 4*KB; |
| 1527 static const int kMaxDistToFPPool = 1*KB; | 1480 static const int kMaxDistToFPPool = 1*KB; |
| 1528 // All relocations could be integer, it therefore acts as the limit. | 1481 // All relocations could be integer, it therefore acts as the limit. |
| 1529 static const int kMaxNumPending32RelocInfo = kMaxDistToIntPool/kInstrSize; | 1482 static const int kMaxNumPending32Constants = kMaxDistToIntPool / kInstrSize; |
| 1530 static const int kMaxNumPending64RelocInfo = kMaxDistToFPPool/kInstrSize; | 1483 static const int kMaxNumPending64Constants = kMaxDistToFPPool / kInstrSize; |
| 1531 | 1484 |
| 1532 // Postpone the generation of the constant pool for the specified number of | 1485 // Postpone the generation of the constant pool for the specified number of |
| 1533 // instructions. | 1486 // instructions. |
| 1534 void BlockConstPoolFor(int instructions); | 1487 void BlockConstPoolFor(int instructions); |
| 1535 | 1488 |
| 1536 // Check if is time to emit a constant pool. | 1489 // Check if is time to emit a constant pool. |
| 1537 void CheckConstPool(bool force_emit, bool require_jump); | 1490 void CheckConstPool(bool force_emit, bool require_jump); |
| 1538 | 1491 |
| 1539 // Allocate a constant pool of the correct size for the generated code. | 1492 int EmitConstantPool() { return constant_pool_builder_.Emit(this); } |
|
rmcilroy
2015/05/20 14:32:10
EmitEmbeddedConstantPool (and add a DCHECK that th
MTBrandyberry
2015/05/20 22:28:21
Done.
| |
| 1540 Handle<ConstantPoolArray> NewConstantPool(Isolate* isolate); | |
| 1541 | 1493 |
| 1542 // Generate the constant pool for the generated code. | 1494 bool ConstantPoolOverflow() const { |
|
rmcilroy
2015/05/20 14:32:10
nit - how about ConstantPoolAccessIsInOverflow or
MTBrandyberry
2015/05/20 22:28:21
Done.
| |
| 1543 void PopulateConstantPool(ConstantPoolArray* constant_pool); | 1495 return constant_pool_builder_.NextAccess(ConstantPoolEntry::INTPTR) == |
| 1544 | 1496 ConstantPoolEntry::OVERFLOWED; |
| 1545 bool use_extended_constant_pool() const { | |
| 1546 return constant_pool_builder_.current_section() == | |
| 1547 ConstantPoolArray::EXTENDED_SECTION; | |
| 1548 } | 1497 } |
| 1549 | 1498 |
| 1499 void SetConstantPoolOffset(int pos, int offset, | |
| 1500 ConstantPoolEntry::Access access, | |
| 1501 ConstantPoolEntry::Type type); | |
| 1550 | 1502 |
| 1551 protected: | 1503 protected: |
| 1552 // Relocation for a type-recording IC has the AST id added to it. This | 1504 // Relocation for a type-recording IC has the AST id added to it. This |
| 1553 // member variable is a way to pass the information from the call site to | 1505 // member variable is a way to pass the information from the call site to |
| 1554 // the relocation info. | 1506 // the relocation info. |
| 1555 TypeFeedbackId recorded_ast_id_; | 1507 TypeFeedbackId recorded_ast_id_; |
| 1556 | 1508 |
| 1557 int buffer_space() const { return reloc_info_writer.pos() - pc_; } | 1509 int buffer_space() const { return reloc_info_writer.pos() - pc_; } |
| 1558 | 1510 |
| 1559 // Decode branch instruction at pos and return branch target pos | 1511 // Decode branch instruction at pos and return branch target pos |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 1574 } | 1526 } |
| 1575 | 1527 |
| 1576 // Resume constant pool emission. Need to be called as many time as | 1528 // Resume constant pool emission. Need to be called as many time as |
| 1577 // StartBlockConstPool to have an effect. | 1529 // StartBlockConstPool to have an effect. |
| 1578 void EndBlockConstPool() { | 1530 void EndBlockConstPool() { |
| 1579 if (--const_pool_blocked_nesting_ == 0) { | 1531 if (--const_pool_blocked_nesting_ == 0) { |
| 1580 #ifdef DEBUG | 1532 #ifdef DEBUG |
| 1581 // Max pool start (if we need a jump and an alignment). | 1533 // Max pool start (if we need a jump and an alignment). |
| 1582 int start = pc_offset() + kInstrSize + 2 * kPointerSize; | 1534 int start = pc_offset() + kInstrSize + 2 * kPointerSize; |
| 1583 // Check the constant pool hasn't been blocked for too long. | 1535 // Check the constant pool hasn't been blocked for too long. |
| 1584 DCHECK((num_pending_32_bit_reloc_info_ == 0) || | 1536 DCHECK((num_pending_32_bit_constants_ == 0) || |
| 1585 (start + num_pending_64_bit_reloc_info_ * kDoubleSize < | 1537 (start + num_pending_64_bit_constants_ * kDoubleSize < |
| 1586 (first_const_pool_32_use_ + kMaxDistToIntPool))); | 1538 (first_const_pool_32_use_ + kMaxDistToIntPool))); |
| 1587 DCHECK((num_pending_64_bit_reloc_info_ == 0) || | 1539 DCHECK((num_pending_64_bit_constants_ == 0) || |
| 1588 (start < (first_const_pool_64_use_ + kMaxDistToFPPool))); | 1540 (start < (first_const_pool_64_use_ + kMaxDistToFPPool))); |
| 1589 #endif | 1541 #endif |
| 1590 // Two cases: | 1542 // Two cases: |
| 1591 // * no_const_pool_before_ >= next_buffer_check_ and the emission is | 1543 // * no_const_pool_before_ >= next_buffer_check_ and the emission is |
| 1592 // still blocked | 1544 // still blocked |
| 1593 // * no_const_pool_before_ < next_buffer_check_ and the next emit will | 1545 // * no_const_pool_before_ < next_buffer_check_ and the next emit will |
| 1594 // trigger a check. | 1546 // trigger a check. |
| 1595 next_buffer_check_ = no_const_pool_before_; | 1547 next_buffer_check_ = no_const_pool_before_; |
| 1596 } | 1548 } |
| 1597 } | 1549 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1636 // Keep track of the first instruction requiring a constant pool entry | 1588 // Keep track of the first instruction requiring a constant pool entry |
| 1637 // since the previous constant pool was emitted. | 1589 // since the previous constant pool was emitted. |
| 1638 int first_const_pool_32_use_; | 1590 int first_const_pool_32_use_; |
| 1639 int first_const_pool_64_use_; | 1591 int first_const_pool_64_use_; |
| 1640 | 1592 |
| 1641 // Relocation info generation | 1593 // Relocation info generation |
| 1642 // Each relocation is encoded as a variable size value | 1594 // Each relocation is encoded as a variable size value |
| 1643 static const int kMaxRelocSize = RelocInfoWriter::kMaxSize; | 1595 static const int kMaxRelocSize = RelocInfoWriter::kMaxSize; |
| 1644 RelocInfoWriter reloc_info_writer; | 1596 RelocInfoWriter reloc_info_writer; |
| 1645 | 1597 |
| 1646 // Relocation info records are also used during code generation as temporary | 1598 // ConstantPoolEntry records are used during code generation as temporary |
| 1647 // containers for constants and code target addresses until they are emitted | 1599 // containers for constants and code target addresses until they are emitted |
| 1648 // to the constant pool. These pending relocation info records are temporarily | 1600 // to the constant pool. These records are temporarily stored in a separate |
| 1649 // stored in a separate buffer until a constant pool is emitted. | 1601 // buffer until a constant pool is emitted. |
| 1650 // If every instruction in a long sequence is accessing the pool, we need one | 1602 // If every instruction in a long sequence is accessing the pool, we need one |
| 1651 // pending relocation entry per instruction. | 1603 // pending relocation entry per instruction. |
| 1652 | 1604 |
| 1653 // The buffers of pending relocation info. | 1605 // The buffers of pending constant pool entries. |
| 1654 RelocInfo pending_32_bit_reloc_info_[kMaxNumPending32RelocInfo]; | 1606 ConstantPoolEntry pending_32_bit_constants_[kMaxNumPending32Constants]; |
| 1655 RelocInfo pending_64_bit_reloc_info_[kMaxNumPending64RelocInfo]; | 1607 ConstantPoolEntry pending_64_bit_constants_[kMaxNumPending64Constants]; |
| 1656 // Number of pending reloc info entries in the 32 bits buffer. | 1608 // Number of pending constant pool entries in the 32 bits buffer. |
| 1657 int num_pending_32_bit_reloc_info_; | 1609 int num_pending_32_bit_constants_; |
| 1658 // Number of pending reloc info entries in the 64 bits buffer. | 1610 // Number of pending constant pool entries in the 64 bits buffer. |
| 1659 int num_pending_64_bit_reloc_info_; | 1611 int num_pending_64_bit_constants_; |
| 1660 | 1612 |
| 1661 ConstantPoolBuilder constant_pool_builder_; | 1613 ConstantPoolBuilder constant_pool_builder_; |
| 1662 | 1614 |
| 1663 // The bound position, before this we cannot do instruction elimination. | 1615 // The bound position, before this we cannot do instruction elimination. |
| 1664 int last_bound_pos_; | 1616 int last_bound_pos_; |
| 1665 | 1617 |
| 1666 // Code emission | 1618 // Code emission |
| 1667 inline void CheckBuffer(); | 1619 inline void CheckBuffer(); |
| 1668 void GrowBuffer(); | 1620 void GrowBuffer(); |
| 1669 inline void emit(Instr x); | 1621 inline void emit(Instr x); |
| 1670 | 1622 |
| 1671 // 32-bit immediate values | 1623 // 32-bit immediate values |
| 1672 void move_32_bit_immediate(Register rd, | 1624 void move_32_bit_immediate(Register rd, |
| 1673 const Operand& x, | 1625 const Operand& x, |
| 1674 Condition cond = al); | 1626 Condition cond = al); |
| 1675 | 1627 |
| 1676 // Instruction generation | 1628 // Instruction generation |
| 1677 void addrmod1(Instr instr, Register rn, Register rd, const Operand& x); | 1629 void addrmod1(Instr instr, Register rn, Register rd, const Operand& x); |
| 1678 void addrmod2(Instr instr, Register rd, const MemOperand& x); | 1630 void addrmod2(Instr instr, Register rd, const MemOperand& x); |
| 1679 void addrmod3(Instr instr, Register rd, const MemOperand& x); | 1631 void addrmod3(Instr instr, Register rd, const MemOperand& x); |
| 1680 void addrmod4(Instr instr, Register rn, RegList rl); | 1632 void addrmod4(Instr instr, Register rn, RegList rl); |
| 1681 void addrmod5(Instr instr, CRegister crd, const MemOperand& x); | 1633 void addrmod5(Instr instr, CRegister crd, const MemOperand& x); |
| 1682 | 1634 |
| 1683 // Labels | 1635 // Labels |
| 1684 void print(Label* L); | 1636 void print(Label* L); |
| 1685 void bind_to(Label* L, int pos); | 1637 void bind_to(Label* L, int pos); |
| 1686 void next(Label* L); | 1638 void next(Label* L); |
| 1687 | 1639 |
| 1688 enum UseConstantPoolMode { | |
| 1689 USE_CONSTANT_POOL, | |
| 1690 DONT_USE_CONSTANT_POOL | |
| 1691 }; | |
| 1692 | |
| 1693 // Record reloc info for current pc_ | 1640 // Record reloc info for current pc_ |
| 1694 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0); | 1641 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0); |
| 1695 void RecordRelocInfo(const RelocInfo& rinfo); | 1642 ConstantPoolEntry::Access ConstantPoolAddEntry(int position, |
| 1696 ConstantPoolArray::LayoutSection ConstantPoolAddEntry(const RelocInfo& rinfo); | 1643 RelocInfo::Mode rmode, |
| 1644 intptr_t value); | |
| 1645 ConstantPoolEntry::Access ConstantPoolAddEntry(int position, double value); | |
| 1697 | 1646 |
| 1698 friend class RelocInfo; | 1647 friend class RelocInfo; |
| 1699 friend class CodePatcher; | 1648 friend class CodePatcher; |
| 1700 friend class BlockConstPoolScope; | 1649 friend class BlockConstPoolScope; |
| 1701 PositionsRecorder positions_recorder_; | 1650 PositionsRecorder positions_recorder_; |
| 1702 friend class PositionsRecorder; | 1651 friend class PositionsRecorder; |
| 1703 friend class EnsureSpace; | 1652 friend class EnsureSpace; |
| 1704 }; | 1653 }; |
| 1705 | 1654 |
| 1706 | 1655 |
| 1707 class EnsureSpace BASE_EMBEDDED { | 1656 class EnsureSpace BASE_EMBEDDED { |
| 1708 public: | 1657 public: |
| 1709 explicit EnsureSpace(Assembler* assembler) { | 1658 explicit EnsureSpace(Assembler* assembler) { |
| 1710 assembler->CheckBuffer(); | 1659 assembler->CheckBuffer(); |
| 1711 } | 1660 } |
| 1712 }; | 1661 }; |
| 1713 | 1662 |
| 1714 | 1663 |
| 1715 } } // namespace v8::internal | 1664 } } // namespace v8::internal |
| 1716 | 1665 |
| 1717 #endif // V8_ARM_ASSEMBLER_ARM_H_ | 1666 #endif // V8_ARM_ASSEMBLER_ARM_H_ |
| OLD | NEW |