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 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.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 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1506 Node* value = graph()->NewNode(simplified()->NumberEqual(), diff, | 1506 Node* value = graph()->NewNode(simplified()->NumberEqual(), diff, |
1507 jsgraph()->ZeroConstant()); | 1507 jsgraph()->ZeroConstant()); |
1508 return Replace(value); | 1508 return Replace(value); |
1509 } | 1509 } |
1510 return NoChange(); | 1510 return NoChange(); |
1511 } | 1511 } |
1512 | 1512 |
1513 // ES6 section 20.1.2.4 Number.isNaN ( number ) | 1513 // ES6 section 20.1.2.4 Number.isNaN ( number ) |
1514 Reduction JSBuiltinReducer::ReduceNumberIsNaN(Node* node) { | 1514 Reduction JSBuiltinReducer::ReduceNumberIsNaN(Node* node) { |
1515 JSCallReduction r(node); | 1515 JSCallReduction r(node); |
| 1516 if (r.InputsMatchZero()) { |
| 1517 // Number.isNaN() -> #false |
| 1518 Node* value = jsgraph()->FalseConstant(); |
| 1519 return Replace(value); |
| 1520 } |
1516 // Number.isNaN(a:number) -> ObjectIsNaN(a) | 1521 // Number.isNaN(a:number) -> ObjectIsNaN(a) |
1517 Node* input = r.GetJSCallInput(0); | 1522 Node* input = r.GetJSCallInput(0); |
1518 Node* value = graph()->NewNode(simplified()->ObjectIsNaN(), input); | 1523 Node* value = graph()->NewNode(simplified()->ObjectIsNaN(), input); |
1519 return Replace(value); | 1524 return Replace(value); |
1520 } | 1525 } |
1521 | 1526 |
1522 // ES6 section 20.1.2.5 Number.isSafeInteger ( number ) | 1527 // ES6 section 20.1.2.5 Number.isSafeInteger ( number ) |
1523 Reduction JSBuiltinReducer::ReduceNumberIsSafeInteger(Node* node) { | 1528 Reduction JSBuiltinReducer::ReduceNumberIsSafeInteger(Node* node) { |
1524 JSCallReduction r(node); | 1529 JSCallReduction r(node); |
1525 if (r.InputsMatchOne(type_cache_.kSafeInteger)) { | 1530 if (r.InputsMatchOne(type_cache_.kSafeInteger)) { |
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2274 return jsgraph()->simplified(); | 2279 return jsgraph()->simplified(); |
2275 } | 2280 } |
2276 | 2281 |
2277 JSOperatorBuilder* JSBuiltinReducer::javascript() const { | 2282 JSOperatorBuilder* JSBuiltinReducer::javascript() const { |
2278 return jsgraph()->javascript(); | 2283 return jsgraph()->javascript(); |
2279 } | 2284 } |
2280 | 2285 |
2281 } // namespace compiler | 2286 } // namespace compiler |
2282 } // namespace internal | 2287 } // namespace internal |
2283 } // namespace v8 | 2288 } // namespace v8 |
OLD | NEW |