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 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 if (output_type->Is(Type::None())) { | 718 if (output_type->Is(Type::None())) { |
719 // This is an impossible value; it should not be used at runtime. | 719 // This is an impossible value; it should not be used at runtime. |
720 // We just provide a dummy value here. | 720 // We just provide a dummy value here. |
721 return jsgraph()->Int32Constant(0); | 721 return jsgraph()->Int32Constant(0); |
722 } else if (output_rep == MachineRepresentation::kTagged || | 722 } else if (output_rep == MachineRepresentation::kTagged || |
723 output_rep == MachineRepresentation::kTaggedPointer) { | 723 output_rep == MachineRepresentation::kTaggedPointer) { |
724 if (output_type->Is(Type::BooleanOrNullOrUndefined())) { | 724 if (output_type->Is(Type::BooleanOrNullOrUndefined())) { |
725 // true is the only trueish Oddball. | 725 // true is the only trueish Oddball. |
726 op = simplified()->ChangeTaggedToBit(); | 726 op = simplified()->ChangeTaggedToBit(); |
727 } else { | 727 } else { |
728 op = simplified()->TruncateTaggedToBit(); | 728 if (output_rep == MachineRepresentation::kTagged && |
| 729 output_type->Maybe(Type::SignedSmall())) { |
| 730 op = simplified()->TruncateTaggedToBit(); |
| 731 } else { |
| 732 // The {output_type} either doesn't include the Smi range, |
| 733 // or the {output_rep} is known to be TaggedPointer. |
| 734 op = simplified()->TruncateTaggedPointerToBit(); |
| 735 } |
729 } | 736 } |
730 } else if (output_rep == MachineRepresentation::kTaggedSigned) { | 737 } else if (output_rep == MachineRepresentation::kTaggedSigned) { |
731 node = jsgraph()->graph()->NewNode(machine()->WordEqual(), node, | 738 node = jsgraph()->graph()->NewNode(machine()->WordEqual(), node, |
732 jsgraph()->IntPtrConstant(0)); | 739 jsgraph()->IntPtrConstant(0)); |
733 return jsgraph()->graph()->NewNode(machine()->Word32Equal(), node, | 740 return jsgraph()->graph()->NewNode(machine()->Word32Equal(), node, |
734 jsgraph()->Int32Constant(0)); | 741 jsgraph()->Int32Constant(0)); |
735 } else if (IsWord(output_rep)) { | 742 } else if (IsWord(output_rep)) { |
736 node = jsgraph()->graph()->NewNode(machine()->Word32Equal(), node, | 743 node = jsgraph()->graph()->NewNode(machine()->Word32Equal(), node, |
737 jsgraph()->Int32Constant(0)); | 744 jsgraph()->Int32Constant(0)); |
738 return jsgraph()->graph()->NewNode(machine()->Word32Equal(), node, | 745 return jsgraph()->graph()->NewNode(machine()->Word32Equal(), node, |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 node); | 1045 node); |
1039 } | 1046 } |
1040 | 1047 |
1041 Node* RepresentationChanger::InsertChangeUint32ToFloat64(Node* node) { | 1048 Node* RepresentationChanger::InsertChangeUint32ToFloat64(Node* node) { |
1042 return jsgraph()->graph()->NewNode(machine()->ChangeUint32ToFloat64(), node); | 1049 return jsgraph()->graph()->NewNode(machine()->ChangeUint32ToFloat64(), node); |
1043 } | 1050 } |
1044 | 1051 |
1045 } // namespace compiler | 1052 } // namespace compiler |
1046 } // namespace internal | 1053 } // namespace internal |
1047 } // namespace v8 | 1054 } // namespace v8 |
OLD | NEW |