| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/compiler/effect-control-linearizer.h" | 5 #include "src/compiler/effect-control-linearizer.h" |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/compiler/access-builder.h" | 8 #include "src/compiler/access-builder.h" |
| 9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
| 10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 // the effect uses to the effect input. | 333 // the effect uses to the effect input. |
| 334 return RemoveRegionNode(node); | 334 return RemoveRegionNode(node); |
| 335 } | 335 } |
| 336 | 336 |
| 337 // Special treatment for checkpoint nodes. | 337 // Special treatment for checkpoint nodes. |
| 338 if (node->opcode() == IrOpcode::kCheckpoint) { | 338 if (node->opcode() == IrOpcode::kCheckpoint) { |
| 339 // Unlink the check point; effect uses will be updated to the incoming | 339 // Unlink the check point; effect uses will be updated to the incoming |
| 340 // effect that is passed. The frame state is preserved for lowering. | 340 // effect that is passed. The frame state is preserved for lowering. |
| 341 DCHECK_EQ(RegionObservability::kObservable, region_observability_); | 341 DCHECK_EQ(RegionObservability::kObservable, region_observability_); |
| 342 *frame_state = NodeProperties::GetFrameStateInput(node, 0); | 342 *frame_state = NodeProperties::GetFrameStateInput(node, 0); |
| 343 node->TrimInputCount(0); | |
| 344 return; | 343 return; |
| 345 } | 344 } |
| 346 | 345 |
| 347 if (node->opcode() == IrOpcode::kIfSuccess) { | 346 if (node->opcode() == IrOpcode::kIfSuccess) { |
| 348 // We always schedule IfSuccess with its call, so skip it here. | 347 // We always schedule IfSuccess with its call, so skip it here. |
| 349 DCHECK_EQ(IrOpcode::kCall, node->InputAt(0)->opcode()); | 348 DCHECK_EQ(IrOpcode::kCall, node->InputAt(0)->opcode()); |
| 350 // The IfSuccess node should not belong to an exceptional call node | 349 // The IfSuccess node should not belong to an exceptional call node |
| 351 // because such IfSuccess nodes should only start a basic block (and | 350 // because such IfSuccess nodes should only start a basic block (and |
| 352 // basic block start nodes are not handled in the ProcessNode method). | 351 // basic block start nodes are not handled in the ProcessNode method). |
| 353 DCHECK(!NodeProperties::IsExceptionalCall(node->InputAt(0))); | 352 DCHECK(!NodeProperties::IsExceptionalCall(node->InputAt(0))); |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 EffectControlLinearizer::ValueEffectControl | 797 EffectControlLinearizer::ValueEffectControl |
| 799 EffectControlLinearizer::LowerCheckBounds(Node* node, Node* frame_state, | 798 EffectControlLinearizer::LowerCheckBounds(Node* node, Node* frame_state, |
| 800 Node* effect, Node* control) { | 799 Node* effect, Node* control) { |
| 801 Node* index = node->InputAt(0); | 800 Node* index = node->InputAt(0); |
| 802 Node* limit = node->InputAt(1); | 801 Node* limit = node->InputAt(1); |
| 803 | 802 |
| 804 Node* check = graph()->NewNode(machine()->Uint32LessThan(), index, limit); | 803 Node* check = graph()->NewNode(machine()->Uint32LessThan(), index, limit); |
| 805 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check, | 804 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check, |
| 806 frame_state, effect, control); | 805 frame_state, effect, control); |
| 807 | 806 |
| 808 // Make sure the lowered node does not appear in any use lists. | |
| 809 node->TrimInputCount(0); | |
| 810 | |
| 811 return ValueEffectControl(index, effect, control); | 807 return ValueEffectControl(index, effect, control); |
| 812 } | 808 } |
| 813 | 809 |
| 814 EffectControlLinearizer::ValueEffectControl | 810 EffectControlLinearizer::ValueEffectControl |
| 815 EffectControlLinearizer::LowerCheckNumber(Node* node, Node* frame_state, | 811 EffectControlLinearizer::LowerCheckNumber(Node* node, Node* frame_state, |
| 816 Node* effect, Node* control) { | 812 Node* effect, Node* control) { |
| 817 Node* value = node->InputAt(0); | 813 Node* value = node->InputAt(0); |
| 818 | 814 |
| 819 Node* check0 = ObjectIsSmi(value); | 815 Node* check0 = ObjectIsSmi(value); |
| 820 Node* branch0 = | 816 Node* branch0 = |
| (...skipping 10 matching lines...) Expand all Loading... |
| 831 value, efalse0, if_false0); | 827 value, efalse0, if_false0); |
| 832 Node* check1 = graph()->NewNode(machine()->WordEqual(), value_map, | 828 Node* check1 = graph()->NewNode(machine()->WordEqual(), value_map, |
| 833 jsgraph()->HeapNumberMapConstant()); | 829 jsgraph()->HeapNumberMapConstant()); |
| 834 if_false0 = efalse0 = graph()->NewNode(common()->DeoptimizeUnless(), check1, | 830 if_false0 = efalse0 = graph()->NewNode(common()->DeoptimizeUnless(), check1, |
| 835 frame_state, efalse0, if_false0); | 831 frame_state, efalse0, if_false0); |
| 836 } | 832 } |
| 837 | 833 |
| 838 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0); | 834 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0); |
| 839 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control); | 835 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control); |
| 840 | 836 |
| 841 // Make sure the lowered node does not appear in any use lists. | |
| 842 node->TrimInputCount(0); | |
| 843 | |
| 844 return ValueEffectControl(value, effect, control); | 837 return ValueEffectControl(value, effect, control); |
| 845 } | 838 } |
| 846 | 839 |
| 847 EffectControlLinearizer::ValueEffectControl | 840 EffectControlLinearizer::ValueEffectControl |
| 848 EffectControlLinearizer::LowerCheckIf(Node* node, Node* frame_state, | 841 EffectControlLinearizer::LowerCheckIf(Node* node, Node* frame_state, |
| 849 Node* effect, Node* control) { | 842 Node* effect, Node* control) { |
| 850 Node* value = node->InputAt(0); | 843 Node* value = node->InputAt(0); |
| 851 | 844 |
| 852 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), value, | 845 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), value, |
| 853 frame_state, effect, control); | 846 frame_state, effect, control); |
| 854 | 847 |
| 855 // Make sure the lowered node does not appear in any use lists. | |
| 856 node->TrimInputCount(0); | |
| 857 | |
| 858 return ValueEffectControl(value, effect, control); | 848 return ValueEffectControl(value, effect, control); |
| 859 } | 849 } |
| 860 | 850 |
| 861 EffectControlLinearizer::ValueEffectControl | 851 EffectControlLinearizer::ValueEffectControl |
| 862 EffectControlLinearizer::LowerCheckTaggedPointer(Node* node, Node* frame_state, | 852 EffectControlLinearizer::LowerCheckTaggedPointer(Node* node, Node* frame_state, |
| 863 Node* effect, Node* control) { | 853 Node* effect, Node* control) { |
| 864 Node* value = node->InputAt(0); | 854 Node* value = node->InputAt(0); |
| 865 | 855 |
| 866 Node* check = ObjectIsSmi(value); | 856 Node* check = ObjectIsSmi(value); |
| 867 control = effect = graph()->NewNode(common()->DeoptimizeIf(), check, | 857 control = effect = graph()->NewNode(common()->DeoptimizeIf(), check, |
| 868 frame_state, effect, control); | 858 frame_state, effect, control); |
| 869 | 859 |
| 870 // Make sure the lowered node does not appear in any use lists. | |
| 871 node->TrimInputCount(0); | |
| 872 | |
| 873 return ValueEffectControl(value, effect, control); | 860 return ValueEffectControl(value, effect, control); |
| 874 } | 861 } |
| 875 | 862 |
| 876 EffectControlLinearizer::ValueEffectControl | 863 EffectControlLinearizer::ValueEffectControl |
| 877 EffectControlLinearizer::LowerCheckTaggedSigned(Node* node, Node* frame_state, | 864 EffectControlLinearizer::LowerCheckTaggedSigned(Node* node, Node* frame_state, |
| 878 Node* effect, Node* control) { | 865 Node* effect, Node* control) { |
| 879 Node* value = node->InputAt(0); | 866 Node* value = node->InputAt(0); |
| 880 | 867 |
| 881 Node* check = ObjectIsSmi(value); | 868 Node* check = ObjectIsSmi(value); |
| 882 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check, | 869 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check, |
| 883 frame_state, effect, control); | 870 frame_state, effect, control); |
| 884 | 871 |
| 885 // Make sure the lowered node does not appear in any use lists. | |
| 886 node->TrimInputCount(0); | |
| 887 | |
| 888 return ValueEffectControl(value, effect, control); | 872 return ValueEffectControl(value, effect, control); |
| 889 } | 873 } |
| 890 | 874 |
| 891 EffectControlLinearizer::ValueEffectControl | 875 EffectControlLinearizer::ValueEffectControl |
| 892 EffectControlLinearizer::LowerCheckedInt32Add(Node* node, Node* frame_state, | 876 EffectControlLinearizer::LowerCheckedInt32Add(Node* node, Node* frame_state, |
| 893 Node* effect, Node* control) { | 877 Node* effect, Node* control) { |
| 894 Node* lhs = node->InputAt(0); | 878 Node* lhs = node->InputAt(0); |
| 895 Node* rhs = node->InputAt(1); | 879 Node* rhs = node->InputAt(1); |
| 896 | 880 |
| 897 Node* value = | 881 Node* value = |
| 898 graph()->NewNode(machine()->Int32AddWithOverflow(), lhs, rhs, control); | 882 graph()->NewNode(machine()->Int32AddWithOverflow(), lhs, rhs, control); |
| 899 | 883 |
| 900 Node* check = graph()->NewNode(common()->Projection(1), value, control); | 884 Node* check = graph()->NewNode(common()->Projection(1), value, control); |
| 901 control = effect = graph()->NewNode(common()->DeoptimizeIf(), check, | 885 control = effect = graph()->NewNode(common()->DeoptimizeIf(), check, |
| 902 frame_state, effect, control); | 886 frame_state, effect, control); |
| 903 | 887 |
| 904 value = graph()->NewNode(common()->Projection(0), value, control); | 888 value = graph()->NewNode(common()->Projection(0), value, control); |
| 905 | 889 |
| 906 // Make sure the lowered node does not appear in any use lists. | |
| 907 node->TrimInputCount(0); | |
| 908 | |
| 909 return ValueEffectControl(value, effect, control); | 890 return ValueEffectControl(value, effect, control); |
| 910 } | 891 } |
| 911 | 892 |
| 912 EffectControlLinearizer::ValueEffectControl | 893 EffectControlLinearizer::ValueEffectControl |
| 913 EffectControlLinearizer::LowerCheckedInt32Sub(Node* node, Node* frame_state, | 894 EffectControlLinearizer::LowerCheckedInt32Sub(Node* node, Node* frame_state, |
| 914 Node* effect, Node* control) { | 895 Node* effect, Node* control) { |
| 915 Node* lhs = node->InputAt(0); | 896 Node* lhs = node->InputAt(0); |
| 916 Node* rhs = node->InputAt(1); | 897 Node* rhs = node->InputAt(1); |
| 917 | 898 |
| 918 Node* value = | 899 Node* value = |
| 919 graph()->NewNode(machine()->Int32SubWithOverflow(), lhs, rhs, control); | 900 graph()->NewNode(machine()->Int32SubWithOverflow(), lhs, rhs, control); |
| 920 | 901 |
| 921 Node* check = graph()->NewNode(common()->Projection(1), value, control); | 902 Node* check = graph()->NewNode(common()->Projection(1), value, control); |
| 922 control = effect = graph()->NewNode(common()->DeoptimizeIf(), check, | 903 control = effect = graph()->NewNode(common()->DeoptimizeIf(), check, |
| 923 frame_state, effect, control); | 904 frame_state, effect, control); |
| 924 | 905 |
| 925 value = graph()->NewNode(common()->Projection(0), value, control); | 906 value = graph()->NewNode(common()->Projection(0), value, control); |
| 926 | 907 |
| 927 // Make sure the lowered node does not appear in any use lists. | |
| 928 node->TrimInputCount(0); | |
| 929 | |
| 930 return ValueEffectControl(value, effect, control); | 908 return ValueEffectControl(value, effect, control); |
| 931 } | 909 } |
| 932 | 910 |
| 933 EffectControlLinearizer::ValueEffectControl | 911 EffectControlLinearizer::ValueEffectControl |
| 934 EffectControlLinearizer::LowerCheckedInt32Div(Node* node, Node* frame_state, | 912 EffectControlLinearizer::LowerCheckedInt32Div(Node* node, Node* frame_state, |
| 935 Node* effect, Node* control) { | 913 Node* effect, Node* control) { |
| 936 Node* zero = jsgraph()->Int32Constant(0); | 914 Node* zero = jsgraph()->Int32Constant(0); |
| 937 Node* minusone = jsgraph()->Int32Constant(-1); | 915 Node* minusone = jsgraph()->Int32Constant(-1); |
| 938 Node* minint = jsgraph()->Int32Constant(std::numeric_limits<int32_t>::min()); | 916 Node* minint = jsgraph()->Int32Constant(std::numeric_limits<int32_t>::min()); |
| 939 | 917 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 999 graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), vtrue0, | 977 graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), vtrue0, |
| 1000 vfalse0, control); | 978 vfalse0, control); |
| 1001 | 979 |
| 1002 // Check if the remainder is non-zero. | 980 // Check if the remainder is non-zero. |
| 1003 Node* check = | 981 Node* check = |
| 1004 graph()->NewNode(machine()->Word32Equal(), lhs, | 982 graph()->NewNode(machine()->Word32Equal(), lhs, |
| 1005 graph()->NewNode(machine()->Int32Mul(), rhs, value)); | 983 graph()->NewNode(machine()->Int32Mul(), rhs, value)); |
| 1006 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check, | 984 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check, |
| 1007 frame_state, effect, control); | 985 frame_state, effect, control); |
| 1008 | 986 |
| 1009 // Make sure the lowered node does not appear in any use lists. | |
| 1010 node->TrimInputCount(0); | |
| 1011 | |
| 1012 return ValueEffectControl(value, effect, control); | 987 return ValueEffectControl(value, effect, control); |
| 1013 } | 988 } |
| 1014 | 989 |
| 1015 EffectControlLinearizer::ValueEffectControl | 990 EffectControlLinearizer::ValueEffectControl |
| 1016 EffectControlLinearizer::LowerCheckedInt32Mod(Node* node, Node* frame_state, | 991 EffectControlLinearizer::LowerCheckedInt32Mod(Node* node, Node* frame_state, |
| 1017 Node* effect, Node* control) { | 992 Node* effect, Node* control) { |
| 1018 Node* zero = jsgraph()->Int32Constant(0); | 993 Node* zero = jsgraph()->Int32Constant(0); |
| 1019 Node* minusone = jsgraph()->Int32Constant(-1); | 994 Node* minusone = jsgraph()->Int32Constant(-1); |
| 1020 Node* minint = jsgraph()->Int32Constant(std::numeric_limits<int32_t>::min()); | 995 Node* minint = jsgraph()->Int32Constant(std::numeric_limits<int32_t>::min()); |
| 1021 | 996 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 if_false0 = efalse0 = graph()->NewNode(common()->DeoptimizeIf(), check, | 1050 if_false0 = efalse0 = graph()->NewNode(common()->DeoptimizeIf(), check, |
| 1076 frame_state, efalse0, if_false0); | 1051 frame_state, efalse0, if_false0); |
| 1077 } | 1052 } |
| 1078 | 1053 |
| 1079 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0); | 1054 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0); |
| 1080 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control); | 1055 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control); |
| 1081 Node* value = | 1056 Node* value = |
| 1082 graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), vtrue0, | 1057 graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), vtrue0, |
| 1083 vfalse0, control); | 1058 vfalse0, control); |
| 1084 | 1059 |
| 1085 // Make sure the lowered node does not appear in any use lists. | |
| 1086 node->TrimInputCount(0); | |
| 1087 | |
| 1088 return ValueEffectControl(value, effect, control); | 1060 return ValueEffectControl(value, effect, control); |
| 1089 } | 1061 } |
| 1090 | 1062 |
| 1091 EffectControlLinearizer::ValueEffectControl | 1063 EffectControlLinearizer::ValueEffectControl |
| 1092 EffectControlLinearizer::LowerCheckedUint32ToInt32(Node* node, | 1064 EffectControlLinearizer::LowerCheckedUint32ToInt32(Node* node, |
| 1093 Node* frame_state, | 1065 Node* frame_state, |
| 1094 Node* effect, | 1066 Node* effect, |
| 1095 Node* control) { | 1067 Node* control) { |
| 1096 Node* value = node->InputAt(0); | 1068 Node* value = node->InputAt(0); |
| 1097 Node* max_int = jsgraph()->Int32Constant(std::numeric_limits<int32_t>::max()); | 1069 Node* max_int = jsgraph()->Int32Constant(std::numeric_limits<int32_t>::max()); |
| 1098 Node* is_safe = | 1070 Node* is_safe = |
| 1099 graph()->NewNode(machine()->Uint32LessThanOrEqual(), value, max_int); | 1071 graph()->NewNode(machine()->Uint32LessThanOrEqual(), value, max_int); |
| 1100 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), is_safe, | 1072 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), is_safe, |
| 1101 frame_state, effect, control); | 1073 frame_state, effect, control); |
| 1102 | 1074 |
| 1103 // Make sure the lowered node does not appear in any use lists. | |
| 1104 node->TrimInputCount(0); | |
| 1105 | |
| 1106 return ValueEffectControl(value, effect, control); | 1075 return ValueEffectControl(value, effect, control); |
| 1107 } | 1076 } |
| 1108 | 1077 |
| 1109 EffectControlLinearizer::ValueEffectControl | 1078 EffectControlLinearizer::ValueEffectControl |
| 1110 EffectControlLinearizer::BuildCheckedFloat64ToInt32(Node* value, | 1079 EffectControlLinearizer::BuildCheckedFloat64ToInt32(Node* value, |
| 1111 Node* frame_state, | 1080 Node* frame_state, |
| 1112 Node* effect, | 1081 Node* effect, |
| 1113 Node* control) { | 1082 Node* control) { |
| 1114 Node* value32 = graph()->NewNode(machine()->RoundFloat64ToInt32(), value); | 1083 Node* value32 = graph()->NewNode(machine()->RoundFloat64ToInt32(), value); |
| 1115 Node* check_same = graph()->NewNode( | 1084 Node* check_same = graph()->NewNode( |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1145 return ValueEffectControl(value32, effect, merge); | 1114 return ValueEffectControl(value32, effect, merge); |
| 1146 } | 1115 } |
| 1147 | 1116 |
| 1148 EffectControlLinearizer::ValueEffectControl | 1117 EffectControlLinearizer::ValueEffectControl |
| 1149 EffectControlLinearizer::LowerCheckedFloat64ToInt32(Node* node, | 1118 EffectControlLinearizer::LowerCheckedFloat64ToInt32(Node* node, |
| 1150 Node* frame_state, | 1119 Node* frame_state, |
| 1151 Node* effect, | 1120 Node* effect, |
| 1152 Node* control) { | 1121 Node* control) { |
| 1153 Node* value = node->InputAt(0); | 1122 Node* value = node->InputAt(0); |
| 1154 | 1123 |
| 1155 // Make sure the lowered node does not appear in any use lists. | |
| 1156 node->TrimInputCount(0); | |
| 1157 | |
| 1158 return BuildCheckedFloat64ToInt32(value, frame_state, effect, control); | 1124 return BuildCheckedFloat64ToInt32(value, frame_state, effect, control); |
| 1159 } | 1125 } |
| 1160 | 1126 |
| 1161 EffectControlLinearizer::ValueEffectControl | 1127 EffectControlLinearizer::ValueEffectControl |
| 1162 EffectControlLinearizer::LowerCheckedTaggedToInt32(Node* node, | 1128 EffectControlLinearizer::LowerCheckedTaggedToInt32(Node* node, |
| 1163 Node* frame_state, | 1129 Node* frame_state, |
| 1164 Node* effect, | 1130 Node* effect, |
| 1165 Node* control) { | 1131 Node* control) { |
| 1166 Node* value = node->InputAt(0); | 1132 Node* value = node->InputAt(0); |
| 1167 | 1133 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1195 if_false = state.control; | 1161 if_false = state.control; |
| 1196 efalse = state.effect; | 1162 efalse = state.effect; |
| 1197 vfalse = state.value; | 1163 vfalse = state.value; |
| 1198 } | 1164 } |
| 1199 | 1165 |
| 1200 control = graph()->NewNode(common()->Merge(2), if_true, if_false); | 1166 control = graph()->NewNode(common()->Merge(2), if_true, if_false); |
| 1201 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control); | 1167 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control); |
| 1202 value = graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), | 1168 value = graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), |
| 1203 vtrue, vfalse, control); | 1169 vtrue, vfalse, control); |
| 1204 | 1170 |
| 1205 // Make sure the lowered node does not appear in any use lists. | |
| 1206 node->TrimInputCount(0); | |
| 1207 | |
| 1208 return ValueEffectControl(value, effect, control); | 1171 return ValueEffectControl(value, effect, control); |
| 1209 } | 1172 } |
| 1210 | 1173 |
| 1211 EffectControlLinearizer::ValueEffectControl | 1174 EffectControlLinearizer::ValueEffectControl |
| 1212 EffectControlLinearizer::BuildCheckedHeapNumberOrOddballToFloat64( | 1175 EffectControlLinearizer::BuildCheckedHeapNumberOrOddballToFloat64( |
| 1213 Node* value, Node* frame_state, Node* effect, Node* control) { | 1176 Node* value, Node* frame_state, Node* effect, Node* control) { |
| 1214 Node* value_map = effect = graph()->NewNode( | 1177 Node* value_map = effect = graph()->NewNode( |
| 1215 simplified()->LoadField(AccessBuilder::ForMap()), value, effect, control); | 1178 simplified()->LoadField(AccessBuilder::ForMap()), value, effect, control); |
| 1216 Node* check_number = graph()->NewNode(machine()->WordEqual(), value_map, | 1179 Node* check_number = graph()->NewNode(machine()->WordEqual(), value_map, |
| 1217 jsgraph()->HeapNumberMapConstant()); | 1180 jsgraph()->HeapNumberMapConstant()); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1269 value, frame_state, effect, if_false); | 1232 value, frame_state, effect, if_false); |
| 1270 | 1233 |
| 1271 Node* merge = | 1234 Node* merge = |
| 1272 graph()->NewNode(common()->Merge(2), if_true, number_state.control); | 1235 graph()->NewNode(common()->Merge(2), if_true, number_state.control); |
| 1273 Node* effect_phi = graph()->NewNode(common()->EffectPhi(2), etrue, | 1236 Node* effect_phi = graph()->NewNode(common()->EffectPhi(2), etrue, |
| 1274 number_state.effect, merge); | 1237 number_state.effect, merge); |
| 1275 Node* result = | 1238 Node* result = |
| 1276 graph()->NewNode(common()->Phi(MachineRepresentation::kFloat64, 2), vtrue, | 1239 graph()->NewNode(common()->Phi(MachineRepresentation::kFloat64, 2), vtrue, |
| 1277 number_state.value, merge); | 1240 number_state.value, merge); |
| 1278 | 1241 |
| 1279 // Make sure the lowered node does not appear in any use lists. | |
| 1280 node->TrimInputCount(0); | |
| 1281 | |
| 1282 return ValueEffectControl(result, effect_phi, merge); | 1242 return ValueEffectControl(result, effect_phi, merge); |
| 1283 } | 1243 } |
| 1284 | 1244 |
| 1285 EffectControlLinearizer::ValueEffectControl | 1245 EffectControlLinearizer::ValueEffectControl |
| 1286 EffectControlLinearizer::LowerTruncateTaggedToWord32(Node* node, Node* effect, | 1246 EffectControlLinearizer::LowerTruncateTaggedToWord32(Node* node, Node* effect, |
| 1287 Node* control) { | 1247 Node* control) { |
| 1288 Node* value = node->InputAt(0); | 1248 Node* value = node->InputAt(0); |
| 1289 | 1249 |
| 1290 Node* check = ObjectIsSmi(value); | 1250 Node* check = ObjectIsSmi(value); |
| 1291 Node* branch = | 1251 Node* branch = |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1632 // with allow-return-hole, we cannot do anything, so just deoptimize | 1592 // with allow-return-hole, we cannot do anything, so just deoptimize |
| 1633 // in case of the hole NaN (similar to Crankshaft). | 1593 // in case of the hole NaN (similar to Crankshaft). |
| 1634 Node* value = node->InputAt(0); | 1594 Node* value = node->InputAt(0); |
| 1635 Node* check = graph()->NewNode( | 1595 Node* check = graph()->NewNode( |
| 1636 machine()->Word32Equal(), | 1596 machine()->Word32Equal(), |
| 1637 graph()->NewNode(machine()->Float64ExtractHighWord32(), value), | 1597 graph()->NewNode(machine()->Float64ExtractHighWord32(), value), |
| 1638 jsgraph()->Int32Constant(kHoleNanUpper32)); | 1598 jsgraph()->Int32Constant(kHoleNanUpper32)); |
| 1639 control = effect = graph()->NewNode(common()->DeoptimizeIf(), check, | 1599 control = effect = graph()->NewNode(common()->DeoptimizeIf(), check, |
| 1640 frame_state, effect, control); | 1600 frame_state, effect, control); |
| 1641 | 1601 |
| 1642 // Make sure the lowered node does not appear in any use lists. | |
| 1643 node->TrimInputCount(0); | |
| 1644 | |
| 1645 return ValueEffectControl(value, effect, control); | 1602 return ValueEffectControl(value, effect, control); |
| 1646 } | 1603 } |
| 1647 | 1604 |
| 1648 EffectControlLinearizer::ValueEffectControl | 1605 EffectControlLinearizer::ValueEffectControl |
| 1649 EffectControlLinearizer::LowerCheckTaggedHole(Node* node, Node* frame_state, | 1606 EffectControlLinearizer::LowerCheckTaggedHole(Node* node, Node* frame_state, |
| 1650 Node* effect, Node* control) { | 1607 Node* effect, Node* control) { |
| 1651 CheckTaggedHoleMode mode = CheckTaggedHoleModeOf(node->op()); | 1608 CheckTaggedHoleMode mode = CheckTaggedHoleModeOf(node->op()); |
| 1652 Node* value = node->InputAt(0); | 1609 Node* value = node->InputAt(0); |
| 1653 Node* check = graph()->NewNode(machine()->WordEqual(), value, | 1610 Node* check = graph()->NewNode(machine()->WordEqual(), value, |
| 1654 jsgraph()->TheHoleConstant()); | 1611 jsgraph()->TheHoleConstant()); |
| 1655 switch (mode) { | 1612 switch (mode) { |
| 1656 case CheckTaggedHoleMode::kConvertHoleToUndefined: | 1613 case CheckTaggedHoleMode::kConvertHoleToUndefined: |
| 1657 value = graph()->NewNode( | 1614 value = graph()->NewNode( |
| 1658 common()->Select(MachineRepresentation::kTagged, BranchHint::kFalse), | 1615 common()->Select(MachineRepresentation::kTagged, BranchHint::kFalse), |
| 1659 check, jsgraph()->UndefinedConstant(), value); | 1616 check, jsgraph()->UndefinedConstant(), value); |
| 1660 break; | 1617 break; |
| 1661 case CheckTaggedHoleMode::kNeverReturnHole: | 1618 case CheckTaggedHoleMode::kNeverReturnHole: |
| 1662 control = effect = graph()->NewNode(common()->DeoptimizeIf(), check, | 1619 control = effect = graph()->NewNode(common()->DeoptimizeIf(), check, |
| 1663 frame_state, effect, control); | 1620 frame_state, effect, control); |
| 1664 break; | 1621 break; |
| 1665 } | 1622 } |
| 1666 | 1623 |
| 1667 // Make sure the lowered node does not appear in any use lists. | |
| 1668 node->TrimInputCount(0); | |
| 1669 | |
| 1670 return ValueEffectControl(value, effect, control); | 1624 return ValueEffectControl(value, effect, control); |
| 1671 } | 1625 } |
| 1672 | 1626 |
| 1673 EffectControlLinearizer::ValueEffectControl | 1627 EffectControlLinearizer::ValueEffectControl |
| 1674 EffectControlLinearizer::AllocateHeapNumberWithValue(Node* value, Node* effect, | 1628 EffectControlLinearizer::AllocateHeapNumberWithValue(Node* value, Node* effect, |
| 1675 Node* control) { | 1629 Node* control) { |
| 1676 Node* result = effect = graph()->NewNode( | 1630 Node* result = effect = graph()->NewNode( |
| 1677 simplified()->Allocate(NOT_TENURED), | 1631 simplified()->Allocate(NOT_TENURED), |
| 1678 jsgraph()->Int32Constant(HeapNumber::kSize), effect, control); | 1632 jsgraph()->Int32Constant(HeapNumber::kSize), effect, control); |
| 1679 effect = graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()), | 1633 effect = graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()), |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1868 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 1822 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
| 1869 Operator::kNoThrow); | 1823 Operator::kNoThrow); |
| 1870 to_number_operator_.set(common()->Call(desc)); | 1824 to_number_operator_.set(common()->Call(desc)); |
| 1871 } | 1825 } |
| 1872 return to_number_operator_.get(); | 1826 return to_number_operator_.get(); |
| 1873 } | 1827 } |
| 1874 | 1828 |
| 1875 } // namespace compiler | 1829 } // namespace compiler |
| 1876 } // namespace internal | 1830 } // namespace internal |
| 1877 } // namespace v8 | 1831 } // namespace v8 |
| OLD | NEW |