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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 } | 578 } |
579 unique_entries_.clear(); | 579 unique_entries_.clear(); |
580 first_use_ = -1; | 580 first_use_ = -1; |
581 } | 581 } |
582 | 582 |
583 | 583 |
584 // Assembler | 584 // Assembler |
585 Assembler::Assembler(IsolateData isolate_data, void* buffer, int buffer_size) | 585 Assembler::Assembler(IsolateData isolate_data, void* buffer, int buffer_size) |
586 : AssemblerBase(isolate_data, buffer, buffer_size), | 586 : AssemblerBase(isolate_data, buffer, buffer_size), |
587 constpool_(this), | 587 constpool_(this), |
588 recorded_ast_id_(TypeFeedbackId::None()), | |
589 unresolved_branches_() { | 588 unresolved_branches_() { |
590 const_pool_blocked_nesting_ = 0; | 589 const_pool_blocked_nesting_ = 0; |
591 veneer_pool_blocked_nesting_ = 0; | 590 veneer_pool_blocked_nesting_ = 0; |
592 Reset(); | 591 Reset(); |
593 } | 592 } |
594 | 593 |
595 | 594 |
596 Assembler::~Assembler() { | 595 Assembler::~Assembler() { |
597 DCHECK(constpool_.IsEmpty()); | 596 DCHECK(constpool_.IsEmpty()); |
598 DCHECK(const_pool_blocked_nesting_ == 0); | 597 DCHECK(const_pool_blocked_nesting_ == 0); |
599 DCHECK(veneer_pool_blocked_nesting_ == 0); | 598 DCHECK(veneer_pool_blocked_nesting_ == 0); |
600 } | 599 } |
601 | 600 |
602 | 601 |
603 void Assembler::Reset() { | 602 void Assembler::Reset() { |
604 #ifdef DEBUG | 603 #ifdef DEBUG |
605 DCHECK((pc_ >= buffer_) && (pc_ < buffer_ + buffer_size_)); | 604 DCHECK((pc_ >= buffer_) && (pc_ < buffer_ + buffer_size_)); |
606 DCHECK(const_pool_blocked_nesting_ == 0); | 605 DCHECK(const_pool_blocked_nesting_ == 0); |
607 DCHECK(veneer_pool_blocked_nesting_ == 0); | 606 DCHECK(veneer_pool_blocked_nesting_ == 0); |
608 DCHECK(unresolved_branches_.empty()); | 607 DCHECK(unresolved_branches_.empty()); |
609 memset(buffer_, 0, pc_ - buffer_); | 608 memset(buffer_, 0, pc_ - buffer_); |
610 #endif | 609 #endif |
611 pc_ = buffer_; | 610 pc_ = buffer_; |
612 reloc_info_writer.Reposition(reinterpret_cast<byte*>(buffer_ + buffer_size_), | 611 reloc_info_writer.Reposition(reinterpret_cast<byte*>(buffer_ + buffer_size_), |
613 reinterpret_cast<byte*>(pc_)); | 612 reinterpret_cast<byte*>(pc_)); |
614 constpool_.Clear(); | 613 constpool_.Clear(); |
615 next_constant_pool_check_ = 0; | 614 next_constant_pool_check_ = 0; |
616 next_veneer_pool_check_ = kMaxInt; | 615 next_veneer_pool_check_ = kMaxInt; |
617 no_const_pool_before_ = 0; | 616 no_const_pool_before_ = 0; |
618 ClearRecordedAstId(); | |
619 } | 617 } |
620 | 618 |
621 void Assembler::set_heap_number(Handle<HeapObject> number, Address pc) { | 619 void Assembler::set_heap_number(Handle<HeapObject> number, Address pc) { |
622 Memory::Address_at(target_pointer_address_at(pc)) = | 620 Memory::Address_at(target_pointer_address_at(pc)) = |
623 reinterpret_cast<Address>(number.location()); | 621 reinterpret_cast<Address>(number.location()); |
624 } | 622 } |
625 | 623 |
626 void Assembler::GetCode(Isolate* isolate, CodeDesc* desc) { | 624 void Assembler::GetCode(Isolate* isolate, CodeDesc* desc) { |
627 // Emit constant pool if necessary. | 625 // Emit constant pool if necessary. |
628 CheckConstPool(true, false); | 626 CheckConstPool(true, false); |
(...skipping 4152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4781 BlockConstPoolFor(1); | 4779 BlockConstPoolFor(1); |
4782 } | 4780 } |
4783 | 4781 |
4784 if (!RelocInfo::IsNone(rmode)) { | 4782 if (!RelocInfo::IsNone(rmode)) { |
4785 // Don't record external references unless the heap will be serialized. | 4783 // Don't record external references unless the heap will be serialized. |
4786 if (rmode == RelocInfo::EXTERNAL_REFERENCE && | 4784 if (rmode == RelocInfo::EXTERNAL_REFERENCE && |
4787 !serializer_enabled() && !emit_debug_code()) { | 4785 !serializer_enabled() && !emit_debug_code()) { |
4788 return; | 4786 return; |
4789 } | 4787 } |
4790 DCHECK(buffer_space() >= kMaxRelocSize); // too late to grow buffer here | 4788 DCHECK(buffer_space() >= kMaxRelocSize); // too late to grow buffer here |
4791 if (rmode == RelocInfo::CODE_TARGET_WITH_ID) { | 4789 DCHECK(rmode != RelocInfo::CODE_TARGET_WITH_ID); |
4792 RelocInfo reloc_info_with_ast_id(reinterpret_cast<byte*>(pc_), rmode, | 4790 reloc_info_writer.Write(&rinfo); |
4793 RecordedAstId().ToInt(), NULL); | |
4794 ClearRecordedAstId(); | |
4795 reloc_info_writer.Write(&reloc_info_with_ast_id); | |
4796 } else { | |
4797 reloc_info_writer.Write(&rinfo); | |
4798 } | |
4799 } | 4791 } |
4800 } | 4792 } |
4801 | 4793 |
4802 | 4794 |
4803 void Assembler::BlockConstPoolFor(int instructions) { | 4795 void Assembler::BlockConstPoolFor(int instructions) { |
4804 int pc_limit = pc_offset() + instructions * kInstructionSize; | 4796 int pc_limit = pc_offset() + instructions * kInstructionSize; |
4805 if (no_const_pool_before_ < pc_limit) { | 4797 if (no_const_pool_before_ < pc_limit) { |
4806 no_const_pool_before_ = pc_limit; | 4798 no_const_pool_before_ = pc_limit; |
4807 // Make sure the pool won't be blocked for too long. | 4799 // Make sure the pool won't be blocked for too long. |
4808 DCHECK(pc_limit < constpool_.MaxPcOffset()); | 4800 DCHECK(pc_limit < constpool_.MaxPcOffset()); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5028 movk(scratch, (target_offset >> 32) & 0xFFFF, 32); | 5020 movk(scratch, (target_offset >> 32) & 0xFFFF, 32); |
5029 DCHECK((target_offset >> 48) == 0); | 5021 DCHECK((target_offset >> 48) == 0); |
5030 add(rd, rd, scratch); | 5022 add(rd, rd, scratch); |
5031 } | 5023 } |
5032 | 5024 |
5033 | 5025 |
5034 } // namespace internal | 5026 } // namespace internal |
5035 } // namespace v8 | 5027 } // namespace v8 |
5036 | 5028 |
5037 #endif // V8_TARGET_ARCH_ARM64 | 5029 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |