| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   277   SIMPLIFIED_NUMBER_UNOP_LIST(DECLARE_METHOD) |   277   SIMPLIFIED_NUMBER_UNOP_LIST(DECLARE_METHOD) | 
|   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* ObjectIsCallable(Type*, Typer*); |   287   static Type* ObjectIsDetectableCallable(Type*, Typer*); | 
|   288   static Type* ObjectIsNonCallable(Type*, Typer*); |   288   static Type* ObjectIsNonCallable(Type*, Typer*); | 
|   289   static Type* ObjectIsNumber(Type*, Typer*); |   289   static Type* ObjectIsNumber(Type*, Typer*); | 
|   290   static Type* ObjectIsReceiver(Type*, Typer*); |   290   static Type* ObjectIsReceiver(Type*, Typer*); | 
|   291   static Type* ObjectIsSmi(Type*, Typer*); |   291   static Type* ObjectIsSmi(Type*, Typer*); | 
|   292   static Type* ObjectIsString(Type*, Typer*); |   292   static Type* ObjectIsString(Type*, Typer*); | 
|   293   static Type* ObjectIsUndetectable(Type*, Typer*); |   293   static Type* ObjectIsUndetectable(Type*, Typer*); | 
|   294  |   294  | 
|   295   static ComparisonOutcome JSCompareTyper(Type*, Type*, Typer*); |   295   static ComparisonOutcome JSCompareTyper(Type*, Type*, Typer*); | 
|   296  |   296  | 
|   297 #define DECLARE_METHOD(x) static Type* x##Typer(Type*, Type*, Typer*); |   297 #define DECLARE_METHOD(x) static Type* x##Typer(Type*, Type*, Typer*); | 
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   496 // static |   496 // static | 
|   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::ObjectIsDetectableCallable(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 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1894 Type* Typer::Visitor::TypeStoreElement(Node* node) { |  1894 Type* Typer::Visitor::TypeStoreElement(Node* node) { | 
|  1895   UNREACHABLE(); |  1895   UNREACHABLE(); | 
|  1896   return nullptr; |  1896   return nullptr; | 
|  1897 } |  1897 } | 
|  1898  |  1898  | 
|  1899 Type* Typer::Visitor::TypeStoreTypedElement(Node* node) { |  1899 Type* Typer::Visitor::TypeStoreTypedElement(Node* node) { | 
|  1900   UNREACHABLE(); |  1900   UNREACHABLE(); | 
|  1901   return nullptr; |  1901   return nullptr; | 
|  1902 } |  1902 } | 
|  1903  |  1903  | 
|  1904 Type* Typer::Visitor::TypeObjectIsCallable(Node* node) { |  1904 Type* Typer::Visitor::TypeObjectIsDetectableCallable(Node* node) { | 
|  1905   return TypeUnaryOp(node, ObjectIsCallable); |  1905   return TypeUnaryOp(node, ObjectIsDetectableCallable); | 
|  1906 } |  1906 } | 
|  1907  |  1907  | 
|  1908 Type* Typer::Visitor::TypeObjectIsNonCallable(Node* node) { |  1908 Type* Typer::Visitor::TypeObjectIsNonCallable(Node* node) { | 
|  1909   return TypeUnaryOp(node, ObjectIsNonCallable); |  1909   return TypeUnaryOp(node, ObjectIsNonCallable); | 
|  1910 } |  1910 } | 
|  1911  |  1911  | 
|  1912 Type* Typer::Visitor::TypeObjectIsNumber(Node* node) { |  1912 Type* Typer::Visitor::TypeObjectIsNumber(Node* node) { | 
|  1913   return TypeUnaryOp(node, ObjectIsNumber); |  1913   return TypeUnaryOp(node, ObjectIsNumber); | 
|  1914 } |  1914 } | 
|  1915  |  1915  | 
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1948 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { |  1948 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { | 
|  1949   if (Type::IsInteger(*value)) { |  1949   if (Type::IsInteger(*value)) { | 
|  1950     return Type::Range(value->Number(), value->Number(), zone()); |  1950     return Type::Range(value->Number(), value->Number(), zone()); | 
|  1951   } |  1951   } | 
|  1952   return Type::NewConstant(value, zone()); |  1952   return Type::NewConstant(value, zone()); | 
|  1953 } |  1953 } | 
|  1954  |  1954  | 
|  1955 }  // namespace compiler |  1955 }  // namespace compiler | 
|  1956 }  // namespace internal |  1956 }  // namespace internal | 
|  1957 }  // namespace v8 |  1957 }  // namespace v8 | 
| OLD | NEW |