From 839efa2e268e6f47de953f067c967aa03cdd178e Mon Sep 17 00:00:00 2001 From: verwaest Date: Tue, 17 Feb 2015 00:57:54 -0800 Subject: [PATCH] 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} --- src/objects.cc | 10 ---------- src/types.cc | 5 +---- test/cctest/test-migrations.cc | 4 ++-- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/objects.cc b/src/objects.cc index 775a66479b..74f8d52bda 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -2326,18 +2326,8 @@ void Map::UpdateFieldType(int descriptor, Handle name, Handle Map::GeneralizeFieldType(Handle type1, Handle 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 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); } diff --git a/src/types.cc b/src/types.cc index c1225f396e..37386cd82f 100644 --- a/src/types.cc +++ b/src/types.cc @@ -575,10 +575,7 @@ bool TypeImpl::NowIs(TypeImpl* that) { template bool TypeImpl::NowStable() { DisallowHeapAllocation no_allocation; - for (Iterator it = this->Classes(); !it.Done(); it.Advance()) { - if (!it.Current()->is_stable()) return false; - } - return true; + return !this->IsClass() || this->AsClass()->Map()->is_stable(); } diff --git a/test/cctest/test-migrations.cc b/test/cctest/test-migrations.cc index db03901c3d..2f7ff8703c 100644 --- a/test/cctest/test-migrations.cc +++ b/test/cctest/test-migrations.cc @@ -694,7 +694,7 @@ TEST(GeneralizeRepresentationHeapObjectToHeapObject) { Isolate* isolate = CcTest::i_isolate(); Handle any_type = HeapType::Any(isolate); - const int kMaxClassesPerFieldType = 5; + const int kMaxClassesPerFieldType = 1; Handle current_type = HeapType::Class(Map::Create(isolate, 0), isolate); @@ -1070,7 +1070,7 @@ TEST(ReconfigureDataFieldAttribute_GeneralizeRepresentationHeapObjToHeapObj) { Isolate* isolate = CcTest::i_isolate(); Handle any_type = HeapType::Any(isolate); - const int kMaxClassesPerFieldType = 5; + const int kMaxClassesPerFieldType = 1; Handle current_type = HeapType::Class(Map::Create(isolate, 0), isolate);