Commit 839efa2e authored by verwaest's avatar verwaest Committed by Commit bot

Reduce field type tracking to a single stable map per field.

BUG=

Review URL: https://codereview.chromium.org/930983003

Cr-Commit-Position: refs/heads/master@{#26679}
parent 305c7347
......@@ -2326,18 +2326,8 @@ void Map::UpdateFieldType(int descriptor, Handle<Name> name,
Handle<HeapType> Map::GeneralizeFieldType(Handle<HeapType> type1,
Handle<HeapType> type2,
Isolate* isolate) {
static const int kMaxClassesPerFieldType = 5;
if (type1->NowIs(type2)) return type2;
if (type2->NowIs(type1)) return type1;
if (type1->NowStable() && type2->NowStable()) {
Handle<HeapType> type = HeapType::Union(type1, type2, isolate);
if (type->NumClasses() <= kMaxClassesPerFieldType) {
DCHECK(type->NowStable());
DCHECK(type1->NowIs(type));
DCHECK(type2->NowIs(type));
return type;
}
}
return HeapType::Any(isolate);
}
......
......@@ -575,10 +575,7 @@ bool TypeImpl<Config>::NowIs(TypeImpl* that) {
template<class Config>
bool TypeImpl<Config>::NowStable() {
DisallowHeapAllocation no_allocation;
for (Iterator<i::Map> it = this->Classes(); !it.Done(); it.Advance()) {
if (!it.Current()->is_stable()) return false;
}
return true;
return !this->IsClass() || this->AsClass()->Map()->is_stable();
}
......
......@@ -694,7 +694,7 @@ TEST(GeneralizeRepresentationHeapObjectToHeapObject) {
Isolate* isolate = CcTest::i_isolate();
Handle<HeapType> any_type = HeapType::Any(isolate);
const int kMaxClassesPerFieldType = 5;
const int kMaxClassesPerFieldType = 1;
Handle<HeapType> current_type =
HeapType::Class(Map::Create(isolate, 0), isolate);
......@@ -1070,7 +1070,7 @@ TEST(ReconfigureDataFieldAttribute_GeneralizeRepresentationHeapObjToHeapObj) {
Isolate* isolate = CcTest::i_isolate();
Handle<HeapType> any_type = HeapType::Any(isolate);
const int kMaxClassesPerFieldType = 5;
const int kMaxClassesPerFieldType = 1;
Handle<HeapType> current_type =
HeapType::Class(Map::Create(isolate, 0), isolate);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment