OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 void MacroAssembler::Adr(const Register& rd, Label* label, AdrHint hint) { | 606 void MacroAssembler::Adr(const Register& rd, Label* label, AdrHint hint) { |
607 ASSERT(allow_macro_instructions_); | 607 ASSERT(allow_macro_instructions_); |
608 ASSERT(!rd.IsZero()); | 608 ASSERT(!rd.IsZero()); |
609 | 609 |
610 if (hint == kAdrNear) { | 610 if (hint == kAdrNear) { |
611 adr(rd, label); | 611 adr(rd, label); |
612 return; | 612 return; |
613 } | 613 } |
614 | 614 |
615 ASSERT(hint == kAdrFar); | 615 ASSERT(hint == kAdrFar); |
616 UseScratchRegisterScope temps(this); | |
617 Register scratch = temps.AcquireX(); | |
618 ASSERT(!AreAliased(rd, scratch)); | |
619 | |
620 if (label->is_bound()) { | 616 if (label->is_bound()) { |
621 int label_offset = label->pos() - pc_offset(); | 617 int label_offset = label->pos() - pc_offset(); |
622 if (Instruction::IsValidPCRelOffset(label_offset)) { | 618 if (Instruction::IsValidPCRelOffset(label_offset)) { |
623 adr(rd, label); | 619 adr(rd, label); |
624 } else { | 620 } else { |
625 ASSERT(label_offset <= 0); | 621 ASSERT(label_offset <= 0); |
626 int min_adr_offset = -(1 << (Instruction::ImmPCRelRangeBitwidth - 1)); | 622 int min_adr_offset = -(1 << (Instruction::ImmPCRelRangeBitwidth - 1)); |
627 adr(rd, min_adr_offset); | 623 adr(rd, min_adr_offset); |
628 Add(rd, rd, label_offset - min_adr_offset); | 624 Add(rd, rd, label_offset - min_adr_offset); |
629 } | 625 } |
630 } else { | 626 } else { |
| 627 UseScratchRegisterScope temps(this); |
| 628 Register scratch = temps.AcquireX(); |
| 629 |
631 InstructionAccurateScope scope( | 630 InstructionAccurateScope scope( |
632 this, PatchingAssembler::kAdrFarPatchableNInstrs); | 631 this, PatchingAssembler::kAdrFarPatchableNInstrs); |
633 adr(rd, label); | 632 adr(rd, label); |
634 for (int i = 0; i < PatchingAssembler::kAdrFarPatchableNNops; ++i) { | 633 for (int i = 0; i < PatchingAssembler::kAdrFarPatchableNNops; ++i) { |
635 nop(ADR_FAR_NOP); | 634 nop(ADR_FAR_NOP); |
636 } | 635 } |
637 movz(scratch, 0); | 636 movz(scratch, 0); |
638 add(rd, rd, scratch); | |
639 } | 637 } |
640 } | 638 } |
641 | 639 |
642 | 640 |
643 void MacroAssembler::B(Label* label, BranchType type, Register reg, int bit) { | 641 void MacroAssembler::B(Label* label, BranchType type, Register reg, int bit) { |
644 ASSERT((reg.Is(NoReg) || type >= kBranchTypeFirstUsingReg) && | 642 ASSERT((reg.Is(NoReg) || type >= kBranchTypeFirstUsingReg) && |
645 (bit == -1 || type >= kBranchTypeFirstUsingBit)); | 643 (bit == -1 || type >= kBranchTypeFirstUsingBit)); |
646 if (kBranchTypeFirstCondition <= type && type <= kBranchTypeLastCondition) { | 644 if (kBranchTypeFirstCondition <= type && type <= kBranchTypeLastCondition) { |
647 B(static_cast<Condition>(type), label); | 645 B(static_cast<Condition>(type), label); |
648 } else { | 646 } else { |
(...skipping 4666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5315 } | 5313 } |
5316 } | 5314 } |
5317 | 5315 |
5318 | 5316 |
5319 #undef __ | 5317 #undef __ |
5320 | 5318 |
5321 | 5319 |
5322 } } // namespace v8::internal | 5320 } } // namespace v8::internal |
5323 | 5321 |
5324 #endif // V8_TARGET_ARCH_ARM64 | 5322 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |