| 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 #undef DECLARE_METHOD | 278 #undef DECLARE_METHOD |
| 279 #define DECLARE_METHOD(Name) \ | 279 #define DECLARE_METHOD(Name) \ |
| 280 static Type* Name(Type* lhs, Type* rhs, Typer* t) { \ | 280 static Type* Name(Type* lhs, Type* rhs, Typer* t) { \ |
| 281 return t->operation_typer_.Name(lhs, rhs); \ | 281 return t->operation_typer_.Name(lhs, rhs); \ |
| 282 } | 282 } |
| 283 SIMPLIFIED_NUMBER_BINOP_LIST(DECLARE_METHOD) | 283 SIMPLIFIED_NUMBER_BINOP_LIST(DECLARE_METHOD) |
| 284 SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(DECLARE_METHOD) | 284 SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(DECLARE_METHOD) |
| 285 #undef DECLARE_METHOD | 285 #undef DECLARE_METHOD |
| 286 | 286 |
| 287 static Type* ObjectIsDetectableCallable(Type*, Typer*); | 287 static Type* ObjectIsDetectableCallable(Type*, Typer*); |
| 288 static Type* ObjectIsNaN(Type*, Typer*); |
| 288 static Type* ObjectIsNonCallable(Type*, Typer*); | 289 static Type* ObjectIsNonCallable(Type*, Typer*); |
| 289 static Type* ObjectIsNumber(Type*, Typer*); | 290 static Type* ObjectIsNumber(Type*, Typer*); |
| 290 static Type* ObjectIsReceiver(Type*, Typer*); | 291 static Type* ObjectIsReceiver(Type*, Typer*); |
| 291 static Type* ObjectIsSmi(Type*, Typer*); | 292 static Type* ObjectIsSmi(Type*, Typer*); |
| 292 static Type* ObjectIsString(Type*, Typer*); | 293 static Type* ObjectIsString(Type*, Typer*); |
| 293 static Type* ObjectIsUndetectable(Type*, Typer*); | 294 static Type* ObjectIsUndetectable(Type*, Typer*); |
| 294 | 295 |
| 295 static ComparisonOutcome JSCompareTyper(Type*, Type*, Typer*); | 296 static ComparisonOutcome JSCompareTyper(Type*, Type*, Typer*); |
| 296 static ComparisonOutcome NumberCompareTyper(Type*, Type*, Typer*); | 297 static ComparisonOutcome NumberCompareTyper(Type*, Type*, Typer*); |
| 297 | 298 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 } | 506 } |
| 506 | 507 |
| 507 // Type checks. | 508 // Type checks. |
| 508 | 509 |
| 509 Type* Typer::Visitor::ObjectIsDetectableCallable(Type* type, Typer* t) { | 510 Type* Typer::Visitor::ObjectIsDetectableCallable(Type* type, Typer* t) { |
| 510 if (type->Is(Type::DetectableCallable())) return t->singleton_true_; | 511 if (type->Is(Type::DetectableCallable())) return t->singleton_true_; |
| 511 if (!type->Maybe(Type::DetectableCallable())) return t->singleton_false_; | 512 if (!type->Maybe(Type::DetectableCallable())) return t->singleton_false_; |
| 512 return Type::Boolean(); | 513 return Type::Boolean(); |
| 513 } | 514 } |
| 514 | 515 |
| 516 Type* Typer::Visitor::ObjectIsNaN(Type* type, Typer* t) { |
| 517 if (type->Is(Type::NaN())) return t->singleton_true_; |
| 518 if (!type->Maybe(Type::NaN())) return t->singleton_false_; |
| 519 return Type::Boolean(); |
| 520 } |
| 521 |
| 515 Type* Typer::Visitor::ObjectIsNonCallable(Type* type, Typer* t) { | 522 Type* Typer::Visitor::ObjectIsNonCallable(Type* type, Typer* t) { |
| 516 if (type->Is(Type::NonCallable())) return t->singleton_true_; | 523 if (type->Is(Type::NonCallable())) return t->singleton_true_; |
| 517 if (!type->Maybe(Type::NonCallable())) return t->singleton_false_; | 524 if (!type->Maybe(Type::NonCallable())) return t->singleton_false_; |
| 518 return Type::Boolean(); | 525 return Type::Boolean(); |
| 519 } | 526 } |
| 520 | 527 |
| 521 Type* Typer::Visitor::ObjectIsNumber(Type* type, Typer* t) { | 528 Type* Typer::Visitor::ObjectIsNumber(Type* type, Typer* t) { |
| 522 if (type->Is(Type::Number())) return t->singleton_true_; | 529 if (type->Is(Type::Number())) return t->singleton_true_; |
| 523 if (!type->Maybe(Type::Number())) return t->singleton_false_; | 530 if (!type->Maybe(Type::Number())) return t->singleton_false_; |
| 524 return Type::Boolean(); | 531 return Type::Boolean(); |
| (...skipping 1394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1919 | 1926 |
| 1920 Type* Typer::Visitor::TypeStoreTypedElement(Node* node) { | 1927 Type* Typer::Visitor::TypeStoreTypedElement(Node* node) { |
| 1921 UNREACHABLE(); | 1928 UNREACHABLE(); |
| 1922 return nullptr; | 1929 return nullptr; |
| 1923 } | 1930 } |
| 1924 | 1931 |
| 1925 Type* Typer::Visitor::TypeObjectIsDetectableCallable(Node* node) { | 1932 Type* Typer::Visitor::TypeObjectIsDetectableCallable(Node* node) { |
| 1926 return TypeUnaryOp(node, ObjectIsDetectableCallable); | 1933 return TypeUnaryOp(node, ObjectIsDetectableCallable); |
| 1927 } | 1934 } |
| 1928 | 1935 |
| 1936 Type* Typer::Visitor::TypeObjectIsNaN(Node* node) { |
| 1937 return TypeUnaryOp(node, ObjectIsNaN); |
| 1938 } |
| 1939 |
| 1929 Type* Typer::Visitor::TypeObjectIsNonCallable(Node* node) { | 1940 Type* Typer::Visitor::TypeObjectIsNonCallable(Node* node) { |
| 1930 return TypeUnaryOp(node, ObjectIsNonCallable); | 1941 return TypeUnaryOp(node, ObjectIsNonCallable); |
| 1931 } | 1942 } |
| 1932 | 1943 |
| 1933 Type* Typer::Visitor::TypeObjectIsNumber(Node* node) { | 1944 Type* Typer::Visitor::TypeObjectIsNumber(Node* node) { |
| 1934 return TypeUnaryOp(node, ObjectIsNumber); | 1945 return TypeUnaryOp(node, ObjectIsNumber); |
| 1935 } | 1946 } |
| 1936 | 1947 |
| 1937 | 1948 |
| 1938 Type* Typer::Visitor::TypeObjectIsReceiver(Node* node) { | 1949 Type* Typer::Visitor::TypeObjectIsReceiver(Node* node) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1973 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { | 1984 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { |
| 1974 if (Type::IsInteger(*value)) { | 1985 if (Type::IsInteger(*value)) { |
| 1975 return Type::Range(value->Number(), value->Number(), zone()); | 1986 return Type::Range(value->Number(), value->Number(), zone()); |
| 1976 } | 1987 } |
| 1977 return Type::NewConstant(value, zone()); | 1988 return Type::NewConstant(value, zone()); |
| 1978 } | 1989 } |
| 1979 | 1990 |
| 1980 } // namespace compiler | 1991 } // namespace compiler |
| 1981 } // namespace internal | 1992 } // namespace internal |
| 1982 } // namespace v8 | 1993 } // namespace v8 |
| OLD | NEW |