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

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

Issue 933873002: [turbofan] Fix simplified lowering of NumberToUint32. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 | no next file » | 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/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 } 721 }
722 case IrOpcode::kNumberToUint32: { 722 case IrOpcode::kNumberToUint32: {
723 MachineTypeUnion use_rep = use & kRepMask; 723 MachineTypeUnion use_rep = use & kRepMask;
724 Node* input = node->InputAt(0); 724 Node* input = node->InputAt(0);
725 Type* in_upper = NodeProperties::GetBounds(input).upper; 725 Type* in_upper = NodeProperties::GetBounds(input).upper;
726 MachineTypeUnion in = GetInfo(input)->output; 726 MachineTypeUnion in = GetInfo(input)->output;
727 if (in_upper->Is(Type::Unsigned32())) { 727 if (in_upper->Is(Type::Unsigned32())) {
728 // If the input has type uint32, pass through representation. 728 // If the input has type uint32, pass through representation.
729 VisitUnop(node, kTypeUint32 | use_rep, kTypeUint32 | use_rep); 729 VisitUnop(node, kTypeUint32 | use_rep, kTypeUint32 | use_rep);
730 if (lower()) DeferReplacement(node, node->InputAt(0)); 730 if (lower()) DeferReplacement(node, node->InputAt(0));
731 } else if ((in & kTypeMask) == kTypeInt32 ||
732 in_upper->Is(Type::Signed32())) {
733 // Just change representation if necessary.
734 VisitUnop(node, kTypeInt32 | kRepWord32, kTypeUint32 | kRepWord32);
735 if (lower()) DeferReplacement(node, node->InputAt(0));
731 } else if ((in & kTypeMask) == kTypeUint32 || 736 } else if ((in & kTypeMask) == kTypeUint32 ||
732 in_upper->Is(Type::Unsigned32())) { 737 (in & kRepMask) == kRepWord32) {
733 // Just change representation if necessary. 738 // Just change representation if necessary.
734 VisitUnop(node, kTypeUint32 | kRepWord32, kTypeUint32 | kRepWord32); 739 VisitUnop(node, kTypeUint32 | kRepWord32, kTypeUint32 | kRepWord32);
735 if (lower()) DeferReplacement(node, node->InputAt(0)); 740 if (lower()) DeferReplacement(node, node->InputAt(0));
736 } else if ((in & kTypeMask) == kTypeInt32 ||
737 (in & kRepMask) == kRepWord32) {
738 // Just change representation if necessary.
739 VisitUnop(node, kTypeInt32 | kRepWord32, kTypeUint32 | kRepWord32);
740 if (lower()) DeferReplacement(node, node->InputAt(0));
741 } else { 741 } else {
742 // Require the input in float64 format and perform truncation. 742 // Require the input in float64 format and perform truncation.
743 // TODO(turbofan): avoid a truncation with a smi check. 743 // TODO(turbofan): avoid a truncation with a smi check.
744 VisitUnop(node, kTypeUint32 | kRepFloat64, kTypeUint32 | kRepWord32); 744 VisitUnop(node, kTypeUint32 | kRepFloat64, kTypeUint32 | kRepWord32);
745 if (lower()) 745 if (lower())
746 node->set_op(lowering->machine()->TruncateFloat64ToInt32()); 746 node->set_op(lowering->machine()->TruncateFloat64ToInt32());
747 } 747 }
748 break; 748 break;
749 } 749 }
750 case IrOpcode::kPlainPrimitiveToNumber: { 750 case IrOpcode::kPlainPrimitiveToNumber: {
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 1535
1536 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { 1536 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) {
1537 node->set_op(machine()->IntLessThanOrEqual()); 1537 node->set_op(machine()->IntLessThanOrEqual());
1538 node->ReplaceInput(0, StringComparison(node, true)); 1538 node->ReplaceInput(0, StringComparison(node, true));
1539 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); 1539 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
1540 } 1540 }
1541 1541
1542 } // namespace compiler 1542 } // namespace compiler
1543 } // namespace internal 1543 } // namespace internal
1544 } // namespace v8 1544 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698