| 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/js-typed-lowering.h" | 5 #include "src/compiler/js-typed-lowering.h" |
| 6 | 6 |
| 7 #include "src/builtins/builtins-utils.h" | 7 #include "src/builtins/builtins-utils.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/compilation-dependencies.h" | 9 #include "src/compilation-dependencies.h" |
| 10 #include "src/compiler/access-builder.h" | 10 #include "src/compiler/access-builder.h" |
| (...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 Reduction JSTypedLowering::ReduceJSToLength(Node* node) { | 952 Reduction JSTypedLowering::ReduceJSToLength(Node* node) { |
| 953 Node* input = NodeProperties::GetValueInput(node, 0); | 953 Node* input = NodeProperties::GetValueInput(node, 0); |
| 954 Type* input_type = NodeProperties::GetType(input); | 954 Type* input_type = NodeProperties::GetType(input); |
| 955 if (input_type->Is(type_cache_.kIntegerOrMinusZero)) { | 955 if (input_type->Is(type_cache_.kIntegerOrMinusZero)) { |
| 956 if (input_type->Max() <= 0.0) { | 956 if (input_type->Max() <= 0.0) { |
| 957 input = jsgraph()->ZeroConstant(); | 957 input = jsgraph()->ZeroConstant(); |
| 958 } else if (input_type->Min() >= kMaxSafeInteger) { | 958 } else if (input_type->Min() >= kMaxSafeInteger) { |
| 959 input = jsgraph()->Constant(kMaxSafeInteger); | 959 input = jsgraph()->Constant(kMaxSafeInteger); |
| 960 } else { | 960 } else { |
| 961 if (input_type->Min() <= 0.0) { | 961 if (input_type->Min() <= 0.0) { |
| 962 input = graph()->NewNode( | 962 input = graph()->NewNode(simplified()->NumberMax(), |
| 963 common()->Select(MachineRepresentation::kTagged), | 963 jsgraph()->ZeroConstant(), input); |
| 964 graph()->NewNode(simplified()->NumberLessThanOrEqual(), input, | |
| 965 jsgraph()->ZeroConstant()), | |
| 966 jsgraph()->ZeroConstant(), input); | |
| 967 input_type = Type::Range(0.0, input_type->Max(), graph()->zone()); | |
| 968 NodeProperties::SetType(input, input_type); | |
| 969 } | 964 } |
| 970 if (input_type->Max() > kMaxSafeInteger) { | 965 if (input_type->Max() > kMaxSafeInteger) { |
| 971 input = graph()->NewNode( | 966 input = graph()->NewNode(simplified()->NumberMin(), |
| 972 common()->Select(MachineRepresentation::kTagged), | 967 jsgraph()->Constant(kMaxSafeInteger), input); |
| 973 graph()->NewNode(simplified()->NumberLessThanOrEqual(), | |
| 974 jsgraph()->Constant(kMaxSafeInteger), input), | |
| 975 jsgraph()->Constant(kMaxSafeInteger), input); | |
| 976 input_type = | |
| 977 Type::Range(input_type->Min(), kMaxSafeInteger, graph()->zone()); | |
| 978 NodeProperties::SetType(input, input_type); | |
| 979 } | 968 } |
| 980 } | 969 } |
| 981 ReplaceWithValue(node, input); | 970 ReplaceWithValue(node, input); |
| 982 return Replace(input); | 971 return Replace(input); |
| 983 } | 972 } |
| 984 return NoChange(); | 973 return NoChange(); |
| 985 } | 974 } |
| 986 | 975 |
| 987 Reduction JSTypedLowering::ReduceJSToNumberInput(Node* input) { | 976 Reduction JSTypedLowering::ReduceJSToNumberInput(Node* input) { |
| 988 // Try constant-folding of JSToNumber with constant inputs. | 977 // Try constant-folding of JSToNumber with constant inputs. |
| (...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2148 } | 2137 } |
| 2149 | 2138 |
| 2150 | 2139 |
| 2151 CompilationDependencies* JSTypedLowering::dependencies() const { | 2140 CompilationDependencies* JSTypedLowering::dependencies() const { |
| 2152 return dependencies_; | 2141 return dependencies_; |
| 2153 } | 2142 } |
| 2154 | 2143 |
| 2155 } // namespace compiler | 2144 } // namespace compiler |
| 2156 } // namespace internal | 2145 } // namespace internal |
| 2157 } // namespace v8 | 2146 } // namespace v8 |
| OLD | NEW |