| 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/ast/modules.h" | 7 #include "src/ast/modules.h" |
| 8 #include "src/builtins/builtins-utils.h" | 8 #include "src/builtins/builtins-utils.h" |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/compilation-dependencies.h" | 10 #include "src/compilation-dependencies.h" |
| (...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 978 Node* const input = NodeProperties::GetValueInput(node, 0); | 978 Node* const input = NodeProperties::GetValueInput(node, 0); |
| 979 Type* const input_type = NodeProperties::GetType(input); | 979 Type* const input_type = NodeProperties::GetType(input); |
| 980 if (input_type->Is(type_cache_.kIntegerOrMinusZero)) { | 980 if (input_type->Is(type_cache_.kIntegerOrMinusZero)) { |
| 981 // JSToInteger(x:integer) => x | 981 // JSToInteger(x:integer) => x |
| 982 ReplaceWithValue(node, input); | 982 ReplaceWithValue(node, input); |
| 983 return Replace(input); | 983 return Replace(input); |
| 984 } | 984 } |
| 985 return NoChange(); | 985 return NoChange(); |
| 986 } | 986 } |
| 987 | 987 |
| 988 Reduction JSTypedLowering::ReduceJSToName(Node* node) { |
| 989 Node* const input = NodeProperties::GetValueInput(node, 0); |
| 990 Type* const input_type = NodeProperties::GetType(input); |
| 991 if (input_type->Is(Type::Name())) { |
| 992 // JSToName(x:name) => x |
| 993 ReplaceWithValue(node, input); |
| 994 return Replace(input); |
| 995 } |
| 996 return NoChange(); |
| 997 } |
| 998 |
| 988 Reduction JSTypedLowering::ReduceJSToLength(Node* node) { | 999 Reduction JSTypedLowering::ReduceJSToLength(Node* node) { |
| 989 Node* input = NodeProperties::GetValueInput(node, 0); | 1000 Node* input = NodeProperties::GetValueInput(node, 0); |
| 990 Type* input_type = NodeProperties::GetType(input); | 1001 Type* input_type = NodeProperties::GetType(input); |
| 991 if (input_type->Is(type_cache_.kIntegerOrMinusZero)) { | 1002 if (input_type->Is(type_cache_.kIntegerOrMinusZero)) { |
| 992 if (input_type->Max() <= 0.0) { | 1003 if (input_type->Max() <= 0.0) { |
| 993 input = jsgraph()->ZeroConstant(); | 1004 input = jsgraph()->ZeroConstant(); |
| 994 } else if (input_type->Min() >= kMaxSafeInteger) { | 1005 } else if (input_type->Min() >= kMaxSafeInteger) { |
| 995 input = jsgraph()->Constant(kMaxSafeInteger); | 1006 input = jsgraph()->Constant(kMaxSafeInteger); |
| 996 } else { | 1007 } else { |
| 997 if (input_type->Min() <= 0.0) { | 1008 if (input_type->Min() <= 0.0) { |
| (...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2186 case IrOpcode::kJSMultiply: | 2197 case IrOpcode::kJSMultiply: |
| 2187 case IrOpcode::kJSDivide: | 2198 case IrOpcode::kJSDivide: |
| 2188 case IrOpcode::kJSModulus: | 2199 case IrOpcode::kJSModulus: |
| 2189 return ReduceNumberBinop(node); | 2200 return ReduceNumberBinop(node); |
| 2190 case IrOpcode::kJSToBoolean: | 2201 case IrOpcode::kJSToBoolean: |
| 2191 return ReduceJSToBoolean(node); | 2202 return ReduceJSToBoolean(node); |
| 2192 case IrOpcode::kJSToInteger: | 2203 case IrOpcode::kJSToInteger: |
| 2193 return ReduceJSToInteger(node); | 2204 return ReduceJSToInteger(node); |
| 2194 case IrOpcode::kJSToLength: | 2205 case IrOpcode::kJSToLength: |
| 2195 return ReduceJSToLength(node); | 2206 return ReduceJSToLength(node); |
| 2207 case IrOpcode::kJSToName: |
| 2208 return ReduceJSToName(node); |
| 2196 case IrOpcode::kJSToNumber: | 2209 case IrOpcode::kJSToNumber: |
| 2197 return ReduceJSToNumber(node); | 2210 return ReduceJSToNumber(node); |
| 2198 case IrOpcode::kJSToString: | 2211 case IrOpcode::kJSToString: |
| 2199 return ReduceJSToString(node); | 2212 return ReduceJSToString(node); |
| 2200 case IrOpcode::kJSToObject: | 2213 case IrOpcode::kJSToObject: |
| 2201 return ReduceJSToObject(node); | 2214 return ReduceJSToObject(node); |
| 2202 case IrOpcode::kJSTypeOf: | 2215 case IrOpcode::kJSTypeOf: |
| 2203 return ReduceJSTypeOf(node); | 2216 return ReduceJSTypeOf(node); |
| 2204 case IrOpcode::kJSLoadNamed: | 2217 case IrOpcode::kJSLoadNamed: |
| 2205 return ReduceJSLoadNamed(node); | 2218 return ReduceJSLoadNamed(node); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2261 } | 2274 } |
| 2262 | 2275 |
| 2263 | 2276 |
| 2264 CompilationDependencies* JSTypedLowering::dependencies() const { | 2277 CompilationDependencies* JSTypedLowering::dependencies() const { |
| 2265 return dependencies_; | 2278 return dependencies_; |
| 2266 } | 2279 } |
| 2267 | 2280 |
| 2268 } // namespace compiler | 2281 } // namespace compiler |
| 2269 } // namespace internal | 2282 } // namespace internal |
| 2270 } // namespace v8 | 2283 } // namespace v8 |
| OLD | NEW |