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/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/compilation-dependencies.h" | 8 #include "src/compilation-dependencies.h" |
9 #include "src/compiler/access-builder.h" | 9 #include "src/compiler/access-builder.h" |
10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 common()->Select(MachineRepresentation::kTagged), input, | 952 common()->Select(MachineRepresentation::kTagged), input, |
953 jsgraph()->HeapConstant(factory()->true_string()), | 953 jsgraph()->HeapConstant(factory()->true_string()), |
954 jsgraph()->HeapConstant(factory()->false_string()))); | 954 jsgraph()->HeapConstant(factory()->false_string()))); |
955 } | 955 } |
956 if (input_type->Is(Type::Undefined())) { | 956 if (input_type->Is(Type::Undefined())) { |
957 return Replace(jsgraph()->HeapConstant(factory()->undefined_string())); | 957 return Replace(jsgraph()->HeapConstant(factory()->undefined_string())); |
958 } | 958 } |
959 if (input_type->Is(Type::Null())) { | 959 if (input_type->Is(Type::Null())) { |
960 return Replace(jsgraph()->HeapConstant(factory()->null_string())); | 960 return Replace(jsgraph()->HeapConstant(factory()->null_string())); |
961 } | 961 } |
962 // TODO(turbofan): js-typed-lowering of ToString(x:number) | 962 if (input_type->Is(Type::Number())) { |
| 963 return Replace(graph()->NewNode(simplified()->NumberToString(), input, |
| 964 jsgraph()->Constant(10))); |
| 965 } |
963 return NoChange(); | 966 return NoChange(); |
964 } | 967 } |
965 | 968 |
966 | 969 |
967 Reduction JSTypedLowering::ReduceJSToString(Node* node) { | 970 Reduction JSTypedLowering::ReduceJSToString(Node* node) { |
968 // Try to reduce the input first. | 971 // Try to reduce the input first. |
969 Node* const input = node->InputAt(0); | 972 Node* const input = node->InputAt(0); |
970 Reduction reduction = ReduceJSToStringInput(input); | 973 Reduction reduction = ReduceJSToStringInput(input); |
971 if (reduction.Changed()) { | 974 if (reduction.Changed()) { |
972 ReplaceWithValue(node, reduction.replacement()); | 975 ReplaceWithValue(node, reduction.replacement()); |
(...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2114 } | 2117 } |
2115 | 2118 |
2116 | 2119 |
2117 CompilationDependencies* JSTypedLowering::dependencies() const { | 2120 CompilationDependencies* JSTypedLowering::dependencies() const { |
2118 return dependencies_; | 2121 return dependencies_; |
2119 } | 2122 } |
2120 | 2123 |
2121 } // namespace compiler | 2124 } // namespace compiler |
2122 } // namespace internal | 2125 } // namespace internal |
2123 } // namespace v8 | 2126 } // namespace v8 |
OLD | NEW |