| 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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 offset = kStartOfLabelLinkChain; | 538 offset = kStartOfLabelLinkChain; |
| 539 } | 539 } |
| 540 // The instruction at pc is now the last link in the label's chain. | 540 // The instruction at pc is now the last link in the label's chain. |
| 541 label->link_to(pc_offset()); | 541 label->link_to(pc_offset()); |
| 542 } | 542 } |
| 543 | 543 |
| 544 return offset; | 544 return offset; |
| 545 } | 545 } |
| 546 | 546 |
| 547 | 547 |
| 548 void Assembler::DeleteUnresolvedBranchInfoForLabelTraverse(Label* label) { |
| 549 ASSERT(label->is_linked()); |
| 550 CheckLabelLinkChain(label); |
| 551 |
| 552 int link_offset = label->pos(); |
| 553 int link_pcoffset; |
| 554 bool end_of_chain = false; |
| 555 |
| 556 while (!end_of_chain) { |
| 557 Instruction * link = InstructionAt(link_offset); |
| 558 link_pcoffset = link->ImmPCOffset(); |
| 559 |
| 560 // ADR instructions are not handled by veneers. |
| 561 if (link->IsImmBranch()) { |
| 562 int max_reachable_pc = InstructionOffset(link) + |
| 563 Instruction::ImmBranchRange(link->BranchType()); |
| 564 typedef std::multimap<int, FarBranchInfo>::iterator unresolved_info_it; |
| 565 std::pair<unresolved_info_it, unresolved_info_it> range; |
| 566 range = unresolved_branches_.equal_range(max_reachable_pc); |
| 567 unresolved_info_it it; |
| 568 for (it = range.first; it != range.second; ++it) { |
| 569 if (it->second.pc_offset_ == link_offset) { |
| 570 unresolved_branches_.erase(it); |
| 571 break; |
| 572 } |
| 573 } |
| 574 } |
| 575 |
| 576 end_of_chain = (link_pcoffset == 0); |
| 577 link_offset = link_offset + link_pcoffset; |
| 578 } |
| 579 } |
| 580 |
| 581 |
| 548 void Assembler::DeleteUnresolvedBranchInfoForLabel(Label* label) { | 582 void Assembler::DeleteUnresolvedBranchInfoForLabel(Label* label) { |
| 549 if (unresolved_branches_.empty()) { | 583 if (unresolved_branches_.empty()) { |
| 550 ASSERT(next_veneer_pool_check_ == kMaxInt); | 584 ASSERT(next_veneer_pool_check_ == kMaxInt); |
| 551 return; | 585 return; |
| 552 } | 586 } |
| 553 | 587 |
| 554 if (label->is_linked()) { | 588 if (label->is_linked()) { |
| 555 // Branches to this label will be resolved when the label is bound below. | 589 // Branches to this label will be resolved when the label is bound, normally |
| 556 std::multimap<int, FarBranchInfo>::iterator it_tmp, it; | 590 // just after all the associated info has been deleted. |
| 557 it = unresolved_branches_.begin(); | 591 DeleteUnresolvedBranchInfoForLabelTraverse(label); |
| 558 while (it != unresolved_branches_.end()) { | |
| 559 it_tmp = it++; | |
| 560 if (it_tmp->second.label_ == label) { | |
| 561 CHECK(it_tmp->first >= pc_offset()); | |
| 562 unresolved_branches_.erase(it_tmp); | |
| 563 } | |
| 564 } | |
| 565 } | 592 } |
| 566 if (unresolved_branches_.empty()) { | 593 if (unresolved_branches_.empty()) { |
| 567 next_veneer_pool_check_ = kMaxInt; | 594 next_veneer_pool_check_ = kMaxInt; |
| 568 } else { | 595 } else { |
| 569 next_veneer_pool_check_ = | 596 next_veneer_pool_check_ = |
| 570 unresolved_branches_first_limit() - kVeneerDistanceCheckMargin; | 597 unresolved_branches_first_limit() - kVeneerDistanceCheckMargin; |
| 571 } | 598 } |
| 572 } | 599 } |
| 573 | 600 |
| 574 | 601 |
| (...skipping 2308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2883 adr(rd, 0); | 2910 adr(rd, 0); |
| 2884 MovInt64(scratch, target_offset); | 2911 MovInt64(scratch, target_offset); |
| 2885 add(rd, rd, scratch); | 2912 add(rd, rd, scratch); |
| 2886 } | 2913 } |
| 2887 } | 2914 } |
| 2888 | 2915 |
| 2889 | 2916 |
| 2890 } } // namespace v8::internal | 2917 } } // namespace v8::internal |
| 2891 | 2918 |
| 2892 #endif // V8_TARGET_ARCH_ARM64 | 2919 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |