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 1633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1644 // have a few weird runtime calls that return the hole or even FixedArrays; | 1644 // have a few weird runtime calls that return the hole or even FixedArrays; |
1645 // change this once those weird runtime calls have been removed. | 1645 // change this once those weird runtime calls have been removed. |
1646 return Type::Any(); | 1646 return Type::Any(); |
1647 } | 1647 } |
1648 | 1648 |
1649 | 1649 |
1650 Type* Typer::Visitor::TypeJSConvertReceiver(Node* node) { | 1650 Type* Typer::Visitor::TypeJSConvertReceiver(Node* node) { |
1651 return Type::Receiver(); | 1651 return Type::Receiver(); |
1652 } | 1652 } |
1653 | 1653 |
| 1654 Type* Typer::Visitor::TypeJSForInHasOwnProperty(Node* node) { |
| 1655 return Type::Boolean(); |
| 1656 } |
| 1657 |
| 1658 Type* Typer::Visitor::TypeJSForInLoadProperty(Node* node) { |
| 1659 return Type::NonInternal(); |
| 1660 } |
1654 | 1661 |
1655 Type* Typer::Visitor::TypeJSForInNext(Node* node) { | 1662 Type* Typer::Visitor::TypeJSForInNext(Node* node) { |
1656 return Type::Union(Type::String(), Type::Undefined(), zone()); | 1663 return Type::StringOrUndefined(); |
1657 } | 1664 } |
1658 | 1665 |
1659 | 1666 |
1660 Type* Typer::Visitor::TypeJSForInPrepare(Node* node) { | 1667 Type* Typer::Visitor::TypeJSForInPrepare(Node* node) { |
1661 STATIC_ASSERT(Map::EnumLengthBits::kMax <= FixedArray::kMaxLength); | 1668 STATIC_ASSERT(Map::EnumLengthBits::kMax <= FixedArray::kMaxLength); |
1662 Type* const cache_type = | 1669 Type* const cache_type = |
1663 Type::Union(Type::SignedSmall(), Type::OtherInternal(), zone()); | 1670 Type::Union(Type::SignedSmall(), Type::OtherInternal(), zone()); |
1664 Type* const cache_array = Type::OtherInternal(); | 1671 Type* const cache_array = Type::OtherInternal(); |
1665 Type* const cache_length = typer_->cache_.kFixedArrayLengthType; | 1672 Type* const cache_length = typer_->cache_.kFixedArrayLengthType; |
1666 return Type::Tuple(cache_type, cache_array, cache_length, zone()); | 1673 return Type::Tuple(cache_type, cache_array, cache_length, zone()); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1871 if (type->Maybe(Type::Hole())) { | 1878 if (type->Maybe(Type::Hole())) { |
1872 // Turn "the hole" into undefined. | 1879 // Turn "the hole" into undefined. |
1873 type = Type::Intersect(type, Type::NonInternal(), zone()); | 1880 type = Type::Intersect(type, Type::NonInternal(), zone()); |
1874 type = Type::Union(type, Type::Undefined(), zone()); | 1881 type = Type::Union(type, Type::Undefined(), zone()); |
1875 } | 1882 } |
1876 return type; | 1883 return type; |
1877 } | 1884 } |
1878 | 1885 |
1879 Type* Typer::Visitor::TypeAllocate(Node* node) { return Type::Any(); } | 1886 Type* Typer::Visitor::TypeAllocate(Node* node) { return Type::Any(); } |
1880 | 1887 |
| 1888 Type* Typer::Visitor::TypeLoadFieldByIndex(Node* node) { |
| 1889 return Type::NonInternal(); |
| 1890 } |
| 1891 |
1881 Type* Typer::Visitor::TypeLoadField(Node* node) { | 1892 Type* Typer::Visitor::TypeLoadField(Node* node) { |
1882 return FieldAccessOf(node->op()).type; | 1893 return FieldAccessOf(node->op()).type; |
1883 } | 1894 } |
1884 | 1895 |
1885 Type* Typer::Visitor::TypeLoadBuffer(Node* node) { | 1896 Type* Typer::Visitor::TypeLoadBuffer(Node* node) { |
1886 switch (BufferAccessOf(node->op()).external_array_type()) { | 1897 switch (BufferAccessOf(node->op()).external_array_type()) { |
1887 #define TYPED_ARRAY_CASE(ElemType, type, TYPE, ctype, size) \ | 1898 #define TYPED_ARRAY_CASE(ElemType, type, TYPE, ctype, size) \ |
1888 case kExternal##ElemType##Array: \ | 1899 case kExternal##ElemType##Array: \ |
1889 return Type::Union(typer_->cache_.k##ElemType, Type::Undefined(), zone()); | 1900 return Type::Union(typer_->cache_.k##ElemType, Type::Undefined(), zone()); |
1890 TYPED_ARRAYS(TYPED_ARRAY_CASE) | 1901 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1992 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { | 2003 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { |
1993 if (Type::IsInteger(*value)) { | 2004 if (Type::IsInteger(*value)) { |
1994 return Type::Range(value->Number(), value->Number(), zone()); | 2005 return Type::Range(value->Number(), value->Number(), zone()); |
1995 } | 2006 } |
1996 return Type::NewConstant(value, zone()); | 2007 return Type::NewConstant(value, zone()); |
1997 } | 2008 } |
1998 | 2009 |
1999 } // namespace compiler | 2010 } // namespace compiler |
2000 } // namespace internal | 2011 } // namespace internal |
2001 } // namespace v8 | 2012 } // namespace v8 |
OLD | NEW |