| Index: src/types-inl.h
|
| diff --git a/src/types-inl.h b/src/types-inl.h
|
| index ca4f120c798d96ec39122f07d0fb8fade3b76bbb..2830928ea1b62a5b7ef698e74ea981bbbfae0184 100644
|
| --- a/src/types-inl.h
|
| +++ b/src/types-inl.h
|
| @@ -70,13 +70,7 @@ bool ZoneTypeConfig::is_struct(Type* type, int tag) {
|
|
|
| // static
|
| bool ZoneTypeConfig::is_class(Type* type) {
|
| - return is_struct(type, Type::StructuralType::kClassTag);
|
| -}
|
| -
|
| -
|
| -// static
|
| -bool ZoneTypeConfig::is_constant(Type* type) {
|
| - return is_struct(type, Type::StructuralType::kConstantTag);
|
| + return false;
|
| }
|
|
|
|
|
| @@ -96,16 +90,8 @@ ZoneTypeConfig::Struct* ZoneTypeConfig::as_struct(Type* type) {
|
|
|
| // static
|
| i::Handle<i::Map> ZoneTypeConfig::as_class(Type* type) {
|
| - ASSERT(is_class(type));
|
| - return i::Handle<i::Map>(static_cast<i::Map**>(as_struct(type)[3]));
|
| -}
|
| -
|
| -
|
| -// static
|
| -i::Handle<i::Object> ZoneTypeConfig::as_constant(Type* type) {
|
| - ASSERT(is_constant(type));
|
| - return i::Handle<i::Object>(
|
| - static_cast<i::Object**>(as_struct(type)[3]));
|
| + UNREACHABLE();
|
| + return i::Handle<i::Map>();
|
| }
|
|
|
|
|
| @@ -122,80 +108,76 @@ ZoneTypeConfig::Type* ZoneTypeConfig::from_bitset(int bitset, Zone* Zone) {
|
|
|
|
|
| // static
|
| -ZoneTypeConfig::Type* ZoneTypeConfig::from_struct(Struct* structured) {
|
| - return reinterpret_cast<Type*>(structured);
|
| +ZoneTypeConfig::Type* ZoneTypeConfig::from_struct(Struct* structure) {
|
| + return reinterpret_cast<Type*>(structure);
|
| }
|
|
|
|
|
| // static
|
| ZoneTypeConfig::Type* ZoneTypeConfig::from_class(
|
| - i::Handle<i::Map> map, int lub, Zone* zone) {
|
| - Struct* structured = struct_create(Type::StructuralType::kClassTag, 2, zone);
|
| - structured[2] = from_bitset(lub);
|
| - structured[3] = map.location();
|
| - return from_struct(structured);
|
| + i::Handle<i::Map> map, Zone* zone) {
|
| + return from_bitset(0);
|
| }
|
|
|
|
|
| // static
|
| -ZoneTypeConfig::Type* ZoneTypeConfig::from_constant(
|
| - i::Handle<i::Object> value, int lub, Zone* zone) {
|
| - Struct* structured =
|
| - struct_create(Type::StructuralType::kConstantTag, 2, zone);
|
| - structured[2] = from_bitset(lub);
|
| - structured[3] = value.location();
|
| - return from_struct(structured);
|
| +ZoneTypeConfig::Struct* ZoneTypeConfig::struct_create(
|
| + int tag, int length, Zone* zone) {
|
| + Struct* structure = reinterpret_cast<Struct*>(
|
| + zone->New(sizeof(void*) * (length + 2))); // NOLINT
|
| + structure[0] = reinterpret_cast<void*>(tag);
|
| + structure[1] = reinterpret_cast<void*>(length);
|
| + return structure;
|
| }
|
|
|
|
|
| // static
|
| -ZoneTypeConfig::Struct* ZoneTypeConfig::struct_create(
|
| - int tag, int length, Zone* zone) {
|
| - Struct* structured = reinterpret_cast<Struct*>(
|
| - zone->New(sizeof(void*) * (length + 2))); // NOLINT
|
| - structured[0] = reinterpret_cast<void*>(tag);
|
| - structured[1] = reinterpret_cast<void*>(length);
|
| - return structured;
|
| +void ZoneTypeConfig::struct_shrink(Struct* structure, int length) {
|
| + ASSERT(0 <= length && length <= struct_length(structure));
|
| + structure[1] = reinterpret_cast<void*>(length);
|
| }
|
|
|
|
|
| // static
|
| -void ZoneTypeConfig::struct_shrink(Struct* structured, int length) {
|
| - ASSERT(0 <= length && length <= struct_length(structured));
|
| - structured[1] = reinterpret_cast<void*>(length);
|
| +int ZoneTypeConfig::struct_tag(Struct* structure) {
|
| + return static_cast<int>(reinterpret_cast<intptr_t>(structure[0]));
|
| }
|
|
|
|
|
| // static
|
| -int ZoneTypeConfig::struct_tag(Struct* structured) {
|
| - return static_cast<int>(reinterpret_cast<intptr_t>(structured[0]));
|
| +int ZoneTypeConfig::struct_length(Struct* structure) {
|
| + return static_cast<int>(reinterpret_cast<intptr_t>(structure[1]));
|
| }
|
|
|
|
|
| // static
|
| -int ZoneTypeConfig::struct_length(Struct* structured) {
|
| - return static_cast<int>(reinterpret_cast<intptr_t>(structured[1]));
|
| +Type* ZoneTypeConfig::struct_get(Struct* structure, int i) {
|
| + ASSERT(0 <= i && i <= struct_length(structure));
|
| + return static_cast<Type*>(structure[2 + i]);
|
| }
|
|
|
|
|
| // static
|
| -Type* ZoneTypeConfig::struct_get(Struct* structured, int i) {
|
| - ASSERT(0 <= i && i <= struct_length(structured));
|
| - return static_cast<Type*>(structured[2 + i]);
|
| +void ZoneTypeConfig::struct_set(Struct* structure, int i, Type* x) {
|
| + ASSERT(0 <= i && i <= struct_length(structure));
|
| + structure[2 + i] = x;
|
| }
|
|
|
|
|
| // static
|
| -void ZoneTypeConfig::struct_set(Struct* structured, int i, Type* type) {
|
| - ASSERT(0 <= i && i <= struct_length(structured));
|
| - structured[2 + i] = type;
|
| +template<class V>
|
| +i::Handle<V> ZoneTypeConfig::struct_get_value(Struct* structure, int i) {
|
| + ASSERT(0 <= i && i <= struct_length(structure));
|
| + return i::Handle<V>(static_cast<V**>(structure[2 + i]));
|
| }
|
|
|
|
|
| // static
|
| -int ZoneTypeConfig::lub_bitset(Type* type) {
|
| - ASSERT(is_class(type) || is_constant(type));
|
| - return as_bitset(struct_get(as_struct(type), 0));
|
| +template<class V>
|
| +void ZoneTypeConfig::struct_set_value(
|
| + Struct* structure, int i, i::Handle<V> x) {
|
| + ASSERT(0 <= i && i <= struct_length(structure));
|
| + structure[2 + i] = x.location();
|
| }
|
|
|
|
|
| @@ -229,12 +211,6 @@ bool HeapTypeConfig::is_class(Type* type) {
|
|
|
|
|
| // static
|
| -bool HeapTypeConfig::is_constant(Type* type) {
|
| - return type->IsBox();
|
| -}
|
| -
|
| -
|
| -// static
|
| bool HeapTypeConfig::is_struct(Type* type, int tag) {
|
| return type->IsFixedArray() && struct_tag(as_struct(type)) == tag;
|
| }
|
| @@ -253,13 +229,6 @@ i::Handle<i::Map> HeapTypeConfig::as_class(Type* type) {
|
|
|
|
|
| // static
|
| -i::Handle<i::Object> HeapTypeConfig::as_constant(Type* type) {
|
| - i::Box* box = i::Box::cast(type);
|
| - return i::handle(box->value(), box->GetIsolate());
|
| -}
|
| -
|
| -
|
| -// static
|
| i::Handle<HeapTypeConfig::Struct> HeapTypeConfig::as_struct(Type* type) {
|
| return i::handle(Struct::cast(type));
|
| }
|
| @@ -280,71 +249,74 @@ i::Handle<HeapTypeConfig::Type> HeapTypeConfig::from_bitset(
|
|
|
| // static
|
| i::Handle<HeapTypeConfig::Type> HeapTypeConfig::from_class(
|
| - i::Handle<i::Map> map, int lub, Isolate* isolate) {
|
| + i::Handle<i::Map> map, Isolate* isolate) {
|
| return i::Handle<Type>::cast(i::Handle<Object>::cast(map));
|
| }
|
|
|
|
|
| // static
|
| -i::Handle<HeapTypeConfig::Type> HeapTypeConfig::from_constant(
|
| - i::Handle<i::Object> value, int lub, Isolate* isolate) {
|
| - i::Handle<Box> box = isolate->factory()->NewBox(value);
|
| - return i::Handle<Type>::cast(i::Handle<Object>::cast(box));
|
| -}
|
| -
|
| -
|
| -// static
|
| i::Handle<HeapTypeConfig::Type> HeapTypeConfig::from_struct(
|
| - i::Handle<Struct> structured) {
|
| - return i::Handle<Type>::cast(i::Handle<Object>::cast(structured));
|
| + i::Handle<Struct> structure) {
|
| + return i::Handle<Type>::cast(i::Handle<Object>::cast(structure));
|
| }
|
|
|
|
|
| // static
|
| i::Handle<HeapTypeConfig::Struct> HeapTypeConfig::struct_create(
|
| int tag, int length, Isolate* isolate) {
|
| - i::Handle<Struct> structured = isolate->factory()->NewFixedArray(length + 1);
|
| - structured->set(0, i::Smi::FromInt(tag));
|
| - return structured;
|
| + i::Handle<Struct> structure = isolate->factory()->NewFixedArray(length + 1);
|
| + structure->set(0, i::Smi::FromInt(tag));
|
| + return structure;
|
| }
|
|
|
|
|
| // static
|
| -void HeapTypeConfig::struct_shrink(i::Handle<Struct> structured, int length) {
|
| - structured->Shrink(length + 1);
|
| +void HeapTypeConfig::struct_shrink(i::Handle<Struct> structure, int length) {
|
| + structure->Shrink(length + 1);
|
| }
|
|
|
|
|
| // static
|
| -int HeapTypeConfig::struct_tag(i::Handle<Struct> structured) {
|
| - return static_cast<i::Smi*>(structured->get(0))->value();
|
| +int HeapTypeConfig::struct_tag(i::Handle<Struct> structure) {
|
| + return static_cast<i::Smi*>(structure->get(0))->value();
|
| }
|
|
|
|
|
| // static
|
| -int HeapTypeConfig::struct_length(i::Handle<Struct> structured) {
|
| - return structured->length() - 1;
|
| +int HeapTypeConfig::struct_length(i::Handle<Struct> structure) {
|
| + return structure->length() - 1;
|
| }
|
|
|
|
|
| // static
|
| i::Handle<HeapTypeConfig::Type> HeapTypeConfig::struct_get(
|
| - i::Handle<Struct> structured, int i) {
|
| - Type* type = static_cast<Type*>(structured->get(i + 1));
|
| - return i::handle(type, structured->GetIsolate());
|
| + i::Handle<Struct> structure, int i) {
|
| + Type* type = static_cast<Type*>(structure->get(i + 1));
|
| + return i::handle(type, structure->GetIsolate());
|
| }
|
|
|
|
|
| // static
|
| void HeapTypeConfig::struct_set(
|
| - i::Handle<Struct> structured, int i, i::Handle<Type> type) {
|
| - structured->set(i + 1, *type);
|
| + i::Handle<Struct> structure, int i, i::Handle<Type> type) {
|
| + structure->set(i + 1, *type);
|
| +}
|
| +
|
| +
|
| +// static
|
| +template<class V>
|
| +i::Handle<V> HeapTypeConfig::struct_get_value(
|
| + i::Handle<Struct> structure, int i) {
|
| + V* x = static_cast<V*>(structure->get(i + 1));
|
| + return i::handle(x, structure->GetIsolate());
|
| }
|
|
|
|
|
| // static
|
| -int HeapTypeConfig::lub_bitset(Type* type) {
|
| - return 0; // kNone, which causes recomputation.
|
| +template<class V>
|
| +void HeapTypeConfig::struct_set_value(
|
| + i::Handle<Struct> structure, int i, i::Handle<V> x) {
|
| + structure->set(i + 1, *x);
|
| }
|
|
|
| } } // namespace v8::internal
|
|
|