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

Side by Side Diff: src/compiler/typer.cc

Issue 2309953002: [turbofan] Introduce dedicated NumberToBoolean operator. (Closed)
Patch Set: Fix unittest. Created 4 years, 3 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/simplified-operator.cc ('k') | src/compiler/verifier.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/typer.h" 5 #include "src/compiler/typer.h"
6 6
7 #include <iomanip> 7 #include <iomanip>
8 8
9 #include "src/base/flags.h" 9 #include "src/base/flags.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 return type; 416 return type;
417 } 417 }
418 return Type::Primitive(); 418 return Type::Primitive();
419 } 419 }
420 420
421 421
422 Type* Typer::Visitor::ToBoolean(Type* type, Typer* t) { 422 Type* Typer::Visitor::ToBoolean(Type* type, Typer* t) {
423 if (type->Is(Type::Boolean())) return type; 423 if (type->Is(Type::Boolean())) return type;
424 if (type->Is(t->falsish_)) return t->singleton_false_; 424 if (type->Is(t->falsish_)) return t->singleton_false_;
425 if (type->Is(t->truish_)) return t->singleton_true_; 425 if (type->Is(t->truish_)) return t->singleton_true_;
426 if (type->Is(Type::PlainNumber()) && (type->Max() < 0 || 0 < type->Min())) { 426 if (type->Is(Type::Number())) {
427 return t->singleton_true_; // Ruled out nan, -0 and +0. 427 return t->operation_typer()->NumberToBoolean(type);
428 } 428 }
429 return Type::Boolean(); 429 return Type::Boolean();
430 } 430 }
431 431
432 432
433 // static 433 // static
434 Type* Typer::Visitor::ToInteger(Type* type, Typer* t) { 434 Type* Typer::Visitor::ToInteger(Type* type, Typer* t) {
435 // ES6 section 7.1.4 ToInteger ( argument ) 435 // ES6 section 7.1.4 ToInteger ( argument )
436 type = ToNumber(type, t); 436 type = ToNumber(type, t);
437 if (type->Is(t->cache_.kIntegerOrMinusZero)) return type; 437 if (type->Is(t->cache_.kIntegerOrMinusZero)) return type;
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { 1703 Type* Typer::Visitor::TypeConstant(Handle<Object> value) {
1704 if (Type::IsInteger(*value)) { 1704 if (Type::IsInteger(*value)) {
1705 return Type::Range(value->Number(), value->Number(), zone()); 1705 return Type::Range(value->Number(), value->Number(), zone());
1706 } 1706 }
1707 return Type::Constant(value, zone()); 1707 return Type::Constant(value, zone());
1708 } 1708 }
1709 1709
1710 } // namespace compiler 1710 } // namespace compiler
1711 } // namespace internal 1711 } // namespace internal
1712 } // namespace v8 1712 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/simplified-operator.cc ('k') | src/compiler/verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698