Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(522)

Side by Side Diff: src/compiler/simplified-lowering.cc

Issue 2836203004: [turbofan] Fix impossible type handling for TypeGuard and BooleanNot. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/compiler/regress-715204.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/simplified-lowering.h" 5 #include "src/compiler/simplified-lowering.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/address-map.h" 9 #include "src/address-map.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after
1524 //------------------------------------------------------------------ 1524 //------------------------------------------------------------------
1525 // Simplified operators. 1525 // Simplified operators.
1526 //------------------------------------------------------------------ 1526 //------------------------------------------------------------------
1527 case IrOpcode::kBooleanNot: { 1527 case IrOpcode::kBooleanNot: {
1528 if (lower()) { 1528 if (lower()) {
1529 NodeInfo* input_info = GetInfo(node->InputAt(0)); 1529 NodeInfo* input_info = GetInfo(node->InputAt(0));
1530 if (input_info->representation() == MachineRepresentation::kBit) { 1530 if (input_info->representation() == MachineRepresentation::kBit) {
1531 // BooleanNot(x: kRepBit) => Word32Equal(x, #0) 1531 // BooleanNot(x: kRepBit) => Word32Equal(x, #0)
1532 node->AppendInput(jsgraph_->zone(), jsgraph_->Int32Constant(0)); 1532 node->AppendInput(jsgraph_->zone(), jsgraph_->Int32Constant(0));
1533 NodeProperties::ChangeOp(node, lowering->machine()->Word32Equal()); 1533 NodeProperties::ChangeOp(node, lowering->machine()->Word32Equal());
1534 } else { 1534 } else if (CanBeTaggedPointer(input_info->representation())) {
1535 DCHECK(CanBeTaggedPointer(input_info->representation()));
1536 // BooleanNot(x: kRepTagged) => WordEqual(x, #false) 1535 // BooleanNot(x: kRepTagged) => WordEqual(x, #false)
1537 node->AppendInput(jsgraph_->zone(), jsgraph_->FalseConstant()); 1536 node->AppendInput(jsgraph_->zone(), jsgraph_->FalseConstant());
1538 NodeProperties::ChangeOp(node, lowering->machine()->WordEqual()); 1537 NodeProperties::ChangeOp(node, lowering->machine()->WordEqual());
1538 } else {
1539 DCHECK_EQ(MachineRepresentation::kNone,
1540 input_info->representation());
1541 DeferReplacement(node, lowering->jsgraph()->Int32Constant(0));
1539 } 1542 }
1540 } else { 1543 } else {
1541 // No input representation requirement; adapt during lowering. 1544 // No input representation requirement; adapt during lowering.
1542 ProcessInput(node, 0, UseInfo::AnyTruncatingToBool()); 1545 ProcessInput(node, 0, UseInfo::AnyTruncatingToBool());
1543 SetOutput(node, MachineRepresentation::kBit); 1546 SetOutput(node, MachineRepresentation::kBit);
1544 } 1547 }
1545 return; 1548 return;
1546 } 1549 }
1547 case IrOpcode::kNumberEqual: { 1550 case IrOpcode::kNumberEqual: {
1548 Type* const lhs_type = TypeOf(node->InputAt(0)); 1551 Type* const lhs_type = TypeOf(node->InputAt(0));
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after
2772 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); 2775 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node));
2773 return; 2776 return;
2774 case IrOpcode::kStateValues: 2777 case IrOpcode::kStateValues:
2775 return VisitStateValues(node); 2778 return VisitStateValues(node);
2776 case IrOpcode::kObjectState: 2779 case IrOpcode::kObjectState:
2777 return VisitObjectState(node); 2780 return VisitObjectState(node);
2778 case IrOpcode::kTypeGuard: { 2781 case IrOpcode::kTypeGuard: {
2779 // We just get rid of the sigma here. In principle, it should be 2782 // We just get rid of the sigma here. In principle, it should be
2780 // possible to refine the truncation and representation based on 2783 // possible to refine the truncation and representation based on
2781 // the sigma's type. 2784 // the sigma's type.
2785
2786 // For now, we just handle specially the impossible case.
2782 MachineRepresentation output = 2787 MachineRepresentation output =
2783 GetOutputInfoForPhi(node, TypeOf(node->InputAt(0)), truncation); 2788 TypeOf(node)->IsInhabited()
2789 ? GetOutputInfoForPhi(node, TypeOf(node->InputAt(0)),
2790 truncation)
2791 : MachineRepresentation::kNone;
2784 VisitUnop(node, UseInfo(output, truncation), output); 2792 VisitUnop(node, UseInfo(output, truncation), output);
2785 if (lower()) DeferReplacement(node, node->InputAt(0)); 2793 if (lower()) DeferReplacement(node, node->InputAt(0));
2786 return; 2794 return;
2787 } 2795 }
2788 2796
2789 case IrOpcode::kOsrGuard: 2797 case IrOpcode::kOsrGuard:
2790 return VisitOsrGuard(node); 2798 return VisitOsrGuard(node);
2791 2799
2792 case IrOpcode::kFinishRegion: 2800 case IrOpcode::kFinishRegion:
2793 VisitInputs(node); 2801 VisitInputs(node);
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
3675 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 3683 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
3676 Operator::kNoProperties); 3684 Operator::kNoProperties);
3677 to_number_operator_.set(common()->Call(desc)); 3685 to_number_operator_.set(common()->Call(desc));
3678 } 3686 }
3679 return to_number_operator_.get(); 3687 return to_number_operator_.get();
3680 } 3688 }
3681 3689
3682 } // namespace compiler 3690 } // namespace compiler
3683 } // namespace internal 3691 } // namespace internal
3684 } // namespace v8 3692 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/compiler/regress-715204.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698