| Index: src/types-inl.h
|
| diff --git a/src/types-inl.h b/src/types-inl.h
|
| index 2c805032902d0d2bc79862dd8822e3a46a6263fc..695634c1a4fad15bb2f11cb252dc05dc0a02ad44 100644
|
| --- a/src/types-inl.h
|
| +++ b/src/types-inl.h
|
| @@ -13,33 +13,70 @@
|
| namespace v8 {
|
| namespace internal {
|
|
|
| +// -------------------------------------------------------------------------- //
|
| +// TypeImpl
|
| +
|
| +template<class Config>
|
| +TypeImpl<Config>::Iterator<i::Map> TypeImpl<Config>::Classes() {
|
| + if (this->IsBitset()) return Iterator<i::Map>();
|
| + return Iterator<i::Map>(Config::handle(this));
|
| +}
|
| +
|
| +
|
| +template<class Config>
|
| +TypeImpl<Config>::Iterator<i::Object> TypeImpl<Config>::Constants() {
|
| + if (this->IsBitset()) return Iterator<i::Object>();
|
| + return Iterator<i::Object>(Config::handle(this));
|
| +}
|
| +
|
| +
|
| +template<class Config>
|
| +TypeImpl<Config>* TypeImpl<Config>::cast(typename Config::Base* object) {
|
| + TypeImpl* t = static_cast<TypeImpl*>(object);
|
| + ASSERT(t->IsBitset() || t->IsClass() || t->IsConstant() ||
|
| + t->IsUnion() || t->IsArray() || t->IsFunction());
|
| + return t;
|
| +}
|
| +
|
| +
|
| +// -------------------------------------------------------------------------- //
|
| +// ZoneTypeConfig
|
| +
|
| // static
|
| -Type* ZoneTypeConfig::handle(Type* type) {
|
| +template<class T>
|
| +T* ZoneTypeConfig::handle(T* type) {
|
| return type;
|
| }
|
|
|
|
|
| // static
|
| +template<class T>
|
| +T* ZoneTypeConfig::cast(Type* type) {
|
| + return static_cast<T*>(type);
|
| +}
|
| +
|
| +
|
| +// static
|
| bool ZoneTypeConfig::is_bitset(Type* type) {
|
| return reinterpret_cast<intptr_t>(type) & 1;
|
| }
|
|
|
|
|
| // static
|
| -bool ZoneTypeConfig::is_struct(Type* type) {
|
| - return !is_bitset(type);
|
| +bool ZoneTypeConfig::is_struct(Type* type, int tag) {
|
| + return !is_bitset(type) && struct_tag(as_struct(type)) == tag;
|
| }
|
|
|
|
|
| // static
|
| bool ZoneTypeConfig::is_class(Type* type) {
|
| - return is_struct(type) && struct_tag(as_struct(type)) == Type::kClassTag;
|
| + return is_struct(type, Type::StructuralType::kClassTag);
|
| }
|
|
|
|
|
| // static
|
| bool ZoneTypeConfig::is_constant(Type* type) {
|
| - return is_struct(type) && struct_tag(as_struct(type)) == Type::kConstantTag;
|
| + return is_struct(type, Type::StructuralType::kConstantTag);
|
| }
|
|
|
|
|
| @@ -52,7 +89,7 @@ int ZoneTypeConfig::as_bitset(Type* type) {
|
|
|
| // static
|
| ZoneTypeConfig::Struct* ZoneTypeConfig::as_struct(Type* type) {
|
| - ASSERT(is_struct(type));
|
| + ASSERT(!is_bitset(type));
|
| return reinterpret_cast<Struct*>(type);
|
| }
|
|
|
| @@ -93,7 +130,7 @@ ZoneTypeConfig::Type* ZoneTypeConfig::from_struct(Struct* structured) {
|
| // static
|
| ZoneTypeConfig::Type* ZoneTypeConfig::from_class(
|
| i::Handle<i::Map> map, int lub, Zone* zone) {
|
| - Struct* structured = struct_create(Type::kClassTag, 2, zone);
|
| + Struct* structured = struct_create(Type::StructuralType::kClassTag, 2, zone);
|
| structured[2] = from_bitset(lub);
|
| structured[3] = map.location();
|
| return from_struct(structured);
|
| @@ -103,7 +140,8 @@ ZoneTypeConfig::Type* ZoneTypeConfig::from_class(
|
| // static
|
| ZoneTypeConfig::Type* ZoneTypeConfig::from_constant(
|
| i::Handle<i::Object> value, int lub, Zone* zone) {
|
| - Struct* structured = struct_create(Type::kConstantTag, 2, zone);
|
| + Struct* structured =
|
| + struct_create(Type::StructuralType::kConstantTag, 2, zone);
|
| structured[2] = from_bitset(lub);
|
| structured[3] = value.location();
|
| return from_struct(structured);
|
| @@ -160,15 +198,25 @@ int ZoneTypeConfig::lub_bitset(Type* type) {
|
| return as_bitset(struct_get(as_struct(type), 0));
|
| }
|
|
|
| +
|
| // -------------------------------------------------------------------------- //
|
| +// HeapTypeConfig
|
|
|
| // static
|
| -i::Handle<HeapTypeConfig::Type> HeapTypeConfig::handle(Type* type) {
|
| +template<class T>
|
| +i::Handle<T> HeapTypeConfig::handle(T* type) {
|
| return i::handle(type, i::HeapObject::cast(type)->GetIsolate());
|
| }
|
|
|
|
|
| // static
|
| +template<class T>
|
| +i::Handle<T> HeapTypeConfig::cast(i::Handle<Type> type) {
|
| + return i::Handle<T>::cast(type);
|
| +}
|
| +
|
| +
|
| +// static
|
| bool HeapTypeConfig::is_bitset(Type* type) {
|
| return type->IsSmi();
|
| }
|
| @@ -187,14 +235,14 @@ bool HeapTypeConfig::is_constant(Type* type) {
|
|
|
|
|
| // static
|
| -bool HeapTypeConfig::is_struct(Type* type) {
|
| - return type->IsFixedArray();
|
| +bool HeapTypeConfig::is_struct(Type* type, int tag) {
|
| + return type->IsFixedArray() && struct_tag(as_struct(type)) == tag;
|
| }
|
|
|
|
|
| // static
|
| int HeapTypeConfig::as_bitset(Type* type) {
|
| - return Smi::cast(type)->value();
|
| + return i::Smi::cast(type)->value();
|
| }
|
|
|
|
|
|
|