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/code-stubs.h" | 5 #include "src/code-stubs.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 // Shared entry for floating point addition. | 673 // Shared entry for floating point addition. |
674 Label do_fadd(assembler), end(assembler), | 674 Label do_fadd(assembler), end(assembler), |
675 call_add_stub(assembler, Label::kDeferred); | 675 call_add_stub(assembler, Label::kDeferred); |
676 Variable var_fadd_lhs(assembler, MachineRepresentation::kFloat64), | 676 Variable var_fadd_lhs(assembler, MachineRepresentation::kFloat64), |
677 var_fadd_rhs(assembler, MachineRepresentation::kFloat64), | 677 var_fadd_rhs(assembler, MachineRepresentation::kFloat64), |
678 var_type_feedback(assembler, MachineRepresentation::kWord32), | 678 var_type_feedback(assembler, MachineRepresentation::kWord32), |
679 var_result(assembler, MachineRepresentation::kTagged); | 679 var_result(assembler, MachineRepresentation::kTagged); |
680 | 680 |
681 // Check if the {lhs} is a Smi or a HeapObject. | 681 // Check if the {lhs} is a Smi or a HeapObject. |
682 Label if_lhsissmi(assembler), if_lhsisnotsmi(assembler); | 682 Label if_lhsissmi(assembler), if_lhsisnotsmi(assembler); |
683 assembler->Branch(assembler->WordIsSmi(lhs), &if_lhsissmi, &if_lhsisnotsmi); | 683 assembler->Branch(assembler->TaggedIsSmi(lhs), &if_lhsissmi, &if_lhsisnotsmi); |
684 | 684 |
685 assembler->Bind(&if_lhsissmi); | 685 assembler->Bind(&if_lhsissmi); |
686 { | 686 { |
687 // Check if the {rhs} is also a Smi. | 687 // Check if the {rhs} is also a Smi. |
688 Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler); | 688 Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler); |
689 assembler->Branch(assembler->WordIsSmi(rhs), &if_rhsissmi, &if_rhsisnotsmi); | 689 assembler->Branch(assembler->TaggedIsSmi(rhs), &if_rhsissmi, |
| 690 &if_rhsisnotsmi); |
690 | 691 |
691 assembler->Bind(&if_rhsissmi); | 692 assembler->Bind(&if_rhsissmi); |
692 { | 693 { |
693 // Try fast Smi addition first. | 694 // Try fast Smi addition first. |
694 Node* pair = assembler->SmiAddWithOverflow(lhs, rhs); | 695 Node* pair = assembler->SmiAddWithOverflow(lhs, rhs); |
695 Node* overflow = assembler->Projection(1, pair); | 696 Node* overflow = assembler->Projection(1, pair); |
696 | 697 |
697 // Check if the Smi additon overflowed. | 698 // Check if the Smi additon overflowed. |
698 Label if_overflow(assembler), if_notoverflow(assembler); | 699 Label if_overflow(assembler), if_notoverflow(assembler); |
699 assembler->Branch(overflow, &if_overflow, &if_notoverflow); | 700 assembler->Branch(overflow, &if_overflow, &if_notoverflow); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 | 736 |
736 // Load the map of {lhs}. | 737 // Load the map of {lhs}. |
737 Node* lhs_map = assembler->LoadMap(lhs); | 738 Node* lhs_map = assembler->LoadMap(lhs); |
738 | 739 |
739 // Check if {lhs} is a HeapNumber. | 740 // Check if {lhs} is a HeapNumber. |
740 Label if_lhsisnumber(assembler), if_lhsisnotnumber(assembler); | 741 Label if_lhsisnumber(assembler), if_lhsisnotnumber(assembler); |
741 assembler->GotoUnless(assembler->IsHeapNumberMap(lhs_map), &check_string); | 742 assembler->GotoUnless(assembler->IsHeapNumberMap(lhs_map), &check_string); |
742 | 743 |
743 // Check if the {rhs} is Smi. | 744 // Check if the {rhs} is Smi. |
744 Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler); | 745 Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler); |
745 assembler->Branch(assembler->WordIsSmi(rhs), &if_rhsissmi, &if_rhsisnotsmi); | 746 assembler->Branch(assembler->TaggedIsSmi(rhs), &if_rhsissmi, |
| 747 &if_rhsisnotsmi); |
746 | 748 |
747 assembler->Bind(&if_rhsissmi); | 749 assembler->Bind(&if_rhsissmi); |
748 { | 750 { |
749 var_fadd_lhs.Bind(assembler->LoadHeapNumberValue(lhs)); | 751 var_fadd_lhs.Bind(assembler->LoadHeapNumberValue(lhs)); |
750 var_fadd_rhs.Bind(assembler->SmiToFloat64(rhs)); | 752 var_fadd_rhs.Bind(assembler->SmiToFloat64(rhs)); |
751 assembler->Goto(&do_fadd); | 753 assembler->Goto(&do_fadd); |
752 } | 754 } |
753 | 755 |
754 assembler->Bind(&if_rhsisnotsmi); | 756 assembler->Bind(&if_rhsisnotsmi); |
755 { | 757 { |
756 // Load the map of {rhs}. | 758 // Load the map of {rhs}. |
757 Node* rhs_map = assembler->LoadMap(rhs); | 759 Node* rhs_map = assembler->LoadMap(rhs); |
758 | 760 |
759 // Check if the {rhs} is a HeapNumber. | 761 // Check if the {rhs} is a HeapNumber. |
760 assembler->GotoUnless(assembler->IsHeapNumberMap(rhs_map), | 762 assembler->GotoUnless(assembler->IsHeapNumberMap(rhs_map), |
761 &call_add_stub); | 763 &call_add_stub); |
762 | 764 |
763 var_fadd_lhs.Bind(assembler->LoadHeapNumberValue(lhs)); | 765 var_fadd_lhs.Bind(assembler->LoadHeapNumberValue(lhs)); |
764 var_fadd_rhs.Bind(assembler->LoadHeapNumberValue(rhs)); | 766 var_fadd_rhs.Bind(assembler->LoadHeapNumberValue(rhs)); |
765 assembler->Goto(&do_fadd); | 767 assembler->Goto(&do_fadd); |
766 } | 768 } |
767 | 769 |
768 assembler->Bind(&check_string); | 770 assembler->Bind(&check_string); |
769 { | 771 { |
770 // Check if the {rhs} is a smi, and exit the string check early if it is. | 772 // Check if the {rhs} is a smi, and exit the string check early if it is. |
771 assembler->GotoIf(assembler->WordIsSmi(rhs), &call_add_stub); | 773 assembler->GotoIf(assembler->TaggedIsSmi(rhs), &call_add_stub); |
772 | 774 |
773 Node* lhs_instance_type = assembler->LoadMapInstanceType(lhs_map); | 775 Node* lhs_instance_type = assembler->LoadMapInstanceType(lhs_map); |
774 | 776 |
775 // Exit unless {lhs} is a string | 777 // Exit unless {lhs} is a string |
776 assembler->GotoUnless(assembler->IsStringInstanceType(lhs_instance_type), | 778 assembler->GotoUnless(assembler->IsStringInstanceType(lhs_instance_type), |
777 &call_add_stub); | 779 &call_add_stub); |
778 | 780 |
779 Node* rhs_instance_type = assembler->LoadInstanceType(rhs); | 781 Node* rhs_instance_type = assembler->LoadInstanceType(rhs); |
780 | 782 |
781 // Exit unless {rhs} is a string | 783 // Exit unless {rhs} is a string |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 Label do_fsub(assembler), end(assembler), call_subtract_stub(assembler), | 833 Label do_fsub(assembler), end(assembler), call_subtract_stub(assembler), |
832 if_lhsisnotnumber(assembler), check_rhsisoddball(assembler), | 834 if_lhsisnotnumber(assembler), check_rhsisoddball(assembler), |
833 call_with_any_feedback(assembler); | 835 call_with_any_feedback(assembler); |
834 Variable var_fsub_lhs(assembler, MachineRepresentation::kFloat64), | 836 Variable var_fsub_lhs(assembler, MachineRepresentation::kFloat64), |
835 var_fsub_rhs(assembler, MachineRepresentation::kFloat64), | 837 var_fsub_rhs(assembler, MachineRepresentation::kFloat64), |
836 var_type_feedback(assembler, MachineRepresentation::kWord32), | 838 var_type_feedback(assembler, MachineRepresentation::kWord32), |
837 var_result(assembler, MachineRepresentation::kTagged); | 839 var_result(assembler, MachineRepresentation::kTagged); |
838 | 840 |
839 // Check if the {lhs} is a Smi or a HeapObject. | 841 // Check if the {lhs} is a Smi or a HeapObject. |
840 Label if_lhsissmi(assembler), if_lhsisnotsmi(assembler); | 842 Label if_lhsissmi(assembler), if_lhsisnotsmi(assembler); |
841 assembler->Branch(assembler->WordIsSmi(lhs), &if_lhsissmi, &if_lhsisnotsmi); | 843 assembler->Branch(assembler->TaggedIsSmi(lhs), &if_lhsissmi, &if_lhsisnotsmi); |
842 | 844 |
843 assembler->Bind(&if_lhsissmi); | 845 assembler->Bind(&if_lhsissmi); |
844 { | 846 { |
845 // Check if the {rhs} is also a Smi. | 847 // Check if the {rhs} is also a Smi. |
846 Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler); | 848 Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler); |
847 assembler->Branch(assembler->WordIsSmi(rhs), &if_rhsissmi, &if_rhsisnotsmi); | 849 assembler->Branch(assembler->TaggedIsSmi(rhs), &if_rhsissmi, |
| 850 &if_rhsisnotsmi); |
848 | 851 |
849 assembler->Bind(&if_rhsissmi); | 852 assembler->Bind(&if_rhsissmi); |
850 { | 853 { |
851 // Try a fast Smi subtraction first. | 854 // Try a fast Smi subtraction first. |
852 Node* pair = assembler->SmiSubWithOverflow(lhs, rhs); | 855 Node* pair = assembler->SmiSubWithOverflow(lhs, rhs); |
853 Node* overflow = assembler->Projection(1, pair); | 856 Node* overflow = assembler->Projection(1, pair); |
854 | 857 |
855 // Check if the Smi subtraction overflowed. | 858 // Check if the Smi subtraction overflowed. |
856 Label if_overflow(assembler), if_notoverflow(assembler); | 859 Label if_overflow(assembler), if_notoverflow(assembler); |
857 assembler->Branch(overflow, &if_overflow, &if_notoverflow); | 860 assembler->Branch(overflow, &if_overflow, &if_notoverflow); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 { | 896 { |
894 // Load the map of the {lhs}. | 897 // Load the map of the {lhs}. |
895 Node* lhs_map = assembler->LoadMap(lhs); | 898 Node* lhs_map = assembler->LoadMap(lhs); |
896 | 899 |
897 // Check if the {lhs} is a HeapNumber. | 900 // Check if the {lhs} is a HeapNumber. |
898 assembler->GotoUnless(assembler->IsHeapNumberMap(lhs_map), | 901 assembler->GotoUnless(assembler->IsHeapNumberMap(lhs_map), |
899 &if_lhsisnotnumber); | 902 &if_lhsisnotnumber); |
900 | 903 |
901 // Check if the {rhs} is a Smi. | 904 // Check if the {rhs} is a Smi. |
902 Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler); | 905 Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler); |
903 assembler->Branch(assembler->WordIsSmi(rhs), &if_rhsissmi, &if_rhsisnotsmi); | 906 assembler->Branch(assembler->TaggedIsSmi(rhs), &if_rhsissmi, |
| 907 &if_rhsisnotsmi); |
904 | 908 |
905 assembler->Bind(&if_rhsissmi); | 909 assembler->Bind(&if_rhsissmi); |
906 { | 910 { |
907 // Perform a floating point subtraction. | 911 // Perform a floating point subtraction. |
908 var_fsub_lhs.Bind(assembler->LoadHeapNumberValue(lhs)); | 912 var_fsub_lhs.Bind(assembler->LoadHeapNumberValue(lhs)); |
909 var_fsub_rhs.Bind(assembler->SmiToFloat64(rhs)); | 913 var_fsub_rhs.Bind(assembler->SmiToFloat64(rhs)); |
910 assembler->Goto(&do_fsub); | 914 assembler->Goto(&do_fsub); |
911 } | 915 } |
912 | 916 |
913 assembler->Bind(&if_rhsisnotsmi); | 917 assembler->Bind(&if_rhsisnotsmi); |
(...skipping 26 matching lines...) Expand all Loading... |
940 assembler->Bind(&if_lhsisnotnumber); | 944 assembler->Bind(&if_lhsisnotnumber); |
941 { | 945 { |
942 // No checks on rhs are done yet. We just know lhs is not a number or Smi. | 946 // No checks on rhs are done yet. We just know lhs is not a number or Smi. |
943 // Check if lhs is an oddball. | 947 // Check if lhs is an oddball. |
944 Node* lhs_instance_type = assembler->LoadInstanceType(lhs); | 948 Node* lhs_instance_type = assembler->LoadInstanceType(lhs); |
945 Node* lhs_is_oddball = assembler->Word32Equal( | 949 Node* lhs_is_oddball = assembler->Word32Equal( |
946 lhs_instance_type, assembler->Int32Constant(ODDBALL_TYPE)); | 950 lhs_instance_type, assembler->Int32Constant(ODDBALL_TYPE)); |
947 assembler->GotoUnless(lhs_is_oddball, &call_with_any_feedback); | 951 assembler->GotoUnless(lhs_is_oddball, &call_with_any_feedback); |
948 | 952 |
949 Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler); | 953 Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler); |
950 assembler->Branch(assembler->WordIsSmi(rhs), &if_rhsissmi, &if_rhsisnotsmi); | 954 assembler->Branch(assembler->TaggedIsSmi(rhs), &if_rhsissmi, |
| 955 &if_rhsisnotsmi); |
951 | 956 |
952 assembler->Bind(&if_rhsissmi); | 957 assembler->Bind(&if_rhsissmi); |
953 { | 958 { |
954 var_type_feedback.Bind( | 959 var_type_feedback.Bind( |
955 assembler->Int32Constant(BinaryOperationFeedback::kNumberOrOddball)); | 960 assembler->Int32Constant(BinaryOperationFeedback::kNumberOrOddball)); |
956 assembler->Goto(&call_subtract_stub); | 961 assembler->Goto(&call_subtract_stub); |
957 } | 962 } |
958 | 963 |
959 assembler->Bind(&if_rhsisnotsmi); | 964 assembler->Bind(&if_rhsisnotsmi); |
960 { | 965 { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 Label do_fmul(assembler), end(assembler), | 1024 Label do_fmul(assembler), end(assembler), |
1020 call_multiply_stub(assembler, Label::kDeferred); | 1025 call_multiply_stub(assembler, Label::kDeferred); |
1021 Variable var_lhs_float64(assembler, MachineRepresentation::kFloat64), | 1026 Variable var_lhs_float64(assembler, MachineRepresentation::kFloat64), |
1022 var_rhs_float64(assembler, MachineRepresentation::kFloat64), | 1027 var_rhs_float64(assembler, MachineRepresentation::kFloat64), |
1023 var_result(assembler, MachineRepresentation::kTagged), | 1028 var_result(assembler, MachineRepresentation::kTagged), |
1024 var_type_feedback(assembler, MachineRepresentation::kWord32); | 1029 var_type_feedback(assembler, MachineRepresentation::kWord32); |
1025 | 1030 |
1026 Node* number_map = assembler->HeapNumberMapConstant(); | 1031 Node* number_map = assembler->HeapNumberMapConstant(); |
1027 | 1032 |
1028 Label lhs_is_smi(assembler), lhs_is_not_smi(assembler); | 1033 Label lhs_is_smi(assembler), lhs_is_not_smi(assembler); |
1029 assembler->Branch(assembler->WordIsSmi(lhs), &lhs_is_smi, &lhs_is_not_smi); | 1034 assembler->Branch(assembler->TaggedIsSmi(lhs), &lhs_is_smi, &lhs_is_not_smi); |
1030 | 1035 |
1031 assembler->Bind(&lhs_is_smi); | 1036 assembler->Bind(&lhs_is_smi); |
1032 { | 1037 { |
1033 Label rhs_is_smi(assembler), rhs_is_not_smi(assembler); | 1038 Label rhs_is_smi(assembler), rhs_is_not_smi(assembler); |
1034 assembler->Branch(assembler->WordIsSmi(rhs), &rhs_is_smi, &rhs_is_not_smi); | 1039 assembler->Branch(assembler->TaggedIsSmi(rhs), &rhs_is_smi, |
| 1040 &rhs_is_not_smi); |
1035 | 1041 |
1036 assembler->Bind(&rhs_is_smi); | 1042 assembler->Bind(&rhs_is_smi); |
1037 { | 1043 { |
1038 // Both {lhs} and {rhs} are Smis. The result is not necessarily a smi, | 1044 // Both {lhs} and {rhs} are Smis. The result is not necessarily a smi, |
1039 // in case of overflow. | 1045 // in case of overflow. |
1040 var_result.Bind(assembler->SmiMul(lhs, rhs)); | 1046 var_result.Bind(assembler->SmiMul(lhs, rhs)); |
1041 var_type_feedback.Bind(assembler->Select( | 1047 var_type_feedback.Bind(assembler->Select( |
1042 assembler->WordIsSmi(var_result.value()), | 1048 assembler->TaggedIsSmi(var_result.value()), |
1043 assembler->Int32Constant(BinaryOperationFeedback::kSignedSmall), | 1049 assembler->Int32Constant(BinaryOperationFeedback::kSignedSmall), |
1044 assembler->Int32Constant(BinaryOperationFeedback::kNumber), | 1050 assembler->Int32Constant(BinaryOperationFeedback::kNumber), |
1045 MachineRepresentation::kWord32)); | 1051 MachineRepresentation::kWord32)); |
1046 assembler->Goto(&end); | 1052 assembler->Goto(&end); |
1047 } | 1053 } |
1048 | 1054 |
1049 assembler->Bind(&rhs_is_not_smi); | 1055 assembler->Bind(&rhs_is_not_smi); |
1050 { | 1056 { |
1051 Node* rhs_map = assembler->LoadMap(rhs); | 1057 Node* rhs_map = assembler->LoadMap(rhs); |
1052 | 1058 |
(...skipping 11 matching lines...) Expand all Loading... |
1064 assembler->Bind(&lhs_is_not_smi); | 1070 assembler->Bind(&lhs_is_not_smi); |
1065 { | 1071 { |
1066 Node* lhs_map = assembler->LoadMap(lhs); | 1072 Node* lhs_map = assembler->LoadMap(lhs); |
1067 | 1073 |
1068 // Check if {lhs} is a HeapNumber. | 1074 // Check if {lhs} is a HeapNumber. |
1069 assembler->GotoUnless(assembler->WordEqual(lhs_map, number_map), | 1075 assembler->GotoUnless(assembler->WordEqual(lhs_map, number_map), |
1070 &call_multiply_stub); | 1076 &call_multiply_stub); |
1071 | 1077 |
1072 // Check if {rhs} is a Smi. | 1078 // Check if {rhs} is a Smi. |
1073 Label rhs_is_smi(assembler), rhs_is_not_smi(assembler); | 1079 Label rhs_is_smi(assembler), rhs_is_not_smi(assembler); |
1074 assembler->Branch(assembler->WordIsSmi(rhs), &rhs_is_smi, &rhs_is_not_smi); | 1080 assembler->Branch(assembler->TaggedIsSmi(rhs), &rhs_is_smi, |
| 1081 &rhs_is_not_smi); |
1075 | 1082 |
1076 assembler->Bind(&rhs_is_smi); | 1083 assembler->Bind(&rhs_is_smi); |
1077 { | 1084 { |
1078 // Convert {rhs} to a double and multiply it with the value of {lhs}. | 1085 // Convert {rhs} to a double and multiply it with the value of {lhs}. |
1079 var_lhs_float64.Bind(assembler->LoadHeapNumberValue(lhs)); | 1086 var_lhs_float64.Bind(assembler->LoadHeapNumberValue(lhs)); |
1080 var_rhs_float64.Bind(assembler->SmiToFloat64(rhs)); | 1087 var_rhs_float64.Bind(assembler->SmiToFloat64(rhs)); |
1081 assembler->Goto(&do_fmul); | 1088 assembler->Goto(&do_fmul); |
1082 } | 1089 } |
1083 | 1090 |
1084 assembler->Bind(&rhs_is_not_smi); | 1091 assembler->Bind(&rhs_is_not_smi); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1136 // Shared entry point for floating point division. | 1143 // Shared entry point for floating point division. |
1137 Label do_fdiv(assembler), end(assembler), call_divide_stub(assembler); | 1144 Label do_fdiv(assembler), end(assembler), call_divide_stub(assembler); |
1138 Variable var_dividend_float64(assembler, MachineRepresentation::kFloat64), | 1145 Variable var_dividend_float64(assembler, MachineRepresentation::kFloat64), |
1139 var_divisor_float64(assembler, MachineRepresentation::kFloat64), | 1146 var_divisor_float64(assembler, MachineRepresentation::kFloat64), |
1140 var_result(assembler, MachineRepresentation::kTagged), | 1147 var_result(assembler, MachineRepresentation::kTagged), |
1141 var_type_feedback(assembler, MachineRepresentation::kWord32); | 1148 var_type_feedback(assembler, MachineRepresentation::kWord32); |
1142 | 1149 |
1143 Node* number_map = assembler->HeapNumberMapConstant(); | 1150 Node* number_map = assembler->HeapNumberMapConstant(); |
1144 | 1151 |
1145 Label dividend_is_smi(assembler), dividend_is_not_smi(assembler); | 1152 Label dividend_is_smi(assembler), dividend_is_not_smi(assembler); |
1146 assembler->Branch(assembler->WordIsSmi(dividend), ÷nd_is_smi, | 1153 assembler->Branch(assembler->TaggedIsSmi(dividend), ÷nd_is_smi, |
1147 ÷nd_is_not_smi); | 1154 ÷nd_is_not_smi); |
1148 | 1155 |
1149 assembler->Bind(÷nd_is_smi); | 1156 assembler->Bind(÷nd_is_smi); |
1150 { | 1157 { |
1151 Label divisor_is_smi(assembler), divisor_is_not_smi(assembler); | 1158 Label divisor_is_smi(assembler), divisor_is_not_smi(assembler); |
1152 assembler->Branch(assembler->WordIsSmi(divisor), &divisor_is_smi, | 1159 assembler->Branch(assembler->TaggedIsSmi(divisor), &divisor_is_smi, |
1153 &divisor_is_not_smi); | 1160 &divisor_is_not_smi); |
1154 | 1161 |
1155 assembler->Bind(&divisor_is_smi); | 1162 assembler->Bind(&divisor_is_smi); |
1156 { | 1163 { |
1157 Label bailout(assembler); | 1164 Label bailout(assembler); |
1158 | 1165 |
1159 // Do floating point division if {divisor} is zero. | 1166 // Do floating point division if {divisor} is zero. |
1160 assembler->GotoIf( | 1167 assembler->GotoIf( |
1161 assembler->WordEqual(divisor, assembler->IntPtrConstant(0)), | 1168 assembler->WordEqual(divisor, assembler->IntPtrConstant(0)), |
1162 &bailout); | 1169 &bailout); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1239 assembler->Bind(÷nd_is_not_smi); | 1246 assembler->Bind(÷nd_is_not_smi); |
1240 { | 1247 { |
1241 Node* dividend_map = assembler->LoadMap(dividend); | 1248 Node* dividend_map = assembler->LoadMap(dividend); |
1242 | 1249 |
1243 // Check if {dividend} is a HeapNumber. | 1250 // Check if {dividend} is a HeapNumber. |
1244 assembler->GotoUnless(assembler->WordEqual(dividend_map, number_map), | 1251 assembler->GotoUnless(assembler->WordEqual(dividend_map, number_map), |
1245 &call_divide_stub); | 1252 &call_divide_stub); |
1246 | 1253 |
1247 // Check if {divisor} is a Smi. | 1254 // Check if {divisor} is a Smi. |
1248 Label divisor_is_smi(assembler), divisor_is_not_smi(assembler); | 1255 Label divisor_is_smi(assembler), divisor_is_not_smi(assembler); |
1249 assembler->Branch(assembler->WordIsSmi(divisor), &divisor_is_smi, | 1256 assembler->Branch(assembler->TaggedIsSmi(divisor), &divisor_is_smi, |
1250 &divisor_is_not_smi); | 1257 &divisor_is_not_smi); |
1251 | 1258 |
1252 assembler->Bind(&divisor_is_smi); | 1259 assembler->Bind(&divisor_is_smi); |
1253 { | 1260 { |
1254 // Convert {divisor} to a double and use it for a floating point | 1261 // Convert {divisor} to a double and use it for a floating point |
1255 // division. | 1262 // division. |
1256 var_dividend_float64.Bind(assembler->LoadHeapNumberValue(dividend)); | 1263 var_dividend_float64.Bind(assembler->LoadHeapNumberValue(dividend)); |
1257 var_divisor_float64.Bind(assembler->SmiToFloat64(divisor)); | 1264 var_divisor_float64.Bind(assembler->SmiToFloat64(divisor)); |
1258 assembler->Goto(&do_fdiv); | 1265 assembler->Goto(&do_fdiv); |
1259 } | 1266 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1312 // Shared entry point for floating point division. | 1319 // Shared entry point for floating point division. |
1313 Label do_fmod(assembler), end(assembler), call_modulus_stub(assembler); | 1320 Label do_fmod(assembler), end(assembler), call_modulus_stub(assembler); |
1314 Variable var_dividend_float64(assembler, MachineRepresentation::kFloat64), | 1321 Variable var_dividend_float64(assembler, MachineRepresentation::kFloat64), |
1315 var_divisor_float64(assembler, MachineRepresentation::kFloat64), | 1322 var_divisor_float64(assembler, MachineRepresentation::kFloat64), |
1316 var_result(assembler, MachineRepresentation::kTagged), | 1323 var_result(assembler, MachineRepresentation::kTagged), |
1317 var_type_feedback(assembler, MachineRepresentation::kWord32); | 1324 var_type_feedback(assembler, MachineRepresentation::kWord32); |
1318 | 1325 |
1319 Node* number_map = assembler->HeapNumberMapConstant(); | 1326 Node* number_map = assembler->HeapNumberMapConstant(); |
1320 | 1327 |
1321 Label dividend_is_smi(assembler), dividend_is_not_smi(assembler); | 1328 Label dividend_is_smi(assembler), dividend_is_not_smi(assembler); |
1322 assembler->Branch(assembler->WordIsSmi(dividend), ÷nd_is_smi, | 1329 assembler->Branch(assembler->TaggedIsSmi(dividend), ÷nd_is_smi, |
1323 ÷nd_is_not_smi); | 1330 ÷nd_is_not_smi); |
1324 | 1331 |
1325 assembler->Bind(÷nd_is_smi); | 1332 assembler->Bind(÷nd_is_smi); |
1326 { | 1333 { |
1327 Label divisor_is_smi(assembler), divisor_is_not_smi(assembler); | 1334 Label divisor_is_smi(assembler), divisor_is_not_smi(assembler); |
1328 assembler->Branch(assembler->WordIsSmi(divisor), &divisor_is_smi, | 1335 assembler->Branch(assembler->TaggedIsSmi(divisor), &divisor_is_smi, |
1329 &divisor_is_not_smi); | 1336 &divisor_is_not_smi); |
1330 | 1337 |
1331 assembler->Bind(&divisor_is_smi); | 1338 assembler->Bind(&divisor_is_smi); |
1332 { | 1339 { |
1333 var_result.Bind(assembler->SmiMod(dividend, divisor)); | 1340 var_result.Bind(assembler->SmiMod(dividend, divisor)); |
1334 var_type_feedback.Bind(assembler->Select( | 1341 var_type_feedback.Bind(assembler->Select( |
1335 assembler->WordIsSmi(var_result.value()), | 1342 assembler->TaggedIsSmi(var_result.value()), |
1336 assembler->Int32Constant(BinaryOperationFeedback::kSignedSmall), | 1343 assembler->Int32Constant(BinaryOperationFeedback::kSignedSmall), |
1337 assembler->Int32Constant(BinaryOperationFeedback::kNumber))); | 1344 assembler->Int32Constant(BinaryOperationFeedback::kNumber))); |
1338 assembler->Goto(&end); | 1345 assembler->Goto(&end); |
1339 } | 1346 } |
1340 | 1347 |
1341 assembler->Bind(&divisor_is_not_smi); | 1348 assembler->Bind(&divisor_is_not_smi); |
1342 { | 1349 { |
1343 Node* divisor_map = assembler->LoadMap(divisor); | 1350 Node* divisor_map = assembler->LoadMap(divisor); |
1344 | 1351 |
1345 // Check if {divisor} is a HeapNumber. | 1352 // Check if {divisor} is a HeapNumber. |
(...skipping 11 matching lines...) Expand all Loading... |
1357 assembler->Bind(÷nd_is_not_smi); | 1364 assembler->Bind(÷nd_is_not_smi); |
1358 { | 1365 { |
1359 Node* dividend_map = assembler->LoadMap(dividend); | 1366 Node* dividend_map = assembler->LoadMap(dividend); |
1360 | 1367 |
1361 // Check if {dividend} is a HeapNumber. | 1368 // Check if {dividend} is a HeapNumber. |
1362 assembler->GotoUnless(assembler->WordEqual(dividend_map, number_map), | 1369 assembler->GotoUnless(assembler->WordEqual(dividend_map, number_map), |
1363 &call_modulus_stub); | 1370 &call_modulus_stub); |
1364 | 1371 |
1365 // Check if {divisor} is a Smi. | 1372 // Check if {divisor} is a Smi. |
1366 Label divisor_is_smi(assembler), divisor_is_not_smi(assembler); | 1373 Label divisor_is_smi(assembler), divisor_is_not_smi(assembler); |
1367 assembler->Branch(assembler->WordIsSmi(divisor), &divisor_is_smi, | 1374 assembler->Branch(assembler->TaggedIsSmi(divisor), &divisor_is_smi, |
1368 &divisor_is_not_smi); | 1375 &divisor_is_not_smi); |
1369 | 1376 |
1370 assembler->Bind(&divisor_is_smi); | 1377 assembler->Bind(&divisor_is_smi); |
1371 { | 1378 { |
1372 // Convert {divisor} to a double and use it for a floating point | 1379 // Convert {divisor} to a double and use it for a floating point |
1373 // division. | 1380 // division. |
1374 var_dividend_float64.Bind(assembler->LoadHeapNumberValue(dividend)); | 1381 var_dividend_float64.Bind(assembler->LoadHeapNumberValue(dividend)); |
1375 var_divisor_float64.Bind(assembler->SmiToFloat64(divisor)); | 1382 var_divisor_float64.Bind(assembler->SmiToFloat64(divisor)); |
1376 assembler->Goto(&do_fmod); | 1383 assembler->Goto(&do_fmod); |
1377 } | 1384 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1439 Label start(assembler, 2, loop_vars); | 1446 Label start(assembler, 2, loop_vars); |
1440 value_var.Bind(value); | 1447 value_var.Bind(value); |
1441 var_type_feedback.Bind( | 1448 var_type_feedback.Bind( |
1442 assembler->Int32Constant(BinaryOperationFeedback::kNone)); | 1449 assembler->Int32Constant(BinaryOperationFeedback::kNone)); |
1443 assembler->Goto(&start); | 1450 assembler->Goto(&start); |
1444 assembler->Bind(&start); | 1451 assembler->Bind(&start); |
1445 { | 1452 { |
1446 value = value_var.value(); | 1453 value = value_var.value(); |
1447 | 1454 |
1448 Label if_issmi(assembler), if_isnotsmi(assembler); | 1455 Label if_issmi(assembler), if_isnotsmi(assembler); |
1449 assembler->Branch(assembler->WordIsSmi(value), &if_issmi, &if_isnotsmi); | 1456 assembler->Branch(assembler->TaggedIsSmi(value), &if_issmi, &if_isnotsmi); |
1450 | 1457 |
1451 assembler->Bind(&if_issmi); | 1458 assembler->Bind(&if_issmi); |
1452 { | 1459 { |
1453 // Try fast Smi addition first. | 1460 // Try fast Smi addition first. |
1454 Node* one = assembler->SmiConstant(Smi::FromInt(1)); | 1461 Node* one = assembler->SmiConstant(Smi::FromInt(1)); |
1455 Node* pair = assembler->SmiAddWithOverflow(value, one); | 1462 Node* pair = assembler->SmiAddWithOverflow(value, one); |
1456 Node* overflow = assembler->Projection(1, pair); | 1463 Node* overflow = assembler->Projection(1, pair); |
1457 | 1464 |
1458 // Check if the Smi addition overflowed. | 1465 // Check if the Smi addition overflowed. |
1459 Label if_overflow(assembler), if_notoverflow(assembler); | 1466 Label if_overflow(assembler), if_notoverflow(assembler); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1549 Label start(assembler, 2, loop_vars); | 1556 Label start(assembler, 2, loop_vars); |
1550 var_type_feedback.Bind( | 1557 var_type_feedback.Bind( |
1551 assembler->Int32Constant(BinaryOperationFeedback::kNone)); | 1558 assembler->Int32Constant(BinaryOperationFeedback::kNone)); |
1552 value_var.Bind(value); | 1559 value_var.Bind(value); |
1553 assembler->Goto(&start); | 1560 assembler->Goto(&start); |
1554 assembler->Bind(&start); | 1561 assembler->Bind(&start); |
1555 { | 1562 { |
1556 value = value_var.value(); | 1563 value = value_var.value(); |
1557 | 1564 |
1558 Label if_issmi(assembler), if_isnotsmi(assembler); | 1565 Label if_issmi(assembler), if_isnotsmi(assembler); |
1559 assembler->Branch(assembler->WordIsSmi(value), &if_issmi, &if_isnotsmi); | 1566 assembler->Branch(assembler->TaggedIsSmi(value), &if_issmi, &if_isnotsmi); |
1560 | 1567 |
1561 assembler->Bind(&if_issmi); | 1568 assembler->Bind(&if_issmi); |
1562 { | 1569 { |
1563 // Try fast Smi subtraction first. | 1570 // Try fast Smi subtraction first. |
1564 Node* one = assembler->SmiConstant(Smi::FromInt(1)); | 1571 Node* one = assembler->SmiConstant(Smi::FromInt(1)); |
1565 Node* pair = assembler->SmiSubWithOverflow(value, one); | 1572 Node* pair = assembler->SmiSubWithOverflow(value, one); |
1566 Node* overflow = assembler->Projection(1, pair); | 1573 Node* overflow = assembler->Projection(1, pair); |
1567 | 1574 |
1568 // Check if the Smi subtraction overflowed. | 1575 // Check if the Smi subtraction overflowed. |
1569 Label if_overflow(assembler), if_notoverflow(assembler); | 1576 Label if_overflow(assembler), if_notoverflow(assembler); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1721 Node* map_cell = assembler->HeapConstant(isolate()->factory()->NewWeakCell( | 1728 Node* map_cell = assembler->HeapConstant(isolate()->factory()->NewWeakCell( |
1722 StoreGlobalStub::global_map_placeholder(isolate()))); | 1729 StoreGlobalStub::global_map_placeholder(isolate()))); |
1723 Node* expected_map = assembler->LoadWeakCellValue(map_cell); | 1730 Node* expected_map = assembler->LoadWeakCellValue(map_cell); |
1724 Node* map = assembler->LoadMap(global); | 1731 Node* map = assembler->LoadMap(global); |
1725 assembler->GotoIf(assembler->WordNotEqual(expected_map, map), &miss); | 1732 assembler->GotoIf(assembler->WordNotEqual(expected_map, map), &miss); |
1726 } | 1733 } |
1727 | 1734 |
1728 Node* weak_cell = assembler->HeapConstant(isolate()->factory()->NewWeakCell( | 1735 Node* weak_cell = assembler->HeapConstant(isolate()->factory()->NewWeakCell( |
1729 StoreGlobalStub::property_cell_placeholder(isolate()))); | 1736 StoreGlobalStub::property_cell_placeholder(isolate()))); |
1730 Node* cell = assembler->LoadWeakCellValue(weak_cell); | 1737 Node* cell = assembler->LoadWeakCellValue(weak_cell); |
1731 assembler->GotoIf(assembler->WordIsSmi(cell), &miss); | 1738 assembler->GotoIf(assembler->TaggedIsSmi(cell), &miss); |
1732 | 1739 |
1733 // Load the payload of the global parameter cell. A hole indicates that the | 1740 // Load the payload of the global parameter cell. A hole indicates that the |
1734 // cell has been invalidated and that the store must be handled by the | 1741 // cell has been invalidated and that the store must be handled by the |
1735 // runtime. | 1742 // runtime. |
1736 Node* cell_contents = | 1743 Node* cell_contents = |
1737 assembler->LoadObjectField(cell, PropertyCell::kValueOffset); | 1744 assembler->LoadObjectField(cell, PropertyCell::kValueOffset); |
1738 | 1745 |
1739 PropertyCellType cell_type = this->cell_type(); | 1746 PropertyCellType cell_type = this->cell_type(); |
1740 if (cell_type == PropertyCellType::kConstant || | 1747 if (cell_type == PropertyCellType::kConstant || |
1741 cell_type == PropertyCellType::kUndefined) { | 1748 cell_type == PropertyCellType::kUndefined) { |
1742 // This is always valid for all states a cell can be in. | 1749 // This is always valid for all states a cell can be in. |
1743 assembler->GotoIf(assembler->WordNotEqual(cell_contents, value), &miss); | 1750 assembler->GotoIf(assembler->WordNotEqual(cell_contents, value), &miss); |
1744 } else { | 1751 } else { |
1745 assembler->GotoIf(assembler->IsTheHole(cell_contents), &miss); | 1752 assembler->GotoIf(assembler->IsTheHole(cell_contents), &miss); |
1746 | 1753 |
1747 // When dealing with constant types, the type may be allowed to change, as | 1754 // When dealing with constant types, the type may be allowed to change, as |
1748 // long as optimized code remains valid. | 1755 // long as optimized code remains valid. |
1749 bool value_is_smi = false; | 1756 bool value_is_smi = false; |
1750 if (cell_type == PropertyCellType::kConstantType) { | 1757 if (cell_type == PropertyCellType::kConstantType) { |
1751 switch (constant_type()) { | 1758 switch (constant_type()) { |
1752 case PropertyCellConstantType::kSmi: | 1759 case PropertyCellConstantType::kSmi: |
1753 assembler->GotoUnless(assembler->WordIsSmi(value), &miss); | 1760 assembler->GotoUnless(assembler->TaggedIsSmi(value), &miss); |
1754 value_is_smi = true; | 1761 value_is_smi = true; |
1755 break; | 1762 break; |
1756 case PropertyCellConstantType::kStableMap: { | 1763 case PropertyCellConstantType::kStableMap: { |
1757 // It is sufficient here to check that the value and cell contents | 1764 // It is sufficient here to check that the value and cell contents |
1758 // have identical maps, no matter if they are stable or not or if they | 1765 // have identical maps, no matter if they are stable or not or if they |
1759 // are the maps that were originally in the cell or not. If optimized | 1766 // are the maps that were originally in the cell or not. If optimized |
1760 // code will deopt when a cell has a unstable map and if it has a | 1767 // code will deopt when a cell has a unstable map and if it has a |
1761 // dependency on a stable map, it will deopt if the map destabilizes. | 1768 // dependency on a stable map, it will deopt if the map destabilizes. |
1762 assembler->GotoIf(assembler->WordIsSmi(value), &miss); | 1769 assembler->GotoIf(assembler->TaggedIsSmi(value), &miss); |
1763 assembler->GotoIf(assembler->WordIsSmi(cell_contents), &miss); | 1770 assembler->GotoIf(assembler->TaggedIsSmi(cell_contents), &miss); |
1764 Node* expected_map = assembler->LoadMap(cell_contents); | 1771 Node* expected_map = assembler->LoadMap(cell_contents); |
1765 Node* map = assembler->LoadMap(value); | 1772 Node* map = assembler->LoadMap(value); |
1766 assembler->GotoIf(assembler->WordNotEqual(expected_map, map), &miss); | 1773 assembler->GotoIf(assembler->WordNotEqual(expected_map, map), &miss); |
1767 break; | 1774 break; |
1768 } | 1775 } |
1769 } | 1776 } |
1770 } | 1777 } |
1771 if (value_is_smi) { | 1778 if (value_is_smi) { |
1772 assembler->StoreObjectFieldNoWriteBarrier( | 1779 assembler->StoreObjectFieldNoWriteBarrier( |
1773 cell, PropertyCell::kValueOffset, value); | 1780 cell, PropertyCell::kValueOffset, value); |
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2896 AllocationSiteMode mode) { | 2903 AllocationSiteMode mode) { |
2897 typedef compiler::Node Node; | 2904 typedef compiler::Node Node; |
2898 typedef CodeStubAssembler::Label Label; | 2905 typedef CodeStubAssembler::Label Label; |
2899 | 2906 |
2900 Label ok(assembler); | 2907 Label ok(assembler); |
2901 Label smi_size(assembler); | 2908 Label smi_size(assembler); |
2902 Label small_smi_size(assembler); | 2909 Label small_smi_size(assembler); |
2903 Label call_runtime(assembler, Label::kDeferred); | 2910 Label call_runtime(assembler, Label::kDeferred); |
2904 | 2911 |
2905 Node* size = assembler->Parameter(Descriptor::kArraySizeSmiParameter); | 2912 Node* size = assembler->Parameter(Descriptor::kArraySizeSmiParameter); |
2906 assembler->Branch(assembler->WordIsSmi(size), &smi_size, &call_runtime); | 2913 assembler->Branch(assembler->TaggedIsSmi(size), &smi_size, &call_runtime); |
2907 | 2914 |
2908 assembler->Bind(&smi_size); | 2915 assembler->Bind(&smi_size); |
2909 | 2916 |
2910 if (IsFastPackedElementsKind(elements_kind)) { | 2917 if (IsFastPackedElementsKind(elements_kind)) { |
2911 Label abort(assembler, Label::kDeferred); | 2918 Label abort(assembler, Label::kDeferred); |
2912 assembler->Branch( | 2919 assembler->Branch( |
2913 assembler->SmiEqual(size, assembler->SmiConstant(Smi::kZero)), | 2920 assembler->SmiEqual(size, assembler->SmiConstant(Smi::kZero)), |
2914 &small_smi_size, &abort); | 2921 &small_smi_size, &abort); |
2915 | 2922 |
2916 assembler->Bind(&abort); | 2923 assembler->Bind(&abort); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3026 | 3033 |
3027 if (type == MachineType::Pointer()) { | 3034 if (type == MachineType::Pointer()) { |
3028 return Representation::External(); | 3035 return Representation::External(); |
3029 } | 3036 } |
3030 | 3037 |
3031 return Representation::Tagged(); | 3038 return Representation::Tagged(); |
3032 } | 3039 } |
3033 | 3040 |
3034 } // namespace internal | 3041 } // namespace internal |
3035 } // namespace v8 | 3042 } // namespace v8 |
OLD | NEW |