| 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/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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 Type* Typer::Visitor::ToString(Type* type, Typer* t) { | 497 Type* Typer::Visitor::ToString(Type* type, Typer* t) { |
| 498 // ES6 section 7.1.12 ToString ( argument ) | 498 // ES6 section 7.1.12 ToString ( argument ) |
| 499 type = ToPrimitive(type, t); | 499 type = ToPrimitive(type, t); |
| 500 if (type->Is(Type::String())) return type; | 500 if (type->Is(Type::String())) return type; |
| 501 return Type::String(); | 501 return Type::String(); |
| 502 } | 502 } |
| 503 | 503 |
| 504 // Type checks. | 504 // Type checks. |
| 505 | 505 |
| 506 Type* Typer::Visitor::ObjectIsCallable(Type* type, Typer* t) { | 506 Type* Typer::Visitor::ObjectIsCallable(Type* type, Typer* t) { |
| 507 if (type->Is(Type::Callable())) return t->singleton_true_; | 507 if (type->Is(Type::DetectableCallable())) return t->singleton_true_; |
| 508 if (!type->Maybe(Type::Callable())) return t->singleton_false_; | 508 if (!type->Maybe(Type::DetectableCallable())) return t->singleton_false_; |
| 509 return Type::Boolean(); | 509 return Type::Boolean(); |
| 510 } | 510 } |
| 511 | 511 |
| 512 Type* Typer::Visitor::ObjectIsNonCallable(Type* type, Typer* t) { | 512 Type* Typer::Visitor::ObjectIsNonCallable(Type* type, Typer* t) { |
| 513 if (type->Is(Type::NonCallable())) return t->singleton_true_; | 513 if (type->Is(Type::NonCallable())) return t->singleton_true_; |
| 514 if (!type->Maybe(Type::NonCallable())) return t->singleton_false_; | 514 if (!type->Maybe(Type::NonCallable())) return t->singleton_false_; |
| 515 return Type::Boolean(); | 515 return Type::Boolean(); |
| 516 } | 516 } |
| 517 | 517 |
| 518 Type* Typer::Visitor::ObjectIsNumber(Type* type, Typer* t) { | 518 Type* Typer::Visitor::ObjectIsNumber(Type* type, Typer* t) { |
| (...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1943 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { | 1943 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { |
| 1944 if (Type::IsInteger(*value)) { | 1944 if (Type::IsInteger(*value)) { |
| 1945 return Type::Range(value->Number(), value->Number(), zone()); | 1945 return Type::Range(value->Number(), value->Number(), zone()); |
| 1946 } | 1946 } |
| 1947 return Type::NewConstant(value, zone()); | 1947 return Type::NewConstant(value, zone()); |
| 1948 } | 1948 } |
| 1949 | 1949 |
| 1950 } // namespace compiler | 1950 } // namespace compiler |
| 1951 } // namespace internal | 1951 } // namespace internal |
| 1952 } // namespace v8 | 1952 } // namespace v8 |
| OLD | NEW |