Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 592 FarBranchInfo(pc_offset(), label))); | 592 FarBranchInfo(pc_offset(), label))); |
| 593 // Also maintain the next pool check. | 593 // Also maintain the next pool check. |
| 594 next_veneer_pool_check_ = | 594 next_veneer_pool_check_ = |
| 595 Min(next_veneer_pool_check_, | 595 Min(next_veneer_pool_check_, |
| 596 max_reachable_pc - kVeneerDistanceCheckMargin); | 596 max_reachable_pc - kVeneerDistanceCheckMargin); |
| 597 } | 597 } |
| 598 return need_longer_range; | 598 return need_longer_range; |
| 599 } | 599 } |
| 600 | 600 |
| 601 | 601 |
| 602 void MacroAssembler::Adr(const Register& rd, Label* label, AdrHint hint) { | |
| 603 ASSERT(allow_macro_instructions_); | |
| 604 ASSERT(!rd.IsZero()); | |
| 605 | |
| 606 if (hint == kAdrNear) { | |
| 607 adr(rd, label); | |
| 608 return; | |
| 609 } | |
| 610 | |
| 611 ASSERT(hint == kAdrFar); | |
| 612 UseScratchRegisterScope temps(this); | |
| 613 Register scratch = temps.AcquireX(); | |
| 614 ASSERT(!AreAliased(rd, scratch)); | |
| 615 | |
| 616 if (label->is_bound()) { | |
| 617 int label_offset = label->pos() - pc_offset(); | |
| 618 if (Instruction::IsValidPCRelOffset(label_offset)) { | |
| 619 adr(rd, label); | |
| 620 } else { | |
| 621 ASSERT(label_offset <= 0); | |
| 622 int min_adr_offset = -1 << (Instruction::ImmPCRelRangeBitwidth - 1); | |
|
ulan
2014/04/07 11:54:15
Please use -(1 << (Instruction::ImmPCRelRangeBitwi
| |
| 623 adr(rd, min_adr_offset); | |
| 624 Add(rd, rd, label_offset - min_adr_offset); | |
| 625 } | |
| 626 } else { | |
| 627 InstructionAccurateScope scope( | |
| 628 this, PatchingAssembler::kAdrFarPatchableNInstrs); | |
| 629 adr(rd, label); | |
| 630 for (int i = 0; i < PatchingAssembler::kAdrFarPatchableNNops; ++i) { | |
| 631 nop(ADR_FAR_NOP); | |
| 632 } | |
| 633 movz(scratch, 0); | |
| 634 add(rd, rd, scratch); | |
| 635 } | |
| 636 } | |
| 637 | |
| 638 | |
| 602 void MacroAssembler::B(Label* label, BranchType type, Register reg, int bit) { | 639 void MacroAssembler::B(Label* label, BranchType type, Register reg, int bit) { |
| 603 ASSERT((reg.Is(NoReg) || type >= kBranchTypeFirstUsingReg) && | 640 ASSERT((reg.Is(NoReg) || type >= kBranchTypeFirstUsingReg) && |
| 604 (bit == -1 || type >= kBranchTypeFirstUsingBit)); | 641 (bit == -1 || type >= kBranchTypeFirstUsingBit)); |
| 605 if (kBranchTypeFirstCondition <= type && type <= kBranchTypeLastCondition) { | 642 if (kBranchTypeFirstCondition <= type && type <= kBranchTypeLastCondition) { |
| 606 B(static_cast<Condition>(type), label); | 643 B(static_cast<Condition>(type), label); |
| 607 } else { | 644 } else { |
| 608 switch (type) { | 645 switch (type) { |
| 609 case always: B(label); break; | 646 case always: B(label); break; |
| 610 case never: break; | 647 case never: break; |
| 611 case reg_zero: Cbz(reg, label); break; | 648 case reg_zero: Cbz(reg, label); break; |
| (...skipping 4581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5193 } | 5230 } |
| 5194 } | 5231 } |
| 5195 | 5232 |
| 5196 | 5233 |
| 5197 #undef __ | 5234 #undef __ |
| 5198 | 5235 |
| 5199 | 5236 |
| 5200 } } // namespace v8::internal | 5237 } } // namespace v8::internal |
| 5201 | 5238 |
| 5202 #endif // V8_TARGET_ARCH_ARM64 | 5239 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |