| 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 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 return ValueEffectControl(value, effect, control); | 995 return ValueEffectControl(value, effect, control); |
| 996 } | 996 } |
| 997 | 997 |
| 998 EffectControlLinearizer::ValueEffectControl | 998 EffectControlLinearizer::ValueEffectControl |
| 999 EffectControlLinearizer::LowerCheckBounds(Node* node, Node* frame_state, | 999 EffectControlLinearizer::LowerCheckBounds(Node* node, Node* frame_state, |
| 1000 Node* effect, Node* control) { | 1000 Node* effect, Node* control) { |
| 1001 Node* index = node->InputAt(0); | 1001 Node* index = node->InputAt(0); |
| 1002 Node* limit = node->InputAt(1); | 1002 Node* limit = node->InputAt(1); |
| 1003 | 1003 |
| 1004 Node* check = graph()->NewNode(machine()->Uint32LessThan(), index, limit); | 1004 Node* check = graph()->NewNode(machine()->Uint32LessThan(), index, limit); |
| 1005 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check, | 1005 control = effect = graph()->NewNode( |
| 1006 frame_state, effect, control); | 1006 common()->DeoptimizeUnless(DeoptimizeReason::kOutOfBounds), check, |
| 1007 frame_state, effect, control); |
| 1007 | 1008 |
| 1008 return ValueEffectControl(index, effect, control); | 1009 return ValueEffectControl(index, effect, control); |
| 1009 } | 1010 } |
| 1010 | 1011 |
| 1011 EffectControlLinearizer::ValueEffectControl | 1012 EffectControlLinearizer::ValueEffectControl |
| 1012 EffectControlLinearizer::LowerCheckNumber(Node* node, Node* frame_state, | 1013 EffectControlLinearizer::LowerCheckNumber(Node* node, Node* frame_state, |
| 1013 Node* effect, Node* control) { | 1014 Node* effect, Node* control) { |
| 1014 Node* value = node->InputAt(0); | 1015 Node* value = node->InputAt(0); |
| 1015 | 1016 |
| 1016 Node* check0 = ObjectIsSmi(value); | 1017 Node* check0 = ObjectIsSmi(value); |
| 1017 Node* branch0 = | 1018 Node* branch0 = |
| 1018 graph()->NewNode(common()->Branch(BranchHint::kTrue), check0, control); | 1019 graph()->NewNode(common()->Branch(BranchHint::kTrue), check0, control); |
| 1019 | 1020 |
| 1020 Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0); | 1021 Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0); |
| 1021 Node* etrue0 = effect; | 1022 Node* etrue0 = effect; |
| 1022 | 1023 |
| 1023 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0); | 1024 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0); |
| 1024 Node* efalse0 = effect; | 1025 Node* efalse0 = effect; |
| 1025 { | 1026 { |
| 1026 Node* value_map = efalse0 = | 1027 Node* value_map = efalse0 = |
| 1027 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), | 1028 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), |
| 1028 value, efalse0, if_false0); | 1029 value, efalse0, if_false0); |
| 1029 Node* check1 = graph()->NewNode(machine()->WordEqual(), value_map, | 1030 Node* check1 = graph()->NewNode(machine()->WordEqual(), value_map, |
| 1030 jsgraph()->HeapNumberMapConstant()); | 1031 jsgraph()->HeapNumberMapConstant()); |
| 1031 if_false0 = efalse0 = graph()->NewNode(common()->DeoptimizeUnless(), check1, | 1032 if_false0 = efalse0 = graph()->NewNode( |
| 1032 frame_state, efalse0, if_false0); | 1033 common()->DeoptimizeUnless(DeoptimizeReason::kNotAHeapNumber), check1, |
| 1034 frame_state, efalse0, if_false0); |
| 1033 } | 1035 } |
| 1034 | 1036 |
| 1035 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0); | 1037 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0); |
| 1036 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control); | 1038 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control); |
| 1037 | 1039 |
| 1038 return ValueEffectControl(value, effect, control); | 1040 return ValueEffectControl(value, effect, control); |
| 1039 } | 1041 } |
| 1040 | 1042 |
| 1041 EffectControlLinearizer::ValueEffectControl | 1043 EffectControlLinearizer::ValueEffectControl |
| 1042 EffectControlLinearizer::LowerCheckIf(Node* node, Node* frame_state, | 1044 EffectControlLinearizer::LowerCheckIf(Node* node, Node* frame_state, |
| 1043 Node* effect, Node* control) { | 1045 Node* effect, Node* control) { |
| 1044 Node* value = node->InputAt(0); | 1046 Node* value = node->InputAt(0); |
| 1045 | 1047 |
| 1046 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), value, | 1048 control = effect = |
| 1047 frame_state, effect, control); | 1049 graph()->NewNode(common()->DeoptimizeUnless(DeoptimizeReason::kNoReason), |
| 1050 value, frame_state, effect, control); |
| 1048 | 1051 |
| 1049 return ValueEffectControl(value, effect, control); | 1052 return ValueEffectControl(value, effect, control); |
| 1050 } | 1053 } |
| 1051 | 1054 |
| 1052 EffectControlLinearizer::ValueEffectControl | 1055 EffectControlLinearizer::ValueEffectControl |
| 1053 EffectControlLinearizer::LowerCheckTaggedPointer(Node* node, Node* frame_state, | 1056 EffectControlLinearizer::LowerCheckTaggedPointer(Node* node, Node* frame_state, |
| 1054 Node* effect, Node* control) { | 1057 Node* effect, Node* control) { |
| 1055 Node* value = node->InputAt(0); | 1058 Node* value = node->InputAt(0); |
| 1056 | 1059 |
| 1057 Node* check = ObjectIsSmi(value); | 1060 Node* check = ObjectIsSmi(value); |
| 1058 control = effect = graph()->NewNode(common()->DeoptimizeIf(), check, | 1061 control = effect = |
| 1059 frame_state, effect, control); | 1062 graph()->NewNode(common()->DeoptimizeIf(DeoptimizeReason::kSmi), check, |
| 1063 frame_state, effect, control); |
| 1060 | 1064 |
| 1061 return ValueEffectControl(value, effect, control); | 1065 return ValueEffectControl(value, effect, control); |
| 1062 } | 1066 } |
| 1063 | 1067 |
| 1064 EffectControlLinearizer::ValueEffectControl | 1068 EffectControlLinearizer::ValueEffectControl |
| 1065 EffectControlLinearizer::LowerCheckTaggedSigned(Node* node, Node* frame_state, | 1069 EffectControlLinearizer::LowerCheckTaggedSigned(Node* node, Node* frame_state, |
| 1066 Node* effect, Node* control) { | 1070 Node* effect, Node* control) { |
| 1067 Node* value = node->InputAt(0); | 1071 Node* value = node->InputAt(0); |
| 1068 | 1072 |
| 1069 Node* check = ObjectIsSmi(value); | 1073 Node* check = ObjectIsSmi(value); |
| 1070 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check, | 1074 control = effect = |
| 1071 frame_state, effect, control); | 1075 graph()->NewNode(common()->DeoptimizeUnless(DeoptimizeReason::kNotASmi), |
| 1076 check, frame_state, effect, control); |
| 1072 | 1077 |
| 1073 return ValueEffectControl(value, effect, control); | 1078 return ValueEffectControl(value, effect, control); |
| 1074 } | 1079 } |
| 1075 | 1080 |
| 1076 EffectControlLinearizer::ValueEffectControl | 1081 EffectControlLinearizer::ValueEffectControl |
| 1077 EffectControlLinearizer::LowerCheckedInt32Add(Node* node, Node* frame_state, | 1082 EffectControlLinearizer::LowerCheckedInt32Add(Node* node, Node* frame_state, |
| 1078 Node* effect, Node* control) { | 1083 Node* effect, Node* control) { |
| 1079 Node* lhs = node->InputAt(0); | 1084 Node* lhs = node->InputAt(0); |
| 1080 Node* rhs = node->InputAt(1); | 1085 Node* rhs = node->InputAt(1); |
| 1081 | 1086 |
| 1082 Node* value = | 1087 Node* value = |
| 1083 graph()->NewNode(machine()->Int32AddWithOverflow(), lhs, rhs, control); | 1088 graph()->NewNode(machine()->Int32AddWithOverflow(), lhs, rhs, control); |
| 1084 | 1089 |
| 1085 Node* check = graph()->NewNode(common()->Projection(1), value, control); | 1090 Node* check = graph()->NewNode(common()->Projection(1), value, control); |
| 1086 control = effect = graph()->NewNode(common()->DeoptimizeIf(), check, | 1091 control = effect = |
| 1087 frame_state, effect, control); | 1092 graph()->NewNode(common()->DeoptimizeIf(DeoptimizeReason::kOverflow), |
| 1093 check, frame_state, effect, control); |
| 1088 | 1094 |
| 1089 value = graph()->NewNode(common()->Projection(0), value, control); | 1095 value = graph()->NewNode(common()->Projection(0), value, control); |
| 1090 | 1096 |
| 1091 return ValueEffectControl(value, effect, control); | 1097 return ValueEffectControl(value, effect, control); |
| 1092 } | 1098 } |
| 1093 | 1099 |
| 1094 EffectControlLinearizer::ValueEffectControl | 1100 EffectControlLinearizer::ValueEffectControl |
| 1095 EffectControlLinearizer::LowerCheckedInt32Sub(Node* node, Node* frame_state, | 1101 EffectControlLinearizer::LowerCheckedInt32Sub(Node* node, Node* frame_state, |
| 1096 Node* effect, Node* control) { | 1102 Node* effect, Node* control) { |
| 1097 Node* lhs = node->InputAt(0); | 1103 Node* lhs = node->InputAt(0); |
| 1098 Node* rhs = node->InputAt(1); | 1104 Node* rhs = node->InputAt(1); |
| 1099 | 1105 |
| 1100 Node* value = | 1106 Node* value = |
| 1101 graph()->NewNode(machine()->Int32SubWithOverflow(), lhs, rhs, control); | 1107 graph()->NewNode(machine()->Int32SubWithOverflow(), lhs, rhs, control); |
| 1102 | 1108 |
| 1103 Node* check = graph()->NewNode(common()->Projection(1), value, control); | 1109 Node* check = graph()->NewNode(common()->Projection(1), value, control); |
| 1104 control = effect = graph()->NewNode(common()->DeoptimizeIf(), check, | 1110 control = effect = |
| 1105 frame_state, effect, control); | 1111 graph()->NewNode(common()->DeoptimizeIf(DeoptimizeReason::kOverflow), |
| 1112 check, frame_state, effect, control); |
| 1106 | 1113 |
| 1107 value = graph()->NewNode(common()->Projection(0), value, control); | 1114 value = graph()->NewNode(common()->Projection(0), value, control); |
| 1108 | 1115 |
| 1109 return ValueEffectControl(value, effect, control); | 1116 return ValueEffectControl(value, effect, control); |
| 1110 } | 1117 } |
| 1111 | 1118 |
| 1112 EffectControlLinearizer::ValueEffectControl | 1119 EffectControlLinearizer::ValueEffectControl |
| 1113 EffectControlLinearizer::LowerCheckedInt32Div(Node* node, Node* frame_state, | 1120 EffectControlLinearizer::LowerCheckedInt32Div(Node* node, Node* frame_state, |
| 1114 Node* effect, Node* control) { | 1121 Node* effect, Node* control) { |
| 1115 Node* zero = jsgraph()->Int32Constant(0); | 1122 Node* zero = jsgraph()->Int32Constant(0); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1131 // Fast case, no additional checking required. | 1138 // Fast case, no additional checking required. |
| 1132 vtrue0 = graph()->NewNode(machine()->Int32Div(), lhs, rhs, if_true0); | 1139 vtrue0 = graph()->NewNode(machine()->Int32Div(), lhs, rhs, if_true0); |
| 1133 } | 1140 } |
| 1134 | 1141 |
| 1135 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0); | 1142 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0); |
| 1136 Node* efalse0 = effect; | 1143 Node* efalse0 = effect; |
| 1137 Node* vfalse0; | 1144 Node* vfalse0; |
| 1138 { | 1145 { |
| 1139 // Check if {rhs} is zero. | 1146 // Check if {rhs} is zero. |
| 1140 Node* check = graph()->NewNode(machine()->Word32Equal(), rhs, zero); | 1147 Node* check = graph()->NewNode(machine()->Word32Equal(), rhs, zero); |
| 1141 if_false0 = efalse0 = graph()->NewNode(common()->DeoptimizeIf(), check, | 1148 if_false0 = efalse0 = graph()->NewNode( |
| 1142 frame_state, efalse0, if_false0); | 1149 common()->DeoptimizeIf(DeoptimizeReason::kDivisionByZero), check, |
| 1150 frame_state, efalse0, if_false0); |
| 1143 | 1151 |
| 1144 // Check if {lhs} is zero, as that would produce minus zero. | 1152 // Check if {lhs} is zero, as that would produce minus zero. |
| 1145 check = graph()->NewNode(machine()->Word32Equal(), lhs, zero); | 1153 check = graph()->NewNode(machine()->Word32Equal(), lhs, zero); |
| 1146 if_false0 = efalse0 = graph()->NewNode(common()->DeoptimizeIf(), check, | 1154 if_false0 = efalse0 = |
| 1147 frame_state, efalse0, if_false0); | 1155 graph()->NewNode(common()->DeoptimizeIf(DeoptimizeReason::kMinusZero), |
| 1156 check, frame_state, efalse0, if_false0); |
| 1148 | 1157 |
| 1149 // Check if {lhs} is kMinInt and {rhs} is -1, in which case we'd have | 1158 // Check if {lhs} is kMinInt and {rhs} is -1, in which case we'd have |
| 1150 // to return -kMinInt, which is not representable. | 1159 // to return -kMinInt, which is not representable. |
| 1151 Node* check1 = graph()->NewNode(machine()->Word32Equal(), lhs, minint); | 1160 Node* check1 = graph()->NewNode(machine()->Word32Equal(), lhs, minint); |
| 1152 Node* branch1 = graph()->NewNode(common()->Branch(BranchHint::kFalse), | 1161 Node* branch1 = graph()->NewNode(common()->Branch(BranchHint::kFalse), |
| 1153 check1, if_false0); | 1162 check1, if_false0); |
| 1154 | 1163 |
| 1155 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1); | 1164 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1); |
| 1156 Node* etrue1 = efalse0; | 1165 Node* etrue1 = efalse0; |
| 1157 { | 1166 { |
| 1158 // Check if {rhs} is -1. | 1167 // Check if {rhs} is -1. |
| 1159 Node* check = graph()->NewNode(machine()->Word32Equal(), rhs, minusone); | 1168 Node* check = graph()->NewNode(machine()->Word32Equal(), rhs, minusone); |
| 1160 if_true1 = etrue1 = graph()->NewNode(common()->DeoptimizeIf(), check, | 1169 if_true1 = etrue1 = |
| 1161 frame_state, etrue1, if_true1); | 1170 graph()->NewNode(common()->DeoptimizeIf(DeoptimizeReason::kOverflow), |
| 1171 check, frame_state, etrue1, if_true1); |
| 1162 } | 1172 } |
| 1163 | 1173 |
| 1164 Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1); | 1174 Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1); |
| 1165 Node* efalse1 = efalse0; | 1175 Node* efalse1 = efalse0; |
| 1166 | 1176 |
| 1167 if_false0 = graph()->NewNode(common()->Merge(2), if_true1, if_false1); | 1177 if_false0 = graph()->NewNode(common()->Merge(2), if_true1, if_false1); |
| 1168 efalse0 = | 1178 efalse0 = |
| 1169 graph()->NewNode(common()->EffectPhi(2), etrue1, efalse1, if_false0); | 1179 graph()->NewNode(common()->EffectPhi(2), etrue1, efalse1, if_false0); |
| 1170 | 1180 |
| 1171 // Perform the actual integer division. | 1181 // Perform the actual integer division. |
| 1172 vfalse0 = graph()->NewNode(machine()->Int32Div(), lhs, rhs, if_false0); | 1182 vfalse0 = graph()->NewNode(machine()->Int32Div(), lhs, rhs, if_false0); |
| 1173 } | 1183 } |
| 1174 | 1184 |
| 1175 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0); | 1185 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0); |
| 1176 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control); | 1186 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control); |
| 1177 Node* value = | 1187 Node* value = |
| 1178 graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), vtrue0, | 1188 graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), vtrue0, |
| 1179 vfalse0, control); | 1189 vfalse0, control); |
| 1180 | 1190 |
| 1181 // Check if the remainder is non-zero. | 1191 // Check if the remainder is non-zero. |
| 1182 Node* check = | 1192 Node* check = |
| 1183 graph()->NewNode(machine()->Word32Equal(), lhs, | 1193 graph()->NewNode(machine()->Word32Equal(), lhs, |
| 1184 graph()->NewNode(machine()->Int32Mul(), rhs, value)); | 1194 graph()->NewNode(machine()->Int32Mul(), rhs, value)); |
| 1185 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check, | 1195 control = effect = graph()->NewNode( |
| 1186 frame_state, effect, control); | 1196 common()->DeoptimizeUnless(DeoptimizeReason::kLostPrecision), check, |
| 1197 frame_state, effect, control); |
| 1187 | 1198 |
| 1188 return ValueEffectControl(value, effect, control); | 1199 return ValueEffectControl(value, effect, control); |
| 1189 } | 1200 } |
| 1190 | 1201 |
| 1191 EffectControlLinearizer::ValueEffectControl | 1202 EffectControlLinearizer::ValueEffectControl |
| 1192 EffectControlLinearizer::LowerCheckedInt32Mod(Node* node, Node* frame_state, | 1203 EffectControlLinearizer::LowerCheckedInt32Mod(Node* node, Node* frame_state, |
| 1193 Node* effect, Node* control) { | 1204 Node* effect, Node* control) { |
| 1194 Node* zero = jsgraph()->Int32Constant(0); | 1205 Node* zero = jsgraph()->Int32Constant(0); |
| 1195 Node* minusone = jsgraph()->Int32Constant(-1); | 1206 Node* minusone = jsgraph()->Int32Constant(-1); |
| 1196 Node* minint = jsgraph()->Int32Constant(std::numeric_limits<int32_t>::min()); | 1207 Node* minint = jsgraph()->Int32Constant(std::numeric_limits<int32_t>::min()); |
| 1197 | 1208 |
| 1198 Node* lhs = node->InputAt(0); | 1209 Node* lhs = node->InputAt(0); |
| 1199 Node* rhs = node->InputAt(1); | 1210 Node* rhs = node->InputAt(1); |
| 1200 | 1211 |
| 1201 // Ensure that {rhs} is not zero, otherwise we'd have to return NaN. | 1212 // Ensure that {rhs} is not zero, otherwise we'd have to return NaN. |
| 1202 Node* check = graph()->NewNode(machine()->Word32Equal(), rhs, zero); | 1213 Node* check = graph()->NewNode(machine()->Word32Equal(), rhs, zero); |
| 1203 control = effect = graph()->NewNode(common()->DeoptimizeIf(), check, | 1214 control = effect = graph()->NewNode( |
| 1204 frame_state, effect, control); | 1215 common()->DeoptimizeIf(DeoptimizeReason::kDivisionByZero), check, |
| 1216 frame_state, effect, control); |
| 1205 | 1217 |
| 1206 // Check if {lhs} is positive or zero. | 1218 // Check if {lhs} is positive or zero. |
| 1207 Node* check0 = graph()->NewNode(machine()->Int32LessThanOrEqual(), zero, lhs); | 1219 Node* check0 = graph()->NewNode(machine()->Int32LessThanOrEqual(), zero, lhs); |
| 1208 Node* branch0 = | 1220 Node* branch0 = |
| 1209 graph()->NewNode(common()->Branch(BranchHint::kTrue), check0, control); | 1221 graph()->NewNode(common()->Branch(BranchHint::kTrue), check0, control); |
| 1210 | 1222 |
| 1211 Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0); | 1223 Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0); |
| 1212 Node* etrue0 = effect; | 1224 Node* etrue0 = effect; |
| 1213 Node* vtrue0; | 1225 Node* vtrue0; |
| 1214 { | 1226 { |
| 1215 // Fast case, no additional checking required. | 1227 // Fast case, no additional checking required. |
| 1216 vtrue0 = graph()->NewNode(machine()->Int32Mod(), lhs, rhs, if_true0); | 1228 vtrue0 = graph()->NewNode(machine()->Int32Mod(), lhs, rhs, if_true0); |
| 1217 } | 1229 } |
| 1218 | 1230 |
| 1219 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0); | 1231 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0); |
| 1220 Node* efalse0 = effect; | 1232 Node* efalse0 = effect; |
| 1221 Node* vfalse0; | 1233 Node* vfalse0; |
| 1222 { | 1234 { |
| 1223 // Check if {lhs} is kMinInt and {rhs} is -1, in which case we'd have | 1235 // Check if {lhs} is kMinInt and {rhs} is -1, in which case we'd have |
| 1224 // to return -0. | 1236 // to return -0. |
| 1225 Node* check1 = graph()->NewNode(machine()->Word32Equal(), lhs, minint); | 1237 Node* check1 = graph()->NewNode(machine()->Word32Equal(), lhs, minint); |
| 1226 Node* branch1 = graph()->NewNode(common()->Branch(BranchHint::kFalse), | 1238 Node* branch1 = graph()->NewNode(common()->Branch(BranchHint::kFalse), |
| 1227 check1, if_false0); | 1239 check1, if_false0); |
| 1228 | 1240 |
| 1229 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1); | 1241 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1); |
| 1230 Node* etrue1 = efalse0; | 1242 Node* etrue1 = efalse0; |
| 1231 { | 1243 { |
| 1232 // Check if {rhs} is -1. | 1244 // Check if {rhs} is -1. |
| 1233 Node* check = graph()->NewNode(machine()->Word32Equal(), rhs, minusone); | 1245 Node* check = graph()->NewNode(machine()->Word32Equal(), rhs, minusone); |
| 1234 if_true1 = etrue1 = graph()->NewNode(common()->DeoptimizeIf(), check, | 1246 if_true1 = etrue1 = |
| 1235 frame_state, etrue1, if_true1); | 1247 graph()->NewNode(common()->DeoptimizeIf(DeoptimizeReason::kMinusZero), |
| 1248 check, frame_state, etrue1, if_true1); |
| 1236 } | 1249 } |
| 1237 | 1250 |
| 1238 Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1); | 1251 Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1); |
| 1239 Node* efalse1 = efalse0; | 1252 Node* efalse1 = efalse0; |
| 1240 | 1253 |
| 1241 if_false0 = graph()->NewNode(common()->Merge(2), if_true1, if_false1); | 1254 if_false0 = graph()->NewNode(common()->Merge(2), if_true1, if_false1); |
| 1242 efalse0 = | 1255 efalse0 = |
| 1243 graph()->NewNode(common()->EffectPhi(2), etrue1, efalse1, if_false0); | 1256 graph()->NewNode(common()->EffectPhi(2), etrue1, efalse1, if_false0); |
| 1244 | 1257 |
| 1245 // Perform the actual integer modulos. | 1258 // Perform the actual integer modulos. |
| 1246 vfalse0 = graph()->NewNode(machine()->Int32Mod(), lhs, rhs, if_false0); | 1259 vfalse0 = graph()->NewNode(machine()->Int32Mod(), lhs, rhs, if_false0); |
| 1247 | 1260 |
| 1248 // Check if the result is zero, because in that case we'd have to return | 1261 // Check if the result is zero, because in that case we'd have to return |
| 1249 // -0 here since we always take the signe of the {lhs} which is negative. | 1262 // -0 here since we always take the signe of the {lhs} which is negative. |
| 1250 Node* check = graph()->NewNode(machine()->Word32Equal(), vfalse0, zero); | 1263 Node* check = graph()->NewNode(machine()->Word32Equal(), vfalse0, zero); |
| 1251 if_false0 = efalse0 = graph()->NewNode(common()->DeoptimizeIf(), check, | 1264 if_false0 = efalse0 = |
| 1252 frame_state, efalse0, if_false0); | 1265 graph()->NewNode(common()->DeoptimizeIf(DeoptimizeReason::kMinusZero), |
| 1266 check, frame_state, efalse0, if_false0); |
| 1253 } | 1267 } |
| 1254 | 1268 |
| 1255 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0); | 1269 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0); |
| 1256 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control); | 1270 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control); |
| 1257 Node* value = | 1271 Node* value = |
| 1258 graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), vtrue0, | 1272 graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), vtrue0, |
| 1259 vfalse0, control); | 1273 vfalse0, control); |
| 1260 | 1274 |
| 1261 return ValueEffectControl(value, effect, control); | 1275 return ValueEffectControl(value, effect, control); |
| 1262 } | 1276 } |
| 1263 | 1277 |
| 1264 EffectControlLinearizer::ValueEffectControl | 1278 EffectControlLinearizer::ValueEffectControl |
| 1265 EffectControlLinearizer::LowerCheckedUint32Div(Node* node, Node* frame_state, | 1279 EffectControlLinearizer::LowerCheckedUint32Div(Node* node, Node* frame_state, |
| 1266 Node* effect, Node* control) { | 1280 Node* effect, Node* control) { |
| 1267 Node* zero = jsgraph()->Int32Constant(0); | 1281 Node* zero = jsgraph()->Int32Constant(0); |
| 1268 | 1282 |
| 1269 Node* lhs = node->InputAt(0); | 1283 Node* lhs = node->InputAt(0); |
| 1270 Node* rhs = node->InputAt(1); | 1284 Node* rhs = node->InputAt(1); |
| 1271 | 1285 |
| 1272 // Ensure that {rhs} is not zero, otherwise we'd have to return NaN. | 1286 // Ensure that {rhs} is not zero, otherwise we'd have to return NaN. |
| 1273 Node* check = graph()->NewNode(machine()->Word32Equal(), rhs, zero); | 1287 Node* check = graph()->NewNode(machine()->Word32Equal(), rhs, zero); |
| 1274 control = effect = graph()->NewNode(common()->DeoptimizeIf(), check, | 1288 control = effect = graph()->NewNode( |
| 1275 frame_state, effect, control); | 1289 common()->DeoptimizeIf(DeoptimizeReason::kDivisionByZero), check, |
| 1290 frame_state, effect, control); |
| 1276 | 1291 |
| 1277 // Perform the actual unsigned integer division. | 1292 // Perform the actual unsigned integer division. |
| 1278 Node* value = graph()->NewNode(machine()->Uint32Div(), lhs, rhs, control); | 1293 Node* value = graph()->NewNode(machine()->Uint32Div(), lhs, rhs, control); |
| 1279 | 1294 |
| 1280 // Check if the remainder is non-zero. | 1295 // Check if the remainder is non-zero. |
| 1281 check = graph()->NewNode(machine()->Word32Equal(), lhs, | 1296 check = graph()->NewNode(machine()->Word32Equal(), lhs, |
| 1282 graph()->NewNode(machine()->Int32Mul(), rhs, value)); | 1297 graph()->NewNode(machine()->Int32Mul(), rhs, value)); |
| 1283 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check, | 1298 control = effect = graph()->NewNode( |
| 1284 frame_state, effect, control); | 1299 common()->DeoptimizeUnless(DeoptimizeReason::kLostPrecision), check, |
| 1300 frame_state, effect, control); |
| 1285 | 1301 |
| 1286 return ValueEffectControl(value, effect, control); | 1302 return ValueEffectControl(value, effect, control); |
| 1287 } | 1303 } |
| 1288 | 1304 |
| 1289 EffectControlLinearizer::ValueEffectControl | 1305 EffectControlLinearizer::ValueEffectControl |
| 1290 EffectControlLinearizer::LowerCheckedUint32Mod(Node* node, Node* frame_state, | 1306 EffectControlLinearizer::LowerCheckedUint32Mod(Node* node, Node* frame_state, |
| 1291 Node* effect, Node* control) { | 1307 Node* effect, Node* control) { |
| 1292 Node* zero = jsgraph()->Int32Constant(0); | 1308 Node* zero = jsgraph()->Int32Constant(0); |
| 1293 | 1309 |
| 1294 Node* lhs = node->InputAt(0); | 1310 Node* lhs = node->InputAt(0); |
| 1295 Node* rhs = node->InputAt(1); | 1311 Node* rhs = node->InputAt(1); |
| 1296 | 1312 |
| 1297 // Ensure that {rhs} is not zero, otherwise we'd have to return NaN. | 1313 // Ensure that {rhs} is not zero, otherwise we'd have to return NaN. |
| 1298 Node* check = graph()->NewNode(machine()->Word32Equal(), rhs, zero); | 1314 Node* check = graph()->NewNode(machine()->Word32Equal(), rhs, zero); |
| 1299 control = effect = graph()->NewNode(common()->DeoptimizeIf(), check, | 1315 control = effect = graph()->NewNode( |
| 1300 frame_state, effect, control); | 1316 common()->DeoptimizeIf(DeoptimizeReason::kDivisionByZero), check, |
| 1317 frame_state, effect, control); |
| 1301 | 1318 |
| 1302 // Perform the actual unsigned integer modulus. | 1319 // Perform the actual unsigned integer modulus. |
| 1303 Node* value = graph()->NewNode(machine()->Uint32Mod(), lhs, rhs, control); | 1320 Node* value = graph()->NewNode(machine()->Uint32Mod(), lhs, rhs, control); |
| 1304 | 1321 |
| 1305 return ValueEffectControl(value, effect, control); | 1322 return ValueEffectControl(value, effect, control); |
| 1306 } | 1323 } |
| 1307 | 1324 |
| 1308 EffectControlLinearizer::ValueEffectControl | 1325 EffectControlLinearizer::ValueEffectControl |
| 1309 EffectControlLinearizer::LowerCheckedInt32Mul(Node* node, Node* frame_state, | 1326 EffectControlLinearizer::LowerCheckedInt32Mul(Node* node, Node* frame_state, |
| 1310 Node* effect, Node* control) { | 1327 Node* effect, Node* control) { |
| 1311 Node* zero = jsgraph()->Int32Constant(0); | 1328 Node* zero = jsgraph()->Int32Constant(0); |
| 1312 Node* lhs = node->InputAt(0); | 1329 Node* lhs = node->InputAt(0); |
| 1313 Node* rhs = node->InputAt(1); | 1330 Node* rhs = node->InputAt(1); |
| 1314 | 1331 |
| 1315 Node* projection = | 1332 Node* projection = |
| 1316 graph()->NewNode(machine()->Int32MulWithOverflow(), lhs, rhs, control); | 1333 graph()->NewNode(machine()->Int32MulWithOverflow(), lhs, rhs, control); |
| 1317 | 1334 |
| 1318 Node* check = graph()->NewNode(common()->Projection(1), projection, control); | 1335 Node* check = graph()->NewNode(common()->Projection(1), projection, control); |
| 1319 control = effect = graph()->NewNode(common()->DeoptimizeIf(), check, | 1336 control = effect = |
| 1320 frame_state, effect, control); | 1337 graph()->NewNode(common()->DeoptimizeIf(DeoptimizeReason::kOverflow), |
| 1338 check, frame_state, effect, control); |
| 1321 | 1339 |
| 1322 Node* value = graph()->NewNode(common()->Projection(0), projection, control); | 1340 Node* value = graph()->NewNode(common()->Projection(0), projection, control); |
| 1323 | 1341 |
| 1324 Node* check_zero = graph()->NewNode(machine()->Word32Equal(), value, zero); | 1342 Node* check_zero = graph()->NewNode(machine()->Word32Equal(), value, zero); |
| 1325 Node* branch_zero = graph()->NewNode(common()->Branch(BranchHint::kFalse), | 1343 Node* branch_zero = graph()->NewNode(common()->Branch(BranchHint::kFalse), |
| 1326 check_zero, control); | 1344 check_zero, control); |
| 1327 | 1345 |
| 1328 Node* if_zero = graph()->NewNode(common()->IfTrue(), branch_zero); | 1346 Node* if_zero = graph()->NewNode(common()->IfTrue(), branch_zero); |
| 1329 Node* e_if_zero = effect; | 1347 Node* e_if_zero = effect; |
| 1330 { | 1348 { |
| 1331 // We may need to return negative zero. | 1349 // We may need to return negative zero. |
| 1332 Node* or_inputs = graph()->NewNode(machine()->Word32Or(), lhs, rhs); | 1350 Node* or_inputs = graph()->NewNode(machine()->Word32Or(), lhs, rhs); |
| 1333 Node* check_or = | 1351 Node* check_or = |
| 1334 graph()->NewNode(machine()->Int32LessThan(), or_inputs, zero); | 1352 graph()->NewNode(machine()->Int32LessThan(), or_inputs, zero); |
| 1335 if_zero = e_if_zero = graph()->NewNode(common()->DeoptimizeIf(), check_or, | 1353 if_zero = e_if_zero = |
| 1336 frame_state, e_if_zero, if_zero); | 1354 graph()->NewNode(common()->DeoptimizeIf(DeoptimizeReason::kMinusZero), |
| 1355 check_or, frame_state, e_if_zero, if_zero); |
| 1337 } | 1356 } |
| 1338 | 1357 |
| 1339 Node* if_not_zero = graph()->NewNode(common()->IfFalse(), branch_zero); | 1358 Node* if_not_zero = graph()->NewNode(common()->IfFalse(), branch_zero); |
| 1340 Node* e_if_not_zero = effect; | 1359 Node* e_if_not_zero = effect; |
| 1341 | 1360 |
| 1342 control = graph()->NewNode(common()->Merge(2), if_zero, if_not_zero); | 1361 control = graph()->NewNode(common()->Merge(2), if_zero, if_not_zero); |
| 1343 effect = graph()->NewNode(common()->EffectPhi(2), e_if_zero, e_if_not_zero, | 1362 effect = graph()->NewNode(common()->EffectPhi(2), e_if_zero, e_if_not_zero, |
| 1344 control); | 1363 control); |
| 1345 | 1364 |
| 1346 return ValueEffectControl(value, effect, control); | 1365 return ValueEffectControl(value, effect, control); |
| 1347 } | 1366 } |
| 1348 | 1367 |
| 1349 EffectControlLinearizer::ValueEffectControl | 1368 EffectControlLinearizer::ValueEffectControl |
| 1350 EffectControlLinearizer::LowerCheckedUint32ToInt32(Node* node, | 1369 EffectControlLinearizer::LowerCheckedUint32ToInt32(Node* node, |
| 1351 Node* frame_state, | 1370 Node* frame_state, |
| 1352 Node* effect, | 1371 Node* effect, |
| 1353 Node* control) { | 1372 Node* control) { |
| 1354 Node* value = node->InputAt(0); | 1373 Node* value = node->InputAt(0); |
| 1355 Node* max_int = jsgraph()->Int32Constant(std::numeric_limits<int32_t>::max()); | 1374 Node* max_int = jsgraph()->Int32Constant(std::numeric_limits<int32_t>::max()); |
| 1356 Node* is_safe = | 1375 Node* is_safe = |
| 1357 graph()->NewNode(machine()->Uint32LessThanOrEqual(), value, max_int); | 1376 graph()->NewNode(machine()->Uint32LessThanOrEqual(), value, max_int); |
| 1358 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), is_safe, | 1377 control = effect = graph()->NewNode( |
| 1359 frame_state, effect, control); | 1378 common()->DeoptimizeUnless(DeoptimizeReason::kLostPrecision), is_safe, |
| 1379 frame_state, effect, control); |
| 1360 | 1380 |
| 1361 return ValueEffectControl(value, effect, control); | 1381 return ValueEffectControl(value, effect, control); |
| 1362 } | 1382 } |
| 1363 | 1383 |
| 1364 EffectControlLinearizer::ValueEffectControl | 1384 EffectControlLinearizer::ValueEffectControl |
| 1365 EffectControlLinearizer::BuildCheckedFloat64ToInt32(Node* value, | 1385 EffectControlLinearizer::BuildCheckedFloat64ToInt32(Node* value, |
| 1366 Node* frame_state, | 1386 Node* frame_state, |
| 1367 Node* effect, | 1387 Node* effect, |
| 1368 Node* control) { | 1388 Node* control) { |
| 1369 Node* value32 = graph()->NewNode(machine()->RoundFloat64ToInt32(), value); | 1389 Node* value32 = graph()->NewNode(machine()->RoundFloat64ToInt32(), value); |
| 1370 Node* check_same = graph()->NewNode( | 1390 Node* check_same = graph()->NewNode( |
| 1371 machine()->Float64Equal(), value, | 1391 machine()->Float64Equal(), value, |
| 1372 graph()->NewNode(machine()->ChangeInt32ToFloat64(), value32)); | 1392 graph()->NewNode(machine()->ChangeInt32ToFloat64(), value32)); |
| 1373 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check_same, | 1393 control = effect = graph()->NewNode( |
| 1374 frame_state, effect, control); | 1394 common()->DeoptimizeUnless(DeoptimizeReason::kLostPrecisionOrNaN), |
| 1395 check_same, frame_state, effect, control); |
| 1375 | 1396 |
| 1376 // Check if {value} is -0. | 1397 // Check if {value} is -0. |
| 1377 Node* check_zero = graph()->NewNode(machine()->Word32Equal(), value32, | 1398 Node* check_zero = graph()->NewNode(machine()->Word32Equal(), value32, |
| 1378 jsgraph()->Int32Constant(0)); | 1399 jsgraph()->Int32Constant(0)); |
| 1379 Node* branch_zero = graph()->NewNode(common()->Branch(BranchHint::kFalse), | 1400 Node* branch_zero = graph()->NewNode(common()->Branch(BranchHint::kFalse), |
| 1380 check_zero, control); | 1401 check_zero, control); |
| 1381 | 1402 |
| 1382 Node* if_zero = graph()->NewNode(common()->IfTrue(), branch_zero); | 1403 Node* if_zero = graph()->NewNode(common()->IfTrue(), branch_zero); |
| 1383 Node* if_notzero = graph()->NewNode(common()->IfFalse(), branch_zero); | 1404 Node* if_notzero = graph()->NewNode(common()->IfFalse(), branch_zero); |
| 1384 | 1405 |
| 1385 // In case of 0, we need to check the high bits for the IEEE -0 pattern. | 1406 // In case of 0, we need to check the high bits for the IEEE -0 pattern. |
| 1386 Node* check_negative = graph()->NewNode( | 1407 Node* check_negative = graph()->NewNode( |
| 1387 machine()->Int32LessThan(), | 1408 machine()->Int32LessThan(), |
| 1388 graph()->NewNode(machine()->Float64ExtractHighWord32(), value), | 1409 graph()->NewNode(machine()->Float64ExtractHighWord32(), value), |
| 1389 jsgraph()->Int32Constant(0)); | 1410 jsgraph()->Int32Constant(0)); |
| 1390 | 1411 |
| 1391 Node* deopt_minus_zero = graph()->NewNode( | 1412 Node* deopt_minus_zero = |
| 1392 common()->DeoptimizeIf(), check_negative, frame_state, effect, if_zero); | 1413 graph()->NewNode(common()->DeoptimizeIf(DeoptimizeReason::kMinusZero), |
| 1414 check_negative, frame_state, effect, if_zero); |
| 1393 | 1415 |
| 1394 Node* merge = | 1416 Node* merge = |
| 1395 graph()->NewNode(common()->Merge(2), deopt_minus_zero, if_notzero); | 1417 graph()->NewNode(common()->Merge(2), deopt_minus_zero, if_notzero); |
| 1396 | 1418 |
| 1397 effect = | 1419 effect = |
| 1398 graph()->NewNode(common()->EffectPhi(2), deopt_minus_zero, effect, merge); | 1420 graph()->NewNode(common()->EffectPhi(2), deopt_minus_zero, effect, merge); |
| 1399 | 1421 |
| 1400 return ValueEffectControl(value32, effect, merge); | 1422 return ValueEffectControl(value32, effect, merge); |
| 1401 } | 1423 } |
| 1402 | 1424 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1430 // to int32. | 1452 // to int32. |
| 1431 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); | 1453 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); |
| 1432 Node* efalse = effect; | 1454 Node* efalse = effect; |
| 1433 Node* vfalse; | 1455 Node* vfalse; |
| 1434 { | 1456 { |
| 1435 Node* value_map = efalse = | 1457 Node* value_map = efalse = |
| 1436 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), | 1458 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), |
| 1437 value, efalse, if_false); | 1459 value, efalse, if_false); |
| 1438 Node* check = graph()->NewNode(machine()->WordEqual(), value_map, | 1460 Node* check = graph()->NewNode(machine()->WordEqual(), value_map, |
| 1439 jsgraph()->HeapNumberMapConstant()); | 1461 jsgraph()->HeapNumberMapConstant()); |
| 1440 if_false = efalse = graph()->NewNode(common()->DeoptimizeUnless(), check, | 1462 if_false = efalse = graph()->NewNode( |
| 1441 frame_state, efalse, if_false); | 1463 common()->DeoptimizeUnless(DeoptimizeReason::kNotAHeapNumber), check, |
| 1464 frame_state, efalse, if_false); |
| 1442 vfalse = efalse = graph()->NewNode( | 1465 vfalse = efalse = graph()->NewNode( |
| 1443 simplified()->LoadField(AccessBuilder::ForHeapNumberValue()), value, | 1466 simplified()->LoadField(AccessBuilder::ForHeapNumberValue()), value, |
| 1444 efalse, if_false); | 1467 efalse, if_false); |
| 1445 ValueEffectControl state = | 1468 ValueEffectControl state = |
| 1446 BuildCheckedFloat64ToInt32(vfalse, frame_state, efalse, if_false); | 1469 BuildCheckedFloat64ToInt32(vfalse, frame_state, efalse, if_false); |
| 1447 if_false = state.control; | 1470 if_false = state.control; |
| 1448 efalse = state.effect; | 1471 efalse = state.effect; |
| 1449 vfalse = state.value; | 1472 vfalse = state.value; |
| 1450 } | 1473 } |
| 1451 | 1474 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1475 // For oddballs also contain the numeric value, let us just check that | 1498 // For oddballs also contain the numeric value, let us just check that |
| 1476 // we have an oddball here. | 1499 // we have an oddball here. |
| 1477 Node* efalse = effect; | 1500 Node* efalse = effect; |
| 1478 Node* instance_type = efalse = graph()->NewNode( | 1501 Node* instance_type = efalse = graph()->NewNode( |
| 1479 simplified()->LoadField(AccessBuilder::ForMapInstanceType()), value_map, | 1502 simplified()->LoadField(AccessBuilder::ForMapInstanceType()), value_map, |
| 1480 efalse, if_false); | 1503 efalse, if_false); |
| 1481 Node* check_oddball = | 1504 Node* check_oddball = |
| 1482 graph()->NewNode(machine()->Word32Equal(), instance_type, | 1505 graph()->NewNode(machine()->Word32Equal(), instance_type, |
| 1483 jsgraph()->Int32Constant(ODDBALL_TYPE)); | 1506 jsgraph()->Int32Constant(ODDBALL_TYPE)); |
| 1484 if_false = efalse = | 1507 if_false = efalse = |
| 1485 graph()->NewNode(common()->DeoptimizeUnless(), check_oddball, frame_state, | 1508 graph()->NewNode(common()->DeoptimizeUnless( |
| 1486 efalse, if_false); | 1509 DeoptimizeReason::kNotAHeapNumberUndefinedBoolean), |
| 1510 check_oddball, frame_state, efalse, if_false); |
| 1487 STATIC_ASSERT(HeapNumber::kValueOffset == Oddball::kToNumberRawOffset); | 1511 STATIC_ASSERT(HeapNumber::kValueOffset == Oddball::kToNumberRawOffset); |
| 1488 | 1512 |
| 1489 control = graph()->NewNode(common()->Merge(2), if_true, if_false); | 1513 control = graph()->NewNode(common()->Merge(2), if_true, if_false); |
| 1490 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control); | 1514 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control); |
| 1491 | 1515 |
| 1492 Node* result = effect = graph()->NewNode( | 1516 Node* result = effect = graph()->NewNode( |
| 1493 simplified()->LoadField(AccessBuilder::ForHeapNumberValue()), value, | 1517 simplified()->LoadField(AccessBuilder::ForHeapNumberValue()), value, |
| 1494 effect, control); | 1518 effect, control); |
| 1495 return ValueEffectControl(result, effect, control); | 1519 return ValueEffectControl(result, effect, control); |
| 1496 } | 1520 } |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1875 EffectControlLinearizer::LowerCheckFloat64Hole(Node* node, Node* frame_state, | 1899 EffectControlLinearizer::LowerCheckFloat64Hole(Node* node, Node* frame_state, |
| 1876 Node* effect, Node* control) { | 1900 Node* effect, Node* control) { |
| 1877 // If we reach this point w/o eliminating the {node} that's marked | 1901 // If we reach this point w/o eliminating the {node} that's marked |
| 1878 // with allow-return-hole, we cannot do anything, so just deoptimize | 1902 // with allow-return-hole, we cannot do anything, so just deoptimize |
| 1879 // in case of the hole NaN (similar to Crankshaft). | 1903 // in case of the hole NaN (similar to Crankshaft). |
| 1880 Node* value = node->InputAt(0); | 1904 Node* value = node->InputAt(0); |
| 1881 Node* check = graph()->NewNode( | 1905 Node* check = graph()->NewNode( |
| 1882 machine()->Word32Equal(), | 1906 machine()->Word32Equal(), |
| 1883 graph()->NewNode(machine()->Float64ExtractHighWord32(), value), | 1907 graph()->NewNode(machine()->Float64ExtractHighWord32(), value), |
| 1884 jsgraph()->Int32Constant(kHoleNanUpper32)); | 1908 jsgraph()->Int32Constant(kHoleNanUpper32)); |
| 1885 control = effect = graph()->NewNode(common()->DeoptimizeIf(), check, | 1909 control = effect = |
| 1886 frame_state, effect, control); | 1910 graph()->NewNode(common()->DeoptimizeIf(DeoptimizeReason::kHole), check, |
| 1911 frame_state, effect, control); |
| 1887 | 1912 |
| 1888 return ValueEffectControl(value, effect, control); | 1913 return ValueEffectControl(value, effect, control); |
| 1889 } | 1914 } |
| 1890 | 1915 |
| 1891 EffectControlLinearizer::ValueEffectControl | 1916 EffectControlLinearizer::ValueEffectControl |
| 1892 EffectControlLinearizer::LowerCheckTaggedHole(Node* node, Node* frame_state, | 1917 EffectControlLinearizer::LowerCheckTaggedHole(Node* node, Node* frame_state, |
| 1893 Node* effect, Node* control) { | 1918 Node* effect, Node* control) { |
| 1894 CheckTaggedHoleMode mode = CheckTaggedHoleModeOf(node->op()); | 1919 CheckTaggedHoleMode mode = CheckTaggedHoleModeOf(node->op()); |
| 1895 Node* value = node->InputAt(0); | 1920 Node* value = node->InputAt(0); |
| 1896 Node* check = graph()->NewNode(machine()->WordEqual(), value, | 1921 Node* check = graph()->NewNode(machine()->WordEqual(), value, |
| 1897 jsgraph()->TheHoleConstant()); | 1922 jsgraph()->TheHoleConstant()); |
| 1898 switch (mode) { | 1923 switch (mode) { |
| 1899 case CheckTaggedHoleMode::kConvertHoleToUndefined: | 1924 case CheckTaggedHoleMode::kConvertHoleToUndefined: |
| 1900 value = graph()->NewNode( | 1925 value = graph()->NewNode( |
| 1901 common()->Select(MachineRepresentation::kTagged, BranchHint::kFalse), | 1926 common()->Select(MachineRepresentation::kTagged, BranchHint::kFalse), |
| 1902 check, jsgraph()->UndefinedConstant(), value); | 1927 check, jsgraph()->UndefinedConstant(), value); |
| 1903 break; | 1928 break; |
| 1904 case CheckTaggedHoleMode::kNeverReturnHole: | 1929 case CheckTaggedHoleMode::kNeverReturnHole: |
| 1905 control = effect = graph()->NewNode(common()->DeoptimizeIf(), check, | 1930 control = effect = |
| 1906 frame_state, effect, control); | 1931 graph()->NewNode(common()->DeoptimizeIf(DeoptimizeReason::kHole), |
| 1932 check, frame_state, effect, control); |
| 1907 break; | 1933 break; |
| 1908 } | 1934 } |
| 1909 | 1935 |
| 1910 return ValueEffectControl(value, effect, control); | 1936 return ValueEffectControl(value, effect, control); |
| 1911 } | 1937 } |
| 1912 | 1938 |
| 1913 EffectControlLinearizer::ValueEffectControl | 1939 EffectControlLinearizer::ValueEffectControl |
| 1914 EffectControlLinearizer::AllocateHeapNumberWithValue(Node* value, Node* effect, | 1940 EffectControlLinearizer::AllocateHeapNumberWithValue(Node* value, Node* effect, |
| 1915 Node* control) { | 1941 Node* control) { |
| 1916 Node* result = effect = graph()->NewNode( | 1942 Node* result = effect = graph()->NewNode( |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2108 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 2134 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
| 2109 Operator::kNoThrow); | 2135 Operator::kNoThrow); |
| 2110 to_number_operator_.set(common()->Call(desc)); | 2136 to_number_operator_.set(common()->Call(desc)); |
| 2111 } | 2137 } |
| 2112 return to_number_operator_.get(); | 2138 return to_number_operator_.get(); |
| 2113 } | 2139 } |
| 2114 | 2140 |
| 2115 } // namespace compiler | 2141 } // namespace compiler |
| 2116 } // namespace internal | 2142 } // namespace internal |
| 2117 } // namespace v8 | 2143 } // namespace v8 |
| OLD | NEW |