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-builtin-reducer.h" | 5 #include "src/compiler/js-builtin-reducer.h" |
6 #include "src/compiler/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
7 #include "src/compiler/node-matchers.h" | 7 #include "src/compiler/node-matchers.h" |
8 #include "src/compiler/node-properties.h" | 8 #include "src/compiler/node-properties.h" |
9 #include "src/compiler/simplified-operator.h" | 9 #include "src/compiler/simplified-operator.h" |
10 #include "src/objects-inl.h" | 10 #include "src/objects-inl.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 // Math.floor(a:number) -> NumberFloor(a) | 165 // Math.floor(a:number) -> NumberFloor(a) |
166 Node* value = graph()->NewNode(simplified()->NumberFloor(), r.left()); | 166 Node* value = graph()->NewNode(simplified()->NumberFloor(), r.left()); |
167 return Replace(value); | 167 return Replace(value); |
168 } | 168 } |
169 return NoChange(); | 169 return NoChange(); |
170 } | 170 } |
171 | 171 |
172 // ES6 draft 08-24-14, section 20.2.2.17. | 172 // ES6 draft 08-24-14, section 20.2.2.17. |
173 Reduction JSBuiltinReducer::ReduceMathFround(Node* node) { | 173 Reduction JSBuiltinReducer::ReduceMathFround(Node* node) { |
174 JSCallReduction r(node); | 174 JSCallReduction r(node); |
175 if (r.InputsMatchOne(Type::Number())) { | 175 if (r.InputsMatchOne(Type::NumberOrUndefined())) { |
176 // Math.fround(a:number) -> TruncateFloat64ToFloat32(a) | 176 // Math.fround(a:number) -> TruncateFloat64ToFloat32(a) |
177 Node* value = | 177 Node* value = |
178 graph()->NewNode(machine()->TruncateFloat64ToFloat32(), r.left()); | 178 graph()->NewNode(machine()->TruncateFloat64ToFloat32(), r.left()); |
179 return Replace(value); | 179 return Replace(value); |
180 } | 180 } |
181 return NoChange(); | 181 return NoChange(); |
182 } | 182 } |
183 | 183 |
184 // ES6 section 20.2.2.28 Math.round ( x ) | 184 // ES6 section 20.2.2.28 Math.round ( x ) |
185 Reduction JSBuiltinReducer::ReduceMathRound(Node* node) { | 185 Reduction JSBuiltinReducer::ReduceMathRound(Node* node) { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 } | 276 } |
277 | 277 |
278 | 278 |
279 SimplifiedOperatorBuilder* JSBuiltinReducer::simplified() const { | 279 SimplifiedOperatorBuilder* JSBuiltinReducer::simplified() const { |
280 return jsgraph()->simplified(); | 280 return jsgraph()->simplified(); |
281 } | 281 } |
282 | 282 |
283 } // namespace compiler | 283 } // namespace compiler |
284 } // namespace internal | 284 } // namespace internal |
285 } // namespace v8 | 285 } // namespace v8 |
OLD | NEW |