| 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/representation-change.h" | 5 #include "src/compiler/representation-change.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 return TypeError(node, output_rep, output_type, | 440 return TypeError(node, output_rep, output_type, |
| 441 MachineRepresentation::kWord32); | 441 MachineRepresentation::kWord32); |
| 442 } | 442 } |
| 443 return InsertConversion(node, op, use_node); | 443 return InsertConversion(node, op, use_node); |
| 444 } | 444 } |
| 445 | 445 |
| 446 Node* RepresentationChanger::InsertConversion(Node* node, const Operator* op, | 446 Node* RepresentationChanger::InsertConversion(Node* node, const Operator* op, |
| 447 Node* use_node) { | 447 Node* use_node) { |
| 448 if (op->ControlInputCount() > 0) { | 448 if (op->ControlInputCount() > 0) { |
| 449 // If the operator can deoptimize (which means it has control | 449 // If the operator can deoptimize (which means it has control |
| 450 // input), we need to connect it to the effect and control chains | 450 // input), we need to connect it to the effect and control chains. |
| 451 // and also provide it with a frame state. | |
| 452 Node* effect = NodeProperties::GetEffectInput(use_node); | 451 Node* effect = NodeProperties::GetEffectInput(use_node); |
| 453 Node* control = NodeProperties::GetControlInput(use_node); | 452 Node* control = NodeProperties::GetControlInput(use_node); |
| 454 Node* frame_state = NodeProperties::FindFrameStateBefore(use_node); | 453 Node* conversion = jsgraph()->graph()->NewNode(op, node, effect, control); |
| 455 Node* conversion = | |
| 456 jsgraph()->graph()->NewNode(op, node, frame_state, effect, control); | |
| 457 NodeProperties::ReplaceControlInput(use_node, control); | 454 NodeProperties::ReplaceControlInput(use_node, control); |
| 458 NodeProperties::ReplaceEffectInput(use_node, effect); | 455 NodeProperties::ReplaceEffectInput(use_node, effect); |
| 459 return conversion; | 456 return conversion; |
| 460 } | 457 } |
| 461 return jsgraph()->graph()->NewNode(op, node); | 458 return jsgraph()->graph()->NewNode(op, node); |
| 462 } | 459 } |
| 463 | 460 |
| 464 | 461 |
| 465 Node* RepresentationChanger::GetBitRepresentationFor( | 462 Node* RepresentationChanger::GetBitRepresentationFor( |
| 466 Node* node, MachineRepresentation output_rep, Type* output_type) { | 463 Node* node, MachineRepresentation output_rep, Type* output_type) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 } else if (check == TypeCheckKind::kSigned32) { | 549 } else if (check == TypeCheckKind::kSigned32) { |
| 553 op = simplified()->CheckedTaggedToInt32(); | 550 op = simplified()->CheckedTaggedToInt32(); |
| 554 } | 551 } |
| 555 } | 552 } |
| 556 if (op == nullptr) { | 553 if (op == nullptr) { |
| 557 return TypeError(node, output_rep, output_type, | 554 return TypeError(node, output_rep, output_type, |
| 558 MachineRepresentation::kWord32); | 555 MachineRepresentation::kWord32); |
| 559 } | 556 } |
| 560 if (op->ControlInputCount() > 0) { | 557 if (op->ControlInputCount() > 0) { |
| 561 // If the operator can deoptimize (which means it has control | 558 // If the operator can deoptimize (which means it has control |
| 562 // input), we need to connect it to the effect and control chains | 559 // input), we need to connect it to the effect and control chains. |
| 563 // and also provide it with a frame state. | |
| 564 UNIMPLEMENTED(); | 560 UNIMPLEMENTED(); |
| 565 } | 561 } |
| 566 return jsgraph()->graph()->NewNode(op, node); | 562 return jsgraph()->graph()->NewNode(op, node); |
| 567 } | 563 } |
| 568 | 564 |
| 569 const Operator* RepresentationChanger::Int32OperatorFor( | 565 const Operator* RepresentationChanger::Int32OperatorFor( |
| 570 IrOpcode::Value opcode) { | 566 IrOpcode::Value opcode) { |
| 571 switch (opcode) { | 567 switch (opcode) { |
| 572 case IrOpcode::kSpeculativeNumberAdd: // Fall through. | 568 case IrOpcode::kSpeculativeNumberAdd: // Fall through. |
| 573 case IrOpcode::kNumberAdd: | 569 case IrOpcode::kNumberAdd: |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 } | 710 } |
| 715 | 711 |
| 716 Node* RepresentationChanger::InsertChangeTaggedToFloat64(Node* node) { | 712 Node* RepresentationChanger::InsertChangeTaggedToFloat64(Node* node) { |
| 717 return jsgraph()->graph()->NewNode(simplified()->ChangeTaggedToFloat64(), | 713 return jsgraph()->graph()->NewNode(simplified()->ChangeTaggedToFloat64(), |
| 718 node); | 714 node); |
| 719 } | 715 } |
| 720 | 716 |
| 721 } // namespace compiler | 717 } // namespace compiler |
| 722 } // namespace internal | 718 } // namespace internal |
| 723 } // namespace v8 | 719 } // namespace v8 |
| OLD | NEW |