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 DwVfpRegister dst, | 651 DwVfpRegister 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(VFP2) && | 670 if (CpuFeatures::IsSupported(VFP2) && |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 | 707 |
710 void FloatingPointHelper::ConvertNumberToInt32(MacroAssembler* masm, | 708 void FloatingPointHelper::ConvertNumberToInt32(MacroAssembler* masm, |
711 Register object, | 709 Register object, |
712 Register dst, | 710 Register dst, |
713 Register heap_number_map, | 711 Register heap_number_map, |
714 Register scratch1, | 712 Register scratch1, |
715 Register scratch2, | 713 Register scratch2, |
716 Register scratch3, | 714 Register scratch3, |
717 DwVfpRegister double_scratch, | 715 DwVfpRegister double_scratch, |
718 Label* not_number) { | 716 Label* not_number) { |
719 if (FLAG_debug_code) { | 717 __ AssertRootValue(heap_number_map, |
720 __ AbortIfNotRootValue(heap_number_map, | 718 Heap::kHeapNumberMapRootIndex, |
721 Heap::kHeapNumberMapRootIndex, | 719 "HeapNumberMap register clobbered."); |
722 "HeapNumberMap register clobbered."); | |
723 } | |
724 Label done; | 720 Label done; |
725 Label not_in_int32_range; | 721 Label not_in_int32_range; |
726 | 722 |
727 __ UntagAndJumpIfSmi(dst, object, &done); | 723 __ UntagAndJumpIfSmi(dst, object, &done); |
728 __ ldr(scratch1, FieldMemOperand(object, HeapNumber::kMapOffset)); | 724 __ ldr(scratch1, FieldMemOperand(object, HeapNumber::kMapOffset)); |
729 __ cmp(scratch1, heap_number_map); | 725 __ cmp(scratch1, heap_number_map); |
730 __ b(ne, not_number); | 726 __ b(ne, not_number); |
731 __ ConvertToInt32(object, | 727 __ ConvertToInt32(object, |
732 dst, | 728 dst, |
733 scratch1, | 729 scratch1, |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 | 838 |
843 Label done, obj_is_not_smi; | 839 Label done, obj_is_not_smi; |
844 | 840 |
845 __ JumpIfNotSmi(object, &obj_is_not_smi); | 841 __ JumpIfNotSmi(object, &obj_is_not_smi); |
846 __ SmiUntag(scratch1, object); | 842 __ SmiUntag(scratch1, object); |
847 ConvertIntToDouble(masm, scratch1, destination, double_dst, dst1, dst2, | 843 ConvertIntToDouble(masm, scratch1, destination, double_dst, dst1, dst2, |
848 scratch2, single_scratch); | 844 scratch2, single_scratch); |
849 __ b(&done); | 845 __ b(&done); |
850 | 846 |
851 __ bind(&obj_is_not_smi); | 847 __ bind(&obj_is_not_smi); |
852 if (FLAG_debug_code) { | 848 __ AssertRootValue(heap_number_map, |
853 __ AbortIfNotRootValue(heap_number_map, | 849 Heap::kHeapNumberMapRootIndex, |
854 Heap::kHeapNumberMapRootIndex, | 850 "HeapNumberMap register clobbered."); |
855 "HeapNumberMap register clobbered."); | |
856 } | |
857 __ JumpIfNotHeapNumber(object, heap_number_map, scratch1, not_int32); | 851 __ JumpIfNotHeapNumber(object, heap_number_map, scratch1, not_int32); |
858 | 852 |
859 // Load the number. | 853 // Load the number. |
860 if (CpuFeatures::IsSupported(VFP2)) { | 854 if (CpuFeatures::IsSupported(VFP2)) { |
861 CpuFeatures::Scope scope(VFP2); | 855 CpuFeatures::Scope scope(VFP2); |
862 // Load the double value. | 856 // Load the double value. |
863 __ sub(scratch1, object, Operand(kHeapObjectTag)); | 857 __ sub(scratch1, object, Operand(kHeapObjectTag)); |
864 __ vldr(double_dst, scratch1, HeapNumber::kValueOffset); | 858 __ vldr(double_dst, scratch1, HeapNumber::kValueOffset); |
865 | 859 |
866 __ EmitVFPTruncate(kRoundToZero, | 860 __ EmitVFPTruncate(kRoundToZero, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 ASSERT(!dst.is(object)); | 907 ASSERT(!dst.is(object)); |
914 ASSERT(!scratch1.is(object) && !scratch2.is(object) && !scratch3.is(object)); | 908 ASSERT(!scratch1.is(object) && !scratch2.is(object) && !scratch3.is(object)); |
915 ASSERT(!scratch1.is(scratch2) && | 909 ASSERT(!scratch1.is(scratch2) && |
916 !scratch1.is(scratch3) && | 910 !scratch1.is(scratch3) && |
917 !scratch2.is(scratch3)); | 911 !scratch2.is(scratch3)); |
918 | 912 |
919 Label done; | 913 Label done; |
920 | 914 |
921 __ UntagAndJumpIfSmi(dst, object, &done); | 915 __ UntagAndJumpIfSmi(dst, object, &done); |
922 | 916 |
923 if (FLAG_debug_code) { | 917 __ AssertRootValue(heap_number_map, |
924 __ AbortIfNotRootValue(heap_number_map, | 918 Heap::kHeapNumberMapRootIndex, |
925 Heap::kHeapNumberMapRootIndex, | 919 "HeapNumberMap register clobbered."); |
926 "HeapNumberMap register clobbered."); | |
927 } | |
928 __ JumpIfNotHeapNumber(object, heap_number_map, scratch1, not_int32); | 920 __ JumpIfNotHeapNumber(object, heap_number_map, scratch1, not_int32); |
929 | 921 |
930 // Object is a heap number. | 922 // Object is a heap number. |
931 // Convert the floating point value to a 32-bit integer. | 923 // Convert the floating point value to a 32-bit integer. |
932 if (CpuFeatures::IsSupported(VFP2)) { | 924 if (CpuFeatures::IsSupported(VFP2)) { |
933 CpuFeatures::Scope scope(VFP2); | 925 CpuFeatures::Scope scope(VFP2); |
934 | 926 |
935 // Load the double value. | 927 // Load the double value. |
936 __ sub(scratch1, object, Operand(kHeapObjectTag)); | 928 __ sub(scratch1, object, Operand(kHeapObjectTag)); |
937 __ vldr(double_scratch0, scratch1, HeapNumber::kValueOffset); | 929 __ vldr(double_scratch0, scratch1, HeapNumber::kValueOffset); |
(...skipping 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2538 bool smi_operands, | 2530 bool smi_operands, |
2539 Label* not_numbers, | 2531 Label* not_numbers, |
2540 Label* gc_required) { | 2532 Label* gc_required) { |
2541 Register left = r1; | 2533 Register left = r1; |
2542 Register right = r0; | 2534 Register right = r0; |
2543 Register scratch1 = r7; | 2535 Register scratch1 = r7; |
2544 Register scratch2 = r9; | 2536 Register scratch2 = r9; |
2545 Register scratch3 = r4; | 2537 Register scratch3 = r4; |
2546 | 2538 |
2547 ASSERT(smi_operands || (not_numbers != NULL)); | 2539 ASSERT(smi_operands || (not_numbers != NULL)); |
2548 if (smi_operands && FLAG_debug_code) { | 2540 if (smi_operands) { |
2549 __ AbortIfNotSmi(left); | 2541 __ AssertSmi(left); |
2550 __ AbortIfNotSmi(right); | 2542 __ AssertSmi(right); |
2551 } | 2543 } |
2552 | 2544 |
2553 Register heap_number_map = r6; | 2545 Register heap_number_map = r6; |
2554 __ LoadRoot(heap_number_map, Heap::kHeapNumberMapRootIndex); | 2546 __ LoadRoot(heap_number_map, Heap::kHeapNumberMapRootIndex); |
2555 | 2547 |
2556 switch (op_) { | 2548 switch (op_) { |
2557 case Token::ADD: | 2549 case Token::ADD: |
2558 case Token::SUB: | 2550 case Token::SUB: |
2559 case Token::MUL: | 2551 case Token::MUL: |
2560 case Token::DIV: | 2552 case Token::DIV: |
(...skipping 4497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7058 Label* done, | 7050 Label* done, |
7059 Register elements, | 7051 Register elements, |
7060 Register name, | 7052 Register name, |
7061 Register scratch1, | 7053 Register scratch1, |
7062 Register scratch2) { | 7054 Register scratch2) { |
7063 ASSERT(!elements.is(scratch1)); | 7055 ASSERT(!elements.is(scratch1)); |
7064 ASSERT(!elements.is(scratch2)); | 7056 ASSERT(!elements.is(scratch2)); |
7065 ASSERT(!name.is(scratch1)); | 7057 ASSERT(!name.is(scratch1)); |
7066 ASSERT(!name.is(scratch2)); | 7058 ASSERT(!name.is(scratch2)); |
7067 | 7059 |
7068 // Assert that name contains a string. | 7060 __ AssertString(name); |
7069 if (FLAG_debug_code) __ AbortIfNotString(name); | |
7070 | 7061 |
7071 // Compute the capacity mask. | 7062 // Compute the capacity mask. |
7072 __ ldr(scratch1, FieldMemOperand(elements, kCapacityOffset)); | 7063 __ ldr(scratch1, FieldMemOperand(elements, kCapacityOffset)); |
7073 __ mov(scratch1, Operand(scratch1, ASR, kSmiTagSize)); // convert smi to int | 7064 __ mov(scratch1, Operand(scratch1, ASR, kSmiTagSize)); // convert smi to int |
7074 __ sub(scratch1, scratch1, Operand(1)); | 7065 __ sub(scratch1, scratch1, Operand(1)); |
7075 | 7066 |
7076 // Generate an unrolled loop that performs a few probes before | 7067 // Generate an unrolled loop that performs a few probes before |
7077 // giving up. Measurements done on Gmail indicate that 2 probes | 7068 // giving up. Measurements done on Gmail indicate that 2 probes |
7078 // cover ~93% of loads from dictionaries. | 7069 // cover ~93% of loads from dictionaries. |
7079 for (int i = 0; i < kInlinedProbes; i++) { | 7070 for (int i = 0; i < kInlinedProbes; i++) { |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7632 | 7623 |
7633 __ Pop(lr, r5, r1); | 7624 __ Pop(lr, r5, r1); |
7634 __ Ret(); | 7625 __ Ret(); |
7635 } | 7626 } |
7636 | 7627 |
7637 #undef __ | 7628 #undef __ |
7638 | 7629 |
7639 } } // namespace v8::internal | 7630 } } // namespace v8::internal |
7640 | 7631 |
7641 #endif // V8_TARGET_ARCH_ARM | 7632 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |