OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |