| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
| 8 | 8 |
| 9 #include "src/base/division-by-constant.h" | 9 #include "src/base/division-by-constant.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 sll(scratch, reg0, 11); | 630 sll(scratch, reg0, 11); |
| 631 Lsa(reg0, reg0, reg0, 3); | 631 Lsa(reg0, reg0, reg0, 3); |
| 632 addu(reg0, reg0, scratch); | 632 addu(reg0, reg0, scratch); |
| 633 | 633 |
| 634 // hash = hash ^ (hash >> 16); | 634 // hash = hash ^ (hash >> 16); |
| 635 srl(at, reg0, 16); | 635 srl(at, reg0, 16); |
| 636 xor_(reg0, reg0, at); | 636 xor_(reg0, reg0, at); |
| 637 And(reg0, reg0, Operand(0x3fffffff)); | 637 And(reg0, reg0, Operand(0x3fffffff)); |
| 638 } | 638 } |
| 639 | 639 |
| 640 | |
| 641 void MacroAssembler::LoadFromNumberDictionary(Label* miss, | |
| 642 Register elements, | |
| 643 Register key, | |
| 644 Register result, | |
| 645 Register reg0, | |
| 646 Register reg1, | |
| 647 Register reg2) { | |
| 648 // Register use: | |
| 649 // | |
| 650 // elements - holds the slow-case elements of the receiver on entry. | |
| 651 // Unchanged unless 'result' is the same register. | |
| 652 // | |
| 653 // key - holds the smi key on entry. | |
| 654 // Unchanged unless 'result' is the same register. | |
| 655 // | |
| 656 // | |
| 657 // result - holds the result on exit if the load succeeded. | |
| 658 // Allowed to be the same as 'key' or 'result'. | |
| 659 // Unchanged on bailout so 'key' or 'result' can be used | |
| 660 // in further computation. | |
| 661 // | |
| 662 // Scratch registers: | |
| 663 // | |
| 664 // reg0 - holds the untagged key on entry and holds the hash once computed. | |
| 665 // | |
| 666 // reg1 - Used to hold the capacity mask of the dictionary. | |
| 667 // | |
| 668 // reg2 - Used for the index into the dictionary. | |
| 669 // at - Temporary (avoid MacroAssembler instructions also using 'at'). | |
| 670 Label done; | |
| 671 | |
| 672 GetNumberHash(reg0, reg1); | |
| 673 | |
| 674 // Compute the capacity mask. | |
| 675 ld(reg1, FieldMemOperand(elements, SeededNumberDictionary::kCapacityOffset)); | |
| 676 SmiUntag(reg1, reg1); | |
| 677 Dsubu(reg1, reg1, Operand(1)); | |
| 678 | |
| 679 // Generate an unrolled loop that performs a few probes before giving up. | |
| 680 for (int i = 0; i < kNumberDictionaryProbes; i++) { | |
| 681 // Use reg2 for index calculations and keep the hash intact in reg0. | |
| 682 mov(reg2, reg0); | |
| 683 // Compute the masked index: (hash + i + i * i) & mask. | |
| 684 if (i > 0) { | |
| 685 Daddu(reg2, reg2, Operand(SeededNumberDictionary::GetProbeOffset(i))); | |
| 686 } | |
| 687 and_(reg2, reg2, reg1); | |
| 688 | |
| 689 // Scale the index by multiplying by the element size. | |
| 690 DCHECK(SeededNumberDictionary::kEntrySize == 3); | |
| 691 Dlsa(reg2, reg2, reg2, 1); // reg2 = reg2 * 3. | |
| 692 | |
| 693 // Check if the key is identical to the name. | |
| 694 Dlsa(reg2, elements, reg2, kPointerSizeLog2); | |
| 695 | |
| 696 ld(at, FieldMemOperand(reg2, SeededNumberDictionary::kElementsStartOffset)); | |
| 697 if (i != kNumberDictionaryProbes - 1) { | |
| 698 Branch(&done, eq, key, Operand(at)); | |
| 699 } else { | |
| 700 Branch(miss, ne, key, Operand(at)); | |
| 701 } | |
| 702 } | |
| 703 | |
| 704 bind(&done); | |
| 705 // Check that the value is a field property. | |
| 706 // reg2: elements + (index * kPointerSize). | |
| 707 const int kDetailsOffset = | |
| 708 SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize; | |
| 709 ld(reg1, FieldMemOperand(reg2, kDetailsOffset)); | |
| 710 DCHECK_EQ(DATA, 0); | |
| 711 And(at, reg1, Operand(Smi::FromInt(PropertyDetails::TypeField::kMask))); | |
| 712 Branch(miss, ne, at, Operand(zero_reg)); | |
| 713 | |
| 714 // Get the value at the masked, scaled index and return. | |
| 715 const int kValueOffset = | |
| 716 SeededNumberDictionary::kElementsStartOffset + kPointerSize; | |
| 717 ld(result, FieldMemOperand(reg2, kValueOffset)); | |
| 718 } | |
| 719 | |
| 720 | |
| 721 // --------------------------------------------------------------------------- | 640 // --------------------------------------------------------------------------- |
| 722 // Instruction macros. | 641 // Instruction macros. |
| 723 | 642 |
| 724 void MacroAssembler::Addu(Register rd, Register rs, const Operand& rt) { | 643 void MacroAssembler::Addu(Register rd, Register rs, const Operand& rt) { |
| 725 if (rt.is_reg()) { | 644 if (rt.is_reg()) { |
| 726 addu(rd, rs, rt.rm()); | 645 addu(rd, rs, rt.rm()); |
| 727 } else { | 646 } else { |
| 728 if (is_int16(rt.imm64_) && !MustUseReg(rt.rmode_)) { | 647 if (is_int16(rt.imm64_) && !MustUseReg(rt.rmode_)) { |
| 729 addiu(rd, rs, static_cast<int32_t>(rt.imm64_)); | 648 addiu(rd, rs, static_cast<int32_t>(rt.imm64_)); |
| 730 } else { | 649 } else { |
| (...skipping 4145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4876 Register filler) { | 4795 Register filler) { |
| 4877 Label loop, entry; | 4796 Label loop, entry; |
| 4878 Branch(&entry); | 4797 Branch(&entry); |
| 4879 bind(&loop); | 4798 bind(&loop); |
| 4880 sd(filler, MemOperand(current_address)); | 4799 sd(filler, MemOperand(current_address)); |
| 4881 Daddu(current_address, current_address, kPointerSize); | 4800 Daddu(current_address, current_address, kPointerSize); |
| 4882 bind(&entry); | 4801 bind(&entry); |
| 4883 Branch(&loop, ult, current_address, Operand(end_address)); | 4802 Branch(&loop, ult, current_address, Operand(end_address)); |
| 4884 } | 4803 } |
| 4885 | 4804 |
| 4886 | |
| 4887 void MacroAssembler::CheckFastElements(Register map, | |
| 4888 Register scratch, | |
| 4889 Label* fail) { | |
| 4890 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); | |
| 4891 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); | |
| 4892 STATIC_ASSERT(FAST_ELEMENTS == 2); | |
| 4893 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3); | |
| 4894 lbu(scratch, FieldMemOperand(map, Map::kBitField2Offset)); | |
| 4895 Branch(fail, hi, scratch, | |
| 4896 Operand(Map::kMaximumBitField2FastHoleyElementValue)); | |
| 4897 } | |
| 4898 | |
| 4899 | |
| 4900 void MacroAssembler::CheckFastObjectElements(Register map, | 4805 void MacroAssembler::CheckFastObjectElements(Register map, |
| 4901 Register scratch, | 4806 Register scratch, |
| 4902 Label* fail) { | 4807 Label* fail) { |
| 4903 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); | 4808 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); |
| 4904 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); | 4809 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); |
| 4905 STATIC_ASSERT(FAST_ELEMENTS == 2); | 4810 STATIC_ASSERT(FAST_ELEMENTS == 2); |
| 4906 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3); | 4811 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3); |
| 4907 lbu(scratch, FieldMemOperand(map, Map::kBitField2Offset)); | 4812 lbu(scratch, FieldMemOperand(map, Map::kBitField2Offset)); |
| 4908 Branch(fail, ls, scratch, | 4813 Branch(fail, ls, scratch, |
| 4909 Operand(Map::kMaximumBitField2FastHoleySmiElementValue)); | 4814 Operand(Map::kMaximumBitField2FastHoleySmiElementValue)); |
| (...skipping 2503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7413 if (mag.shift > 0) sra(result, result, mag.shift); | 7318 if (mag.shift > 0) sra(result, result, mag.shift); |
| 7414 srl(at, dividend, 31); | 7319 srl(at, dividend, 31); |
| 7415 Addu(result, result, Operand(at)); | 7320 Addu(result, result, Operand(at)); |
| 7416 } | 7321 } |
| 7417 | 7322 |
| 7418 | 7323 |
| 7419 } // namespace internal | 7324 } // namespace internal |
| 7420 } // namespace v8 | 7325 } // namespace v8 |
| 7421 | 7326 |
| 7422 #endif // V8_TARGET_ARCH_MIPS64 | 7327 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |