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 "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
8 | 8 |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 OMIT_SMI_CHECK); | 654 OMIT_SMI_CHECK); |
655 | 655 |
656 | 656 |
657 // Prepare for conversion loop. | 657 // Prepare for conversion loop. |
658 __ Daddu(scratch1, elements, | 658 __ Daddu(scratch1, elements, |
659 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 659 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
660 __ Daddu(scratch3, array, Operand(FixedDoubleArray::kHeaderSize)); | 660 __ Daddu(scratch3, array, Operand(FixedDoubleArray::kHeaderSize)); |
661 __ SmiScale(array_end, length, kDoubleSizeLog2); | 661 __ SmiScale(array_end, length, kDoubleSizeLog2); |
662 __ Daddu(array_end, array_end, scratch3); | 662 __ Daddu(array_end, array_end, scratch3); |
663 | 663 |
664 // Repurpose registers no longer in use. | 664 // Repurpose registers no longer in use. |
665 Register hole_lower = elements; | 665 Register hole_lower = elements; |
666 Register hole_upper = length; | 666 Register hole_upper = length; |
667 __ li(hole_lower, Operand(kHoleNanLower32)); | 667 __ li(hole_lower, Operand(kHoleNanLower32)); |
668 __ li(hole_upper, Operand(kHoleNanUpper32)); | |
669 // scratch1: begin of source FixedArray element fields, not tagged | 668 // scratch1: begin of source FixedArray element fields, not tagged |
670 // hole_lower: kHoleNanLower32 | 669 // hole_lower: kHoleNanLower32 |
671 // hole_upper: kHoleNanUpper32 | 670 // hole_upper: kHoleNanUpper32 |
672 // array_end: end of destination FixedDoubleArray, not tagged | 671 // array_end: end of destination FixedDoubleArray, not tagged |
673 // scratch3: begin of FixedDoubleArray element fields, not tagged | 672 // scratch3: begin of FixedDoubleArray element fields, not tagged |
674 __ Branch(&entry); | 673 __ Branch(USE_DELAY_SLOT, &entry); |
| 674 __ li(hole_upper, Operand(kHoleNanUpper32)); // In delay slot. |
675 | 675 |
676 __ bind(&only_change_map); | 676 __ bind(&only_change_map); |
677 __ sd(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); | 677 __ sd(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
678 __ RecordWriteField(receiver, | 678 __ RecordWriteField(receiver, |
679 HeapObject::kMapOffset, | 679 HeapObject::kMapOffset, |
680 target_map, | 680 target_map, |
681 scratch2, | 681 scratch2, |
682 kRAHasNotBeenSaved, | 682 kRAHasBeenSaved, |
683 kDontSaveFPRegs, | 683 kDontSaveFPRegs, |
684 OMIT_REMEMBERED_SET, | 684 OMIT_REMEMBERED_SET, |
685 OMIT_SMI_CHECK); | 685 OMIT_SMI_CHECK); |
686 __ Branch(&done); | 686 __ Branch(&done); |
687 | 687 |
688 // Call into runtime if GC is required. | 688 // Call into runtime if GC is required. |
689 __ bind(&gc_required); | 689 __ bind(&gc_required); |
690 __ pop(ra); | 690 __ ld(ra, MemOperand(sp, 0)); |
691 __ Branch(fail); | 691 __ Branch(USE_DELAY_SLOT, fail); |
| 692 __ daddiu(sp, sp, kPointerSize); // In delay slot. |
692 | 693 |
693 // Convert and copy elements. | 694 // Convert and copy elements. |
694 __ bind(&loop); | 695 __ bind(&loop); |
695 __ ld(scratch2, MemOperand(scratch1)); | 696 __ ld(scratch2, MemOperand(scratch1)); |
696 __ Daddu(scratch1, scratch1, kIntSize); | 697 __ Daddu(scratch1, scratch1, kIntSize); |
697 // scratch2: current element | 698 // scratch2: current element |
698 __ JumpIfNotSmi(scratch2, &convert_hole); | 699 __ JumpIfNotSmi(scratch2, &convert_hole); |
699 __ SmiUntag(scratch2); | 700 __ SmiUntag(scratch2); |
700 | 701 |
701 // Normal smi, convert to double and store. | 702 // Normal smi, convert to double and store. |
702 __ mtc1(scratch2, f0); | 703 __ mtc1(scratch2, f0); |
703 __ cvt_d_w(f0, f0); | 704 __ cvt_d_w(f0, f0); |
704 __ sdc1(f0, MemOperand(scratch3)); | 705 __ sdc1(f0, MemOperand(scratch3)); |
705 __ Daddu(scratch3, scratch3, kDoubleSize); | 706 __ Branch(USE_DELAY_SLOT, &entry); |
706 | 707 __ daddiu(scratch3, scratch3, kDoubleSize); // In delay slot. |
707 __ Branch(&entry); | |
708 | 708 |
709 // Hole found, store the-hole NaN. | 709 // Hole found, store the-hole NaN. |
710 __ bind(&convert_hole); | 710 __ bind(&convert_hole); |
711 if (FLAG_debug_code) { | 711 if (FLAG_debug_code) { |
712 // Restore a "smi-untagged" heap object. | 712 // Restore a "smi-untagged" heap object. |
713 __ Or(scratch2, scratch2, Operand(1)); | 713 __ Or(scratch2, scratch2, Operand(1)); |
714 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 714 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
715 __ Assert(eq, kObjectFoundInSmiOnlyArray, at, Operand(scratch2)); | 715 __ Assert(eq, kObjectFoundInSmiOnlyArray, at, Operand(scratch2)); |
716 } | 716 } |
717 // mantissa | 717 // mantissa |
718 __ sw(hole_lower, MemOperand(scratch3)); | 718 __ sw(hole_lower, MemOperand(scratch3)); |
719 // exponent | 719 // exponent |
720 __ sw(hole_upper, MemOperand(scratch3, kIntSize)); | 720 __ sw(hole_upper, MemOperand(scratch3, kIntSize)); |
721 __ Daddu(scratch3, scratch3, kDoubleSize); | 721 __ Daddu(scratch3, scratch3, kDoubleSize); |
722 | 722 |
723 __ bind(&entry); | 723 __ bind(&entry); |
724 __ Branch(&loop, lt, scratch3, Operand(array_end)); | 724 __ Branch(&loop, lt, scratch3, Operand(array_end)); |
725 | 725 |
| 726 __ bind(&done); |
726 __ pop(ra); | 727 __ pop(ra); |
727 __ bind(&done); | |
728 } | 728 } |
729 | 729 |
730 | 730 |
731 void ElementsTransitionGenerator::GenerateDoubleToObject( | 731 void ElementsTransitionGenerator::GenerateDoubleToObject( |
732 MacroAssembler* masm, | 732 MacroAssembler* masm, |
733 Register receiver, | 733 Register receiver, |
734 Register key, | 734 Register key, |
735 Register value, | 735 Register value, |
736 Register target_map, | 736 Register target_map, |
737 AllocationSiteMode mode, | 737 AllocationSiteMode mode, |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 patcher.masm()->nop(); // Pad the empty space. | 1132 patcher.masm()->nop(); // Pad the empty space. |
1133 } | 1133 } |
1134 } | 1134 } |
1135 | 1135 |
1136 | 1136 |
1137 #undef __ | 1137 #undef __ |
1138 | 1138 |
1139 } } // namespace v8::internal | 1139 } } // namespace v8::internal |
1140 | 1140 |
1141 #endif // V8_TARGET_ARCH_MIPS64 | 1141 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |