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

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

Issue 714613002: Fix bugs in simplified lowering relating to int32/uint32 signs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/raw-machine-assembler.cc ('k') | src/compiler/typer.cc » ('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/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 case IrOpcode::kNumberToInt32: { 665 case IrOpcode::kNumberToInt32: {
666 MachineTypeUnion use_rep = use & kRepMask; 666 MachineTypeUnion use_rep = use & kRepMask;
667 Node* input = node->InputAt(0); 667 Node* input = node->InputAt(0);
668 Type* in_upper = NodeProperties::GetBounds(input).upper; 668 Type* in_upper = NodeProperties::GetBounds(input).upper;
669 MachineTypeUnion in = GetInfo(input)->output; 669 MachineTypeUnion in = GetInfo(input)->output;
670 if (in_upper->Is(Type::Signed32())) { 670 if (in_upper->Is(Type::Signed32())) {
671 // If the input has type int32, pass through representation. 671 // If the input has type int32, pass through representation.
672 VisitUnop(node, kTypeInt32 | use_rep, kTypeInt32 | use_rep); 672 VisitUnop(node, kTypeInt32 | use_rep, kTypeInt32 | use_rep);
673 if (lower()) DeferReplacement(node, node->InputAt(0)); 673 if (lower()) DeferReplacement(node, node->InputAt(0));
674 } else if ((in & kTypeMask) == kTypeUint32 || 674 } else if ((in & kTypeMask) == kTypeUint32 ||
675 (in & kTypeMask) == kTypeInt32 || 675 in_upper->Is(Type::Unsigned32())) {
676 in_upper->Is(Type::Unsigned32()) || 676 // Just change representation if necessary.
677 VisitUnop(node, kTypeUint32 | kRepWord32, kTypeInt32 | kRepWord32);
678 if (lower()) DeferReplacement(node, node->InputAt(0));
679 } else if ((in & kTypeMask) == kTypeInt32 ||
677 (in & kRepMask) == kRepWord32) { 680 (in & kRepMask) == kRepWord32) {
678 // Just change representation if necessary. 681 // Just change representation if necessary.
679 VisitUnop(node, kTypeInt32 | kRepWord32, kTypeInt32 | kRepWord32); 682 VisitUnop(node, kTypeInt32 | kRepWord32, kTypeInt32 | kRepWord32);
680 if (lower()) DeferReplacement(node, node->InputAt(0)); 683 if (lower()) DeferReplacement(node, node->InputAt(0));
681 } else { 684 } else {
682 // Require the input in float64 format and perform truncation. 685 // Require the input in float64 format and perform truncation.
683 // TODO(turbofan): avoid a truncation with a smi check. 686 // TODO(turbofan): avoid a truncation with a smi check.
684 VisitUnop(node, kTypeInt32 | kRepFloat64, kTypeInt32 | kRepWord32); 687 VisitUnop(node, kTypeInt32 | kRepFloat64, kTypeInt32 | kRepWord32);
685 if (lower()) 688 if (lower())
686 node->set_op(lowering->machine()->TruncateFloat64ToInt32()); 689 node->set_op(lowering->machine()->TruncateFloat64ToInt32());
687 } 690 }
688 break; 691 break;
689 } 692 }
690 case IrOpcode::kNumberToUint32: { 693 case IrOpcode::kNumberToUint32: {
691 MachineTypeUnion use_rep = use & kRepMask; 694 MachineTypeUnion use_rep = use & kRepMask;
692 Node* input = node->InputAt(0); 695 Node* input = node->InputAt(0);
693 Type* in_upper = NodeProperties::GetBounds(input).upper; 696 Type* in_upper = NodeProperties::GetBounds(input).upper;
694 MachineTypeUnion in = GetInfo(input)->output; 697 MachineTypeUnion in = GetInfo(input)->output;
695 if (in_upper->Is(Type::Unsigned32())) { 698 if (in_upper->Is(Type::Unsigned32())) {
696 // If the input has type uint32, pass through representation. 699 // If the input has type uint32, pass through representation.
697 VisitUnop(node, kTypeUint32 | use_rep, kTypeUint32 | use_rep); 700 VisitUnop(node, kTypeUint32 | use_rep, kTypeUint32 | use_rep);
698 if (lower()) DeferReplacement(node, node->InputAt(0)); 701 if (lower()) DeferReplacement(node, node->InputAt(0));
699 } else if ((in & kTypeMask) == kTypeUint32 || 702 } else if ((in & kTypeMask) == kTypeUint32 ||
700 (in & kTypeMask) == kTypeInt32 || 703 in_upper->Is(Type::Unsigned32())) {
701 in_upper->Is(Type::Signed32()) || 704 // Just change representation if necessary.
705 VisitUnop(node, kTypeUint32 | kRepWord32, kTypeUint32 | kRepWord32);
706 if (lower()) DeferReplacement(node, node->InputAt(0));
707 } else if ((in & kTypeMask) == kTypeInt32 ||
702 (in & kRepMask) == kRepWord32) { 708 (in & kRepMask) == kRepWord32) {
703 // Just change representation if necessary. 709 // Just change representation if necessary.
704 VisitUnop(node, kTypeUint32 | kRepWord32, kTypeUint32 | kRepWord32); 710 VisitUnop(node, kTypeInt32 | kRepWord32, kTypeUint32 | kRepWord32);
705 if (lower()) DeferReplacement(node, node->InputAt(0)); 711 if (lower()) DeferReplacement(node, node->InputAt(0));
706 } else { 712 } else {
707 // Require the input in float64 format and perform truncation. 713 // Require the input in float64 format and perform truncation.
708 // TODO(turbofan): avoid a truncation with a smi check. 714 // TODO(turbofan): avoid a truncation with a smi check.
709 VisitUnop(node, kTypeUint32 | kRepFloat64, kTypeUint32 | kRepWord32); 715 VisitUnop(node, kTypeUint32 | kRepFloat64, kTypeUint32 | kRepWord32);
710 if (lower()) 716 if (lower())
711 node->set_op(lowering->machine()->TruncateFloat64ToInt32()); 717 node->set_op(lowering->machine()->TruncateFloat64ToInt32());
712 } 718 }
713 break; 719 break;
714 } 720 }
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
1398 1404
1399 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { 1405 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) {
1400 node->set_op(machine()->IntLessThanOrEqual()); 1406 node->set_op(machine()->IntLessThanOrEqual());
1401 node->ReplaceInput(0, StringComparison(node, true)); 1407 node->ReplaceInput(0, StringComparison(node, true));
1402 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); 1408 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
1403 } 1409 }
1404 1410
1405 } // namespace compiler 1411 } // namespace compiler
1406 } // namespace internal 1412 } // namespace internal
1407 } // namespace v8 1413 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/raw-machine-assembler.cc ('k') | src/compiler/typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698