Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/compiler/js-builtin-reducer.cc

Issue 2722483003: [turbofan] Introduce dedicated ObjectIsNaN operator. (Closed)
Patch Set: Use GetUpperBound. Add test cases. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/effect-control-linearizer.cc ('k') | src/compiler/js-typed-lowering.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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.InputsMatchOne(Type::Number())) { 1516 // Number.isNaN(a:number) -> ObjectIsNaN(a)
1517 // Number.isNaN(a:number) -> BooleanNot(NumberEqual(a, a)) 1517 Node* input = r.GetJSCallInput(0);
1518 Node* input = r.GetJSCallInput(0); 1518 Node* value = graph()->NewNode(simplified()->ObjectIsNaN(), input);
1519 Node* check = graph()->NewNode(simplified()->NumberEqual(), input, input); 1519 return Replace(value);
1520 Node* value = graph()->NewNode(simplified()->BooleanNot(), check);
1521 return Replace(value);
1522 }
1523 return NoChange();
1524 } 1520 }
1525 1521
1526 // ES6 section 20.1.2.5 Number.isSafeInteger ( number ) 1522 // ES6 section 20.1.2.5 Number.isSafeInteger ( number )
1527 Reduction JSBuiltinReducer::ReduceNumberIsSafeInteger(Node* node) { 1523 Reduction JSBuiltinReducer::ReduceNumberIsSafeInteger(Node* node) {
1528 JSCallReduction r(node); 1524 JSCallReduction r(node);
1529 if (r.InputsMatchOne(type_cache_.kSafeInteger)) { 1525 if (r.InputsMatchOne(type_cache_.kSafeInteger)) {
1530 // Number.isInteger(x:safe-integer) -> #true 1526 // Number.isInteger(x:safe-integer) -> #true
1531 Node* value = jsgraph()->TrueConstant(); 1527 Node* value = jsgraph()->TrueConstant();
1532 return Replace(value); 1528 return Replace(value);
1533 } 1529 }
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
2278 return jsgraph()->simplified(); 2274 return jsgraph()->simplified();
2279 } 2275 }
2280 2276
2281 JSOperatorBuilder* JSBuiltinReducer::javascript() const { 2277 JSOperatorBuilder* JSBuiltinReducer::javascript() const {
2282 return jsgraph()->javascript(); 2278 return jsgraph()->javascript();
2283 } 2279 }
2284 2280
2285 } // namespace compiler 2281 } // namespace compiler
2286 } // namespace internal 2282 } // namespace internal
2287 } // namespace v8 2283 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/effect-control-linearizer.cc ('k') | src/compiler/js-typed-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698