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 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1160 control = effect = graph()->NewNode( | 1160 control = effect = graph()->NewNode( |
1161 common()->DeoptimizeUnless(DeoptimizeReason::kOutOfBounds), check, | 1161 common()->DeoptimizeUnless(DeoptimizeReason::kOutOfBounds), check, |
1162 frame_state, effect, control); | 1162 frame_state, effect, control); |
1163 | 1163 |
1164 return ValueEffectControl(index, effect, control); | 1164 return ValueEffectControl(index, effect, control); |
1165 } | 1165 } |
1166 | 1166 |
1167 EffectControlLinearizer::ValueEffectControl | 1167 EffectControlLinearizer::ValueEffectControl |
1168 EffectControlLinearizer::LowerCheckMaps(Node* node, Node* frame_state, | 1168 EffectControlLinearizer::LowerCheckMaps(Node* node, Node* frame_state, |
1169 Node* effect, Node* control) { | 1169 Node* effect, Node* control) { |
| 1170 CheckMapsParameters const& p = CheckMapsParametersOf(node->op()); |
1170 Node* value = node->InputAt(0); | 1171 Node* value = node->InputAt(0); |
1171 | 1172 |
1172 // Load the current map of the {value}. | 1173 // Load the current map of the {value}. |
1173 Node* value_map = effect = graph()->NewNode( | 1174 Node* value_map = effect = graph()->NewNode( |
1174 simplified()->LoadField(AccessBuilder::ForMap()), value, effect, control); | 1175 simplified()->LoadField(AccessBuilder::ForMap()), value, effect, control); |
1175 | 1176 |
1176 int const map_count = node->op()->ValueInputCount() - 1; | 1177 ZoneHandleSet<Map> const& maps = p.maps(); |
| 1178 int const map_count = static_cast<int>(maps.size()); |
1177 Node** controls = temp_zone()->NewArray<Node*>(map_count); | 1179 Node** controls = temp_zone()->NewArray<Node*>(map_count); |
1178 Node** effects = temp_zone()->NewArray<Node*>(map_count + 1); | 1180 Node** effects = temp_zone()->NewArray<Node*>(map_count + 1); |
1179 | 1181 |
1180 for (int i = 0; i < map_count; ++i) { | 1182 for (int i = 0; i < map_count; ++i) { |
1181 Node* map = node->InputAt(1 + i); | 1183 Node* map = jsgraph()->HeapConstant(maps[i]); |
1182 | 1184 |
1183 Node* check = graph()->NewNode(machine()->WordEqual(), value_map, map); | 1185 Node* check = graph()->NewNode(machine()->WordEqual(), value_map, map); |
1184 if (i == map_count - 1) { | 1186 if (i == map_count - 1) { |
1185 controls[i] = effects[i] = graph()->NewNode( | 1187 controls[i] = effects[i] = graph()->NewNode( |
1186 common()->DeoptimizeUnless(DeoptimizeReason::kWrongMap), check, | 1188 common()->DeoptimizeUnless(DeoptimizeReason::kWrongMap), check, |
1187 frame_state, effect, control); | 1189 frame_state, effect, control); |
1188 } else { | 1190 } else { |
1189 control = graph()->NewNode(common()->Branch(), check, control); | 1191 control = graph()->NewNode(common()->Branch(), check, control); |
1190 controls[i] = graph()->NewNode(common()->IfTrue(), control); | 1192 controls[i] = graph()->NewNode(common()->IfTrue(), control); |
1191 control = graph()->NewNode(common()->IfFalse(), control); | 1193 control = graph()->NewNode(common()->IfFalse(), control); |
(...skipping 2296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3488 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3490 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
3489 Operator::kEliminatable); | 3491 Operator::kEliminatable); |
3490 to_number_operator_.set(common()->Call(desc)); | 3492 to_number_operator_.set(common()->Call(desc)); |
3491 } | 3493 } |
3492 return to_number_operator_.get(); | 3494 return to_number_operator_.get(); |
3493 } | 3495 } |
3494 | 3496 |
3495 } // namespace compiler | 3497 } // namespace compiler |
3496 } // namespace internal | 3498 } // namespace internal |
3497 } // namespace v8 | 3499 } // namespace v8 |
OLD | NEW |