OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // | 2 // |
3 // Redistribution and use in source and binary forms, with or without | 3 // Redistribution and use in source and binary forms, with or without |
4 // modification, are permitted provided that the following conditions are | 4 // modification, are permitted provided that the following conditions are |
5 // met: | 5 // met: |
6 // | 6 // |
7 // * Redistributions of source code must retain the above copyright | 7 // * Redistributions of source code must retain the above copyright |
8 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
9 // * Redistributions in binary form must reproduce the above | 9 // * Redistributions in binary form must reproduce the above |
10 // copyright notice, this list of conditions and the following | 10 // copyright notice, this list of conditions and the following |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 return instr->ImmLLiteral(); | 640 return instr->ImmLLiteral(); |
641 } else { | 641 } else { |
642 return -1; | 642 return -1; |
643 } | 643 } |
644 } | 644 } |
645 | 645 |
646 | 646 |
647 void Assembler::ConstantPoolMarker(uint32_t size) { | 647 void Assembler::ConstantPoolMarker(uint32_t size) { |
648 ASSERT(is_const_pool_blocked()); | 648 ASSERT(is_const_pool_blocked()); |
649 // + 1 is for the crash guard. | 649 // + 1 is for the crash guard. |
650 Emit(LDR_x_lit | ImmLLiteral(2 * size + 1) | Rt(xzr)); | 650 Emit(LDR_x_lit | ImmLLiteral(size + 1) | Rt(xzr)); |
651 } | 651 } |
652 | 652 |
653 | 653 |
654 void Assembler::EmitPoolGuard() { | 654 void Assembler::EmitPoolGuard() { |
655 // We must generate only one instruction as this is used in scopes that | 655 // We must generate only one instruction as this is used in scopes that |
656 // control the size of the code generated. | 656 // control the size of the code generated. |
657 Emit(BLR | Rn(xzr)); | 657 Emit(BLR | Rn(xzr)); |
658 } | 658 } |
659 | 659 |
660 | 660 |
(...skipping 1922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2583 // Check that the code buffer is large enough before emitting the constant | 2583 // Check that the code buffer is large enough before emitting the constant |
2584 // pool (include the jump over the pool, the constant pool marker, the | 2584 // pool (include the jump over the pool, the constant pool marker, the |
2585 // constant pool guard, and the gap to the relocation information). | 2585 // constant pool guard, and the gap to the relocation information). |
2586 while (buffer_space() <= needed_space) { | 2586 while (buffer_space() <= needed_space) { |
2587 GrowBuffer(); | 2587 GrowBuffer(); |
2588 } | 2588 } |
2589 | 2589 |
2590 { | 2590 { |
2591 // Block recursive calls to CheckConstPool and protect from veneer pools. | 2591 // Block recursive calls to CheckConstPool and protect from veneer pools. |
2592 BlockPoolsScope block_pools(this); | 2592 BlockPoolsScope block_pools(this); |
2593 RecordComment("[ Constant Pool"); | |
2594 RecordConstPool(pool_size); | 2593 RecordConstPool(pool_size); |
2595 | 2594 |
2596 // Emit jump over constant pool if necessary. | 2595 // Emit jump over constant pool if necessary. |
2597 Label after_pool; | 2596 Label after_pool; |
2598 if (require_jump) { | 2597 if (require_jump) { |
2599 b(&after_pool); | 2598 b(&after_pool); |
2600 } | 2599 } |
2601 | 2600 |
2602 // Emit a constant pool header. The header has two goals: | 2601 // Emit a constant pool header. The header has two goals: |
2603 // 1) Encode the size of the constant pool, for use by the disassembler. | 2602 // 1) Encode the size of the constant pool, for use by the disassembler. |
2604 // 2) Terminate the program, to try to prevent execution from accidentally | 2603 // 2) Terminate the program, to try to prevent execution from accidentally |
2605 // flowing into the constant pool. | 2604 // flowing into the constant pool. |
2606 // The header is therefore made of two arm64 instructions: | 2605 // The header is therefore made of two arm64 instructions: |
2607 // ldr xzr, #<size of the constant pool in 32-bit words> | 2606 // ldr xzr, #<size of the constant pool in 32-bit words> |
2608 // blr xzr | 2607 // blr xzr |
2609 // If executed the code will likely segfault and lr will point to the | 2608 // If executed the code will likely segfault and lr will point to the |
2610 // beginning of the constant pool. | 2609 // beginning of the constant pool. |
2611 // TODO(all): currently each relocated constant is 64 bits, consider adding | 2610 // TODO(all): currently each relocated constant is 64 bits, consider adding |
2612 // support for 32-bit entries. | 2611 // support for 32-bit entries. |
| 2612 RecordComment("[ Constant Pool"); |
2613 ConstantPoolMarker(2 * num_pending_reloc_info_); | 2613 ConstantPoolMarker(2 * num_pending_reloc_info_); |
2614 ConstantPoolGuard(); | 2614 ConstantPoolGuard(); |
2615 | 2615 |
2616 // Emit constant pool entries. | 2616 // Emit constant pool entries. |
2617 for (int i = 0; i < num_pending_reloc_info_; i++) { | 2617 for (int i = 0; i < num_pending_reloc_info_; i++) { |
2618 RelocInfo& rinfo = pending_reloc_info_[i]; | 2618 RelocInfo& rinfo = pending_reloc_info_[i]; |
2619 ASSERT(rinfo.rmode() != RelocInfo::COMMENT && | 2619 ASSERT(rinfo.rmode() != RelocInfo::COMMENT && |
2620 rinfo.rmode() != RelocInfo::POSITION && | 2620 rinfo.rmode() != RelocInfo::POSITION && |
2621 rinfo.rmode() != RelocInfo::STATEMENT_POSITION && | 2621 rinfo.rmode() != RelocInfo::STATEMENT_POSITION && |
2622 rinfo.rmode() != RelocInfo::CONST_POOL && | 2622 rinfo.rmode() != RelocInfo::CONST_POOL && |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2813 | 2813 |
2814 void Assembler::PopulateConstantPool(ConstantPoolArray* constant_pool) { | 2814 void Assembler::PopulateConstantPool(ConstantPoolArray* constant_pool) { |
2815 // No out-of-line constant pool support. | 2815 // No out-of-line constant pool support. |
2816 UNREACHABLE(); | 2816 UNREACHABLE(); |
2817 } | 2817 } |
2818 | 2818 |
2819 | 2819 |
2820 } } // namespace v8::internal | 2820 } } // namespace v8::internal |
2821 | 2821 |
2822 #endif // V8_TARGET_ARCH_ARM64 | 2822 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |