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

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

Issue 2848583002: [turbofan] Fix impossible type handling for TypeGuard and BooleanNot. (Closed)
Patch Set: Created 3 years, 7 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 | « src/compiler/access-builder.cc ('k') | 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.
2782 MachineRepresentation output = 2785 MachineRepresentation representation =
2783 GetOutputInfoForPhi(node, TypeOf(node->InputAt(0)), truncation); 2786 GetOutputInfoForPhi(node, TypeOf(node->InputAt(0)), truncation);
2784 VisitUnop(node, UseInfo(output, truncation), output); 2787
2788 // For now, we just handle specially the impossible case.
2789 MachineRepresentation output = TypeOf(node)->IsInhabited()
2790 ? representation
2791 : MachineRepresentation::kNone;
2792
2793 VisitUnop(node, UseInfo(representation, truncation), output);
2785 if (lower()) DeferReplacement(node, node->InputAt(0)); 2794 if (lower()) DeferReplacement(node, node->InputAt(0));
2786 return; 2795 return;
2787 } 2796 }
2788 2797
2789 case IrOpcode::kOsrGuard: 2798 case IrOpcode::kOsrGuard:
2790 return VisitOsrGuard(node); 2799 return VisitOsrGuard(node);
2791 2800
2792 case IrOpcode::kFinishRegion: 2801 case IrOpcode::kFinishRegion:
2793 VisitInputs(node); 2802 VisitInputs(node);
2794 // Assume the output is tagged pointer. 2803 // Assume the output is tagged pointer.
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
3675 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 3684 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
3676 Operator::kNoProperties); 3685 Operator::kNoProperties);
3677 to_number_operator_.set(common()->Call(desc)); 3686 to_number_operator_.set(common()->Call(desc));
3678 } 3687 }
3679 return to_number_operator_.get(); 3688 return to_number_operator_.get();
3680 } 3689 }
3681 3690
3682 } // namespace compiler 3691 } // namespace compiler
3683 } // namespace internal 3692 } // namespace internal
3684 } // namespace v8 3693 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/access-builder.cc ('k') | test/mjsunit/compiler/regress-715204.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698