| OLD | NEW |
| 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/address-map.h" | 9 #include "src/address-map.h" |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 // Compute the representation. | 815 // Compute the representation. |
| 816 Type* type = TypeOf(node); | 816 Type* type = TypeOf(node); |
| 817 if (type->Is(Type::None())) { | 817 if (type->Is(Type::None())) { |
| 818 return MachineRepresentation::kNone; | 818 return MachineRepresentation::kNone; |
| 819 } else if (type->Is(Type::Signed32()) || type->Is(Type::Unsigned32())) { | 819 } else if (type->Is(Type::Signed32()) || type->Is(Type::Unsigned32())) { |
| 820 return MachineRepresentation::kWord32; | 820 return MachineRepresentation::kWord32; |
| 821 } else if (use.IsUsedAsWord32()) { | 821 } else if (use.IsUsedAsWord32()) { |
| 822 return MachineRepresentation::kWord32; | 822 return MachineRepresentation::kWord32; |
| 823 } else if (type->Is(Type::Boolean())) { | 823 } else if (type->Is(Type::Boolean())) { |
| 824 return MachineRepresentation::kBit; | 824 return MachineRepresentation::kBit; |
| 825 } else if (use.IsUsedAsFloat64()) { |
| 826 return MachineRepresentation::kFloat64; |
| 827 } else if (type->Is( |
| 828 Type::Union(Type::SignedSmall(), Type::NaN(), zone()))) { |
| 829 // TODO(turbofan): For Phis that return either NaN or some Smi, it's |
| 830 // beneficial to not go all the way to double, unless the uses are |
| 831 // double uses. For tagging that just means some potentially expensive |
| 832 // allocation code; we might want to do the same for -0 as well? |
| 833 return MachineRepresentation::kTagged; |
| 825 } else if (type->Is(Type::Number())) { | 834 } else if (type->Is(Type::Number())) { |
| 826 return MachineRepresentation::kFloat64; | 835 return MachineRepresentation::kFloat64; |
| 827 } else if (use.IsUsedAsFloat64()) { | |
| 828 return MachineRepresentation::kFloat64; | |
| 829 } else if (type->Is(Type::Internal())) { | 836 } else if (type->Is(Type::Internal())) { |
| 830 // We mark (u)int64 as Type::Internal. | 837 // We mark (u)int64 as Type::Internal. |
| 831 // TODO(jarin) This is a workaround for our lack of (u)int64 | 838 // TODO(jarin) This is a workaround for our lack of (u)int64 |
| 832 // types. This can be removed once we can represent (u)int64 | 839 // types. This can be removed once we can represent (u)int64 |
| 833 // unambiguously. (At the moment internal objects, such as the hole, | 840 // unambiguously. (At the moment internal objects, such as the hole, |
| 834 // are also Type::Internal()). | 841 // are also Type::Internal()). |
| 835 bool is_word64 = GetInfo(node->InputAt(0))->representation() == | 842 bool is_word64 = GetInfo(node->InputAt(0))->representation() == |
| 836 MachineRepresentation::kWord64; | 843 MachineRepresentation::kWord64; |
| 837 #ifdef DEBUG | 844 #ifdef DEBUG |
| 838 // Check that all the inputs agree on being Word64. | 845 // Check that all the inputs agree on being Word64. |
| (...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1929 jsgraph_->isolate(), jsgraph_->zone(), callable.descriptor(), 0, | 1936 jsgraph_->isolate(), jsgraph_->zone(), callable.descriptor(), 0, |
| 1930 flags, properties); | 1937 flags, properties); |
| 1931 node->InsertInput(jsgraph_->zone(), 0, | 1938 node->InsertInput(jsgraph_->zone(), 0, |
| 1932 jsgraph_->HeapConstant(callable.code())); | 1939 jsgraph_->HeapConstant(callable.code())); |
| 1933 node->AppendInput(jsgraph_->zone(), jsgraph_->NoContextConstant()); | 1940 node->AppendInput(jsgraph_->zone(), jsgraph_->NoContextConstant()); |
| 1934 node->AppendInput(jsgraph_->zone(), jsgraph_->graph()->start()); | 1941 node->AppendInput(jsgraph_->zone(), jsgraph_->graph()->start()); |
| 1935 NodeProperties::ChangeOp(node, jsgraph_->common()->Call(desc)); | 1942 NodeProperties::ChangeOp(node, jsgraph_->common()->Call(desc)); |
| 1936 } | 1943 } |
| 1937 return; | 1944 return; |
| 1938 } | 1945 } |
| 1946 case IrOpcode::kStringCharCodeAt: { |
| 1947 VisitBinop(node, UseInfo::AnyTagged(), UseInfo::TruncatingWord32(), |
| 1948 MachineRepresentation::kWord32); |
| 1949 return; |
| 1950 } |
| 1939 case IrOpcode::kStringFromCharCode: { | 1951 case IrOpcode::kStringFromCharCode: { |
| 1940 VisitUnop(node, UseInfo::TruncatingWord32(), | 1952 VisitUnop(node, UseInfo::TruncatingWord32(), |
| 1941 MachineRepresentation::kTagged); | 1953 MachineRepresentation::kTagged); |
| 1942 return; | 1954 return; |
| 1943 } | 1955 } |
| 1944 | 1956 |
| 1945 case IrOpcode::kCheckBounds: { | 1957 case IrOpcode::kCheckBounds: { |
| 1946 if (TypeOf(node->InputAt(0))->Is(Type::Unsigned32())) { | 1958 if (TypeOf(node->InputAt(0))->Is(Type::Unsigned32())) { |
| 1947 VisitBinop(node, UseInfo::TruncatingWord32(), | 1959 VisitBinop(node, UseInfo::TruncatingWord32(), |
| 1948 MachineRepresentation::kWord32); | 1960 MachineRepresentation::kWord32); |
| (...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3501 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3513 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
| 3502 Operator::kNoProperties); | 3514 Operator::kNoProperties); |
| 3503 to_number_operator_.set(common()->Call(desc)); | 3515 to_number_operator_.set(common()->Call(desc)); |
| 3504 } | 3516 } |
| 3505 return to_number_operator_.get(); | 3517 return to_number_operator_.get(); |
| 3506 } | 3518 } |
| 3507 | 3519 |
| 3508 } // namespace compiler | 3520 } // namespace compiler |
| 3509 } // namespace internal | 3521 } // namespace internal |
| 3510 } // namespace v8 | 3522 } // namespace v8 |
| OLD | NEW |