OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 void FloatingPointHelper::LoadNumber(MacroAssembler* masm, | 648 void FloatingPointHelper::LoadNumber(MacroAssembler* masm, |
649 Destination destination, | 649 Destination destination, |
650 Register object, | 650 Register object, |
651 FPURegister dst, | 651 FPURegister dst, |
652 Register dst1, | 652 Register dst1, |
653 Register dst2, | 653 Register dst2, |
654 Register heap_number_map, | 654 Register heap_number_map, |
655 Register scratch1, | 655 Register scratch1, |
656 Register scratch2, | 656 Register scratch2, |
657 Label* not_number) { | 657 Label* not_number) { |
658 if (FLAG_debug_code) { | 658 __ AssertRootValue(heap_number_map, |
659 __ AbortIfNotRootValue(heap_number_map, | 659 Heap::kHeapNumberMapRootIndex, |
660 Heap::kHeapNumberMapRootIndex, | 660 "HeapNumberMap register clobbered."); |
661 "HeapNumberMap register clobbered."); | |
662 } | |
663 | 661 |
664 Label is_smi, done; | 662 Label is_smi, done; |
665 | 663 |
666 // Smi-check | 664 // Smi-check |
667 __ UntagAndJumpIfSmi(scratch1, object, &is_smi); | 665 __ UntagAndJumpIfSmi(scratch1, object, &is_smi); |
668 // Heap number check | 666 // Heap number check |
669 __ JumpIfNotHeapNumber(object, heap_number_map, scratch1, not_number); | 667 __ JumpIfNotHeapNumber(object, heap_number_map, scratch1, not_number); |
670 | 668 |
671 // Handle loading a double from a heap number. | 669 // Handle loading a double from a heap number. |
672 if (CpuFeatures::IsSupported(FPU) && | 670 if (CpuFeatures::IsSupported(FPU) && |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 | 712 |
715 void FloatingPointHelper::ConvertNumberToInt32(MacroAssembler* masm, | 713 void FloatingPointHelper::ConvertNumberToInt32(MacroAssembler* masm, |
716 Register object, | 714 Register object, |
717 Register dst, | 715 Register dst, |
718 Register heap_number_map, | 716 Register heap_number_map, |
719 Register scratch1, | 717 Register scratch1, |
720 Register scratch2, | 718 Register scratch2, |
721 Register scratch3, | 719 Register scratch3, |
722 FPURegister double_scratch, | 720 FPURegister double_scratch, |
723 Label* not_number) { | 721 Label* not_number) { |
724 if (FLAG_debug_code) { | 722 __ AssertRootValue(heap_number_map, |
725 __ AbortIfNotRootValue(heap_number_map, | 723 Heap::kHeapNumberMapRootIndex, |
726 Heap::kHeapNumberMapRootIndex, | 724 "HeapNumberMap register clobbered."); |
727 "HeapNumberMap register clobbered."); | |
728 } | |
729 Label done; | 725 Label done; |
730 Label not_in_int32_range; | 726 Label not_in_int32_range; |
731 | 727 |
732 __ UntagAndJumpIfSmi(dst, object, &done); | 728 __ UntagAndJumpIfSmi(dst, object, &done); |
733 __ lw(scratch1, FieldMemOperand(object, HeapNumber::kMapOffset)); | 729 __ lw(scratch1, FieldMemOperand(object, HeapNumber::kMapOffset)); |
734 __ Branch(not_number, ne, scratch1, Operand(heap_number_map)); | 730 __ Branch(not_number, ne, scratch1, Operand(heap_number_map)); |
735 __ ConvertToInt32(object, | 731 __ ConvertToInt32(object, |
736 dst, | 732 dst, |
737 scratch1, | 733 scratch1, |
738 scratch2, | 734 scratch2, |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 | 850 |
855 Label done, obj_is_not_smi; | 851 Label done, obj_is_not_smi; |
856 | 852 |
857 __ JumpIfNotSmi(object, &obj_is_not_smi); | 853 __ JumpIfNotSmi(object, &obj_is_not_smi); |
858 __ SmiUntag(scratch1, object); | 854 __ SmiUntag(scratch1, object); |
859 ConvertIntToDouble(masm, scratch1, destination, double_dst, dst1, dst2, | 855 ConvertIntToDouble(masm, scratch1, destination, double_dst, dst1, dst2, |
860 scratch2, single_scratch); | 856 scratch2, single_scratch); |
861 __ Branch(&done); | 857 __ Branch(&done); |
862 | 858 |
863 __ bind(&obj_is_not_smi); | 859 __ bind(&obj_is_not_smi); |
864 if (FLAG_debug_code) { | 860 __ AssertRootValue(heap_number_map, |
865 __ AbortIfNotRootValue(heap_number_map, | 861 Heap::kHeapNumberMapRootIndex, |
866 Heap::kHeapNumberMapRootIndex, | 862 "HeapNumberMap register clobbered."); |
867 "HeapNumberMap register clobbered."); | |
868 } | |
869 __ JumpIfNotHeapNumber(object, heap_number_map, scratch1, not_int32); | 863 __ JumpIfNotHeapNumber(object, heap_number_map, scratch1, not_int32); |
870 | 864 |
871 // Load the number. | 865 // Load the number. |
872 if (CpuFeatures::IsSupported(FPU)) { | 866 if (CpuFeatures::IsSupported(FPU)) { |
873 CpuFeatures::Scope scope(FPU); | 867 CpuFeatures::Scope scope(FPU); |
874 // Load the double value. | 868 // Load the double value. |
875 __ ldc1(double_dst, FieldMemOperand(object, HeapNumber::kValueOffset)); | 869 __ ldc1(double_dst, FieldMemOperand(object, HeapNumber::kValueOffset)); |
876 | 870 |
877 Register except_flag = scratch2; | 871 Register except_flag = scratch2; |
878 __ EmitFPUTruncate(kRoundToZero, | 872 __ EmitFPUTruncate(kRoundToZero, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
925 ASSERT(!dst.is(object)); | 919 ASSERT(!dst.is(object)); |
926 ASSERT(!scratch1.is(object) && !scratch2.is(object) && !scratch3.is(object)); | 920 ASSERT(!scratch1.is(object) && !scratch2.is(object) && !scratch3.is(object)); |
927 ASSERT(!scratch1.is(scratch2) && | 921 ASSERT(!scratch1.is(scratch2) && |
928 !scratch1.is(scratch3) && | 922 !scratch1.is(scratch3) && |
929 !scratch2.is(scratch3)); | 923 !scratch2.is(scratch3)); |
930 | 924 |
931 Label done; | 925 Label done; |
932 | 926 |
933 __ UntagAndJumpIfSmi(dst, object, &done); | 927 __ UntagAndJumpIfSmi(dst, object, &done); |
934 | 928 |
935 if (FLAG_debug_code) { | 929 __ AssertRootValue(heap_number_map, |
936 __ AbortIfNotRootValue(heap_number_map, | 930 Heap::kHeapNumberMapRootIndex, |
937 Heap::kHeapNumberMapRootIndex, | 931 "HeapNumberMap register clobbered."); |
938 "HeapNumberMap register clobbered."); | |
939 } | |
940 __ JumpIfNotHeapNumber(object, heap_number_map, scratch1, not_int32); | 932 __ JumpIfNotHeapNumber(object, heap_number_map, scratch1, not_int32); |
941 | 933 |
942 // Object is a heap number. | 934 // Object is a heap number. |
943 // Convert the floating point value to a 32-bit integer. | 935 // Convert the floating point value to a 32-bit integer. |
944 if (CpuFeatures::IsSupported(FPU)) { | 936 if (CpuFeatures::IsSupported(FPU)) { |
945 CpuFeatures::Scope scope(FPU); | 937 CpuFeatures::Scope scope(FPU); |
946 // Load the double value. | 938 // Load the double value. |
947 __ ldc1(double_scratch, FieldMemOperand(object, HeapNumber::kValueOffset)); | 939 __ ldc1(double_scratch, FieldMemOperand(object, HeapNumber::kValueOffset)); |
948 | 940 |
949 FPURegister single_scratch = double_scratch.low(); | 941 FPURegister single_scratch = double_scratch.low(); |
(...skipping 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2612 bool smi_operands, | 2604 bool smi_operands, |
2613 Label* not_numbers, | 2605 Label* not_numbers, |
2614 Label* gc_required) { | 2606 Label* gc_required) { |
2615 Register left = a1; | 2607 Register left = a1; |
2616 Register right = a0; | 2608 Register right = a0; |
2617 Register scratch1 = t3; | 2609 Register scratch1 = t3; |
2618 Register scratch2 = t5; | 2610 Register scratch2 = t5; |
2619 Register scratch3 = t0; | 2611 Register scratch3 = t0; |
2620 | 2612 |
2621 ASSERT(smi_operands || (not_numbers != NULL)); | 2613 ASSERT(smi_operands || (not_numbers != NULL)); |
2622 if (smi_operands && FLAG_debug_code) { | 2614 if (smi_operands) { |
2623 __ AbortIfNotSmi(left); | 2615 __ AssertSmi(left); |
2624 __ AbortIfNotSmi(right); | 2616 __ AssertSmi(right); |
2625 } | 2617 } |
2626 | 2618 |
2627 Register heap_number_map = t2; | 2619 Register heap_number_map = t2; |
2628 __ LoadRoot(heap_number_map, Heap::kHeapNumberMapRootIndex); | 2620 __ LoadRoot(heap_number_map, Heap::kHeapNumberMapRootIndex); |
2629 | 2621 |
2630 switch (op_) { | 2622 switch (op_) { |
2631 case Token::ADD: | 2623 case Token::ADD: |
2632 case Token::SUB: | 2624 case Token::SUB: |
2633 case Token::MUL: | 2625 case Token::MUL: |
2634 case Token::DIV: | 2626 case Token::DIV: |
(...skipping 4623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7258 Label* done, | 7250 Label* done, |
7259 Register elements, | 7251 Register elements, |
7260 Register name, | 7252 Register name, |
7261 Register scratch1, | 7253 Register scratch1, |
7262 Register scratch2) { | 7254 Register scratch2) { |
7263 ASSERT(!elements.is(scratch1)); | 7255 ASSERT(!elements.is(scratch1)); |
7264 ASSERT(!elements.is(scratch2)); | 7256 ASSERT(!elements.is(scratch2)); |
7265 ASSERT(!name.is(scratch1)); | 7257 ASSERT(!name.is(scratch1)); |
7266 ASSERT(!name.is(scratch2)); | 7258 ASSERT(!name.is(scratch2)); |
7267 | 7259 |
7268 // Assert that name contains a string. | 7260 __ AssertString(name); |
7269 if (FLAG_debug_code) __ AbortIfNotString(name); | |
7270 | 7261 |
7271 // Compute the capacity mask. | 7262 // Compute the capacity mask. |
7272 __ lw(scratch1, FieldMemOperand(elements, kCapacityOffset)); | 7263 __ lw(scratch1, FieldMemOperand(elements, kCapacityOffset)); |
7273 __ sra(scratch1, scratch1, kSmiTagSize); // convert smi to int | 7264 __ sra(scratch1, scratch1, kSmiTagSize); // convert smi to int |
7274 __ Subu(scratch1, scratch1, Operand(1)); | 7265 __ Subu(scratch1, scratch1, Operand(1)); |
7275 | 7266 |
7276 // Generate an unrolled loop that performs a few probes before | 7267 // Generate an unrolled loop that performs a few probes before |
7277 // giving up. Measurements done on Gmail indicate that 2 probes | 7268 // giving up. Measurements done on Gmail indicate that 2 probes |
7278 // cover ~93% of loads from dictionaries. | 7269 // cover ~93% of loads from dictionaries. |
7279 for (int i = 0; i < kInlinedProbes; i++) { | 7270 for (int i = 0; i < kInlinedProbes; i++) { |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7831 __ Pop(ra, t1, a1); | 7822 __ Pop(ra, t1, a1); |
7832 __ Ret(); | 7823 __ Ret(); |
7833 } | 7824 } |
7834 | 7825 |
7835 | 7826 |
7836 #undef __ | 7827 #undef __ |
7837 | 7828 |
7838 } } // namespace v8::internal | 7829 } } // namespace v8::internal |
7839 | 7830 |
7840 #endif // V8_TARGET_ARCH_MIPS | 7831 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |