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

Side by Side Diff: src/compiler/representation-change.cc

Issue 2823203002: [turbofan] Avoid -0 checks for truncating word32 uses. (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 | « src/compiler/representation-change.h ('k') | 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 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 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 MachineRepresentation::kWord32); 647 MachineRepresentation::kWord32);
648 } 648 }
649 } else if (output_rep == MachineRepresentation::kFloat32) { 649 } else if (output_rep == MachineRepresentation::kFloat32) {
650 node = InsertChangeFloat32ToFloat64(node); // float32 -> float64 -> int32 650 node = InsertChangeFloat32ToFloat64(node); // float32 -> float64 -> int32
651 if (output_type->Is(Type::Signed32())) { 651 if (output_type->Is(Type::Signed32())) {
652 op = machine()->ChangeFloat64ToInt32(); 652 op = machine()->ChangeFloat64ToInt32();
653 } else if (use_info.type_check() == TypeCheckKind::kSignedSmall || 653 } else if (use_info.type_check() == TypeCheckKind::kSignedSmall ||
654 use_info.type_check() == TypeCheckKind::kSigned32) { 654 use_info.type_check() == TypeCheckKind::kSigned32) {
655 op = simplified()->CheckedFloat64ToInt32( 655 op = simplified()->CheckedFloat64ToInt32(
656 output_type->Maybe(Type::MinusZero()) 656 output_type->Maybe(Type::MinusZero())
657 ? CheckForMinusZeroMode::kCheckForMinusZero 657 ? use_info.minus_zero_check()
658 : CheckForMinusZeroMode::kDontCheckForMinusZero); 658 : CheckForMinusZeroMode::kDontCheckForMinusZero);
659 } else if (output_type->Is(Type::Unsigned32())) { 659 } else if (output_type->Is(Type::Unsigned32())) {
660 op = machine()->ChangeFloat64ToUint32(); 660 op = machine()->ChangeFloat64ToUint32();
661 } else if (use_info.truncation().IsUsedAsWord32()) { 661 } else if (use_info.truncation().IsUsedAsWord32()) {
662 op = machine()->TruncateFloat64ToWord32(); 662 op = machine()->TruncateFloat64ToWord32();
663 } else { 663 } else {
664 return TypeError(node, output_rep, output_type, 664 return TypeError(node, output_rep, output_type,
665 MachineRepresentation::kWord32); 665 MachineRepresentation::kWord32);
666 } 666 }
667 } else if (output_rep == MachineRepresentation::kTaggedSigned) { 667 } else if (output_rep == MachineRepresentation::kTaggedSigned) {
(...skipping 11 matching lines...) Expand all
679 } 679 }
680 } else if (output_rep == MachineRepresentation::kTagged || 680 } else if (output_rep == MachineRepresentation::kTagged ||
681 output_rep == MachineRepresentation::kTaggedPointer) { 681 output_rep == MachineRepresentation::kTaggedPointer) {
682 if (output_type->Is(Type::Signed32())) { 682 if (output_type->Is(Type::Signed32())) {
683 op = simplified()->ChangeTaggedToInt32(); 683 op = simplified()->ChangeTaggedToInt32();
684 } else if (use_info.type_check() == TypeCheckKind::kSignedSmall) { 684 } else if (use_info.type_check() == TypeCheckKind::kSignedSmall) {
685 op = simplified()->CheckedTaggedSignedToInt32(); 685 op = simplified()->CheckedTaggedSignedToInt32();
686 } else if (use_info.type_check() == TypeCheckKind::kSigned32) { 686 } else if (use_info.type_check() == TypeCheckKind::kSigned32) {
687 op = simplified()->CheckedTaggedToInt32( 687 op = simplified()->CheckedTaggedToInt32(
688 output_type->Maybe(Type::MinusZero()) 688 output_type->Maybe(Type::MinusZero())
689 ? CheckForMinusZeroMode::kCheckForMinusZero 689 ? use_info.minus_zero_check()
690 : CheckForMinusZeroMode::kDontCheckForMinusZero); 690 : CheckForMinusZeroMode::kDontCheckForMinusZero);
691 } else if (output_type->Is(Type::Unsigned32())) { 691 } else if (output_type->Is(Type::Unsigned32())) {
692 op = simplified()->ChangeTaggedToUint32(); 692 op = simplified()->ChangeTaggedToUint32();
693 } else if (use_info.truncation().IsUsedAsWord32()) { 693 } else if (use_info.truncation().IsUsedAsWord32()) {
694 if (output_type->Is(Type::NumberOrOddball())) { 694 if (output_type->Is(Type::NumberOrOddball())) {
695 op = simplified()->TruncateTaggedToWord32(); 695 op = simplified()->TruncateTaggedToWord32();
696 } else if (use_info.type_check() != TypeCheckKind::kNone) { 696 } else if (use_info.type_check() != TypeCheckKind::kNone) {
697 op = simplified()->CheckedTruncateTaggedToWord32(); 697 op = simplified()->CheckedTruncateTaggedToWord32();
698 } else { 698 } else {
699 return TypeError(node, output_rep, output_type, 699 return TypeError(node, output_rep, output_type,
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 node); 1097 node);
1098 } 1098 }
1099 1099
1100 Node* RepresentationChanger::InsertChangeUint32ToFloat64(Node* node) { 1100 Node* RepresentationChanger::InsertChangeUint32ToFloat64(Node* node) {
1101 return jsgraph()->graph()->NewNode(machine()->ChangeUint32ToFloat64(), node); 1101 return jsgraph()->graph()->NewNode(machine()->ChangeUint32ToFloat64(), node);
1102 } 1102 }
1103 1103
1104 } // namespace compiler 1104 } // namespace compiler
1105 } // namespace internal 1105 } // namespace internal
1106 } // namespace v8 1106 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/representation-change.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698