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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 break; | 445 break; |
446 case IrOpcode::kObjectIsString: | 446 case IrOpcode::kObjectIsString: |
447 state = LowerObjectIsString(node, *effect, *control); | 447 state = LowerObjectIsString(node, *effect, *control); |
448 break; | 448 break; |
449 case IrOpcode::kObjectIsUndetectable: | 449 case IrOpcode::kObjectIsUndetectable: |
450 state = LowerObjectIsUndetectable(node, *effect, *control); | 450 state = LowerObjectIsUndetectable(node, *effect, *control); |
451 break; | 451 break; |
452 case IrOpcode::kStringFromCharCode: | 452 case IrOpcode::kStringFromCharCode: |
453 state = LowerStringFromCharCode(node, *effect, *control); | 453 state = LowerStringFromCharCode(node, *effect, *control); |
454 break; | 454 break; |
| 455 case IrOpcode::kCheckIf: |
| 456 state = LowerCheckIf(node, frame_state, *effect, *control); |
| 457 break; |
455 default: | 458 default: |
456 return false; | 459 return false; |
457 } | 460 } |
458 NodeProperties::ReplaceUses(node, state.value); | 461 NodeProperties::ReplaceUses(node, state.value, state.effect, state.control); |
459 *effect = state.effect; | 462 *effect = state.effect; |
460 *control = state.control; | 463 *control = state.control; |
461 return true; | 464 return true; |
462 } | 465 } |
463 | 466 |
464 EffectControlLinearizer::ValueEffectControl | 467 EffectControlLinearizer::ValueEffectControl |
465 EffectControlLinearizer::LowerTypeGuard(Node* node, Node* effect, | 468 EffectControlLinearizer::LowerTypeGuard(Node* node, Node* effect, |
466 Node* control) { | 469 Node* control) { |
467 Node* value = node->InputAt(0); | 470 Node* value = node->InputAt(0); |
468 return ValueEffectControl(value, effect, control); | 471 return ValueEffectControl(value, effect, control); |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1267 | 1270 |
1268 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0); | 1271 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0); |
1269 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control); | 1272 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control); |
1270 value = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), | 1273 value = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), |
1271 vtrue0, vfalse0, control); | 1274 vtrue0, vfalse0, control); |
1272 | 1275 |
1273 return ValueEffectControl(value, effect, control); | 1276 return ValueEffectControl(value, effect, control); |
1274 } | 1277 } |
1275 | 1278 |
1276 EffectControlLinearizer::ValueEffectControl | 1279 EffectControlLinearizer::ValueEffectControl |
| 1280 EffectControlLinearizer::LowerCheckIf(Node* node, Node* frame_state, |
| 1281 Node* effect, Node* control) { |
| 1282 NodeProperties::ReplaceEffectInput(node, effect); |
| 1283 NodeProperties::ReplaceControlInput(node, control); |
| 1284 node->InsertInput(graph()->zone(), 1, frame_state); |
| 1285 NodeProperties::ChangeOp(node, common()->DeoptimizeIf()); |
| 1286 return ValueEffectControl(node, node, node); |
| 1287 } |
| 1288 |
| 1289 EffectControlLinearizer::ValueEffectControl |
1277 EffectControlLinearizer::AllocateHeapNumberWithValue(Node* value, Node* effect, | 1290 EffectControlLinearizer::AllocateHeapNumberWithValue(Node* value, Node* effect, |
1278 Node* control) { | 1291 Node* control) { |
1279 Node* result = effect = graph()->NewNode( | 1292 Node* result = effect = graph()->NewNode( |
1280 simplified()->Allocate(NOT_TENURED), | 1293 simplified()->Allocate(NOT_TENURED), |
1281 jsgraph()->Int32Constant(HeapNumber::kSize), effect, control); | 1294 jsgraph()->Int32Constant(HeapNumber::kSize), effect, control); |
1282 effect = graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()), | 1295 effect = graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()), |
1283 result, jsgraph()->HeapNumberMapConstant(), effect, | 1296 result, jsgraph()->HeapNumberMapConstant(), effect, |
1284 control); | 1297 control); |
1285 effect = graph()->NewNode( | 1298 effect = graph()->NewNode( |
1286 simplified()->StoreField(AccessBuilder::ForHeapNumberValue()), result, | 1299 simplified()->StoreField(AccessBuilder::ForHeapNumberValue()), result, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1338 return isolate()->factory(); | 1351 return isolate()->factory(); |
1339 } | 1352 } |
1340 | 1353 |
1341 Isolate* EffectControlLinearizer::isolate() const { | 1354 Isolate* EffectControlLinearizer::isolate() const { |
1342 return jsgraph()->isolate(); | 1355 return jsgraph()->isolate(); |
1343 } | 1356 } |
1344 | 1357 |
1345 } // namespace compiler | 1358 } // namespace compiler |
1346 } // namespace internal | 1359 } // namespace internal |
1347 } // namespace v8 | 1360 } // namespace v8 |
OLD | NEW |