Commit 5b3fbf23 authored by ishell's avatar ishell Committed by Commit bot

Ensure that all non-stable maps created by Map::AddMissingTransitions() are marked as such.

BUG=chromium:570131
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#33029}
parent fc23b494
...@@ -330,6 +330,8 @@ void Map::MapVerify() { ...@@ -330,6 +330,8 @@ void Map::MapVerify() {
CHECK(instance_size() == kVariableSizeSentinel || CHECK(instance_size() == kVariableSizeSentinel ||
(kPointerSize <= instance_size() && (kPointerSize <= instance_size() &&
instance_size() < heap->Capacity())); instance_size() < heap->Capacity()));
CHECK(GetBackPointer()->IsUndefined() ||
!Map::cast(GetBackPointer())->is_stable());
VerifyHeapPointer(prototype()); VerifyHeapPointer(prototype());
VerifyHeapPointer(instance_descriptors()); VerifyHeapPointer(instance_descriptors());
SLOW_DCHECK(instance_descriptors()->IsSortedNoDuplicates()); SLOW_DCHECK(instance_descriptors()->IsSortedNoDuplicates());
......
...@@ -9311,6 +9311,7 @@ Handle<Map> Map::AddMissingTransitions( ...@@ -9311,6 +9311,7 @@ Handle<Map> Map::AddMissingTransitions(
InstallDescriptors(map, new_map, i, descriptors, full_layout_descriptor); InstallDescriptors(map, new_map, i, descriptors, full_layout_descriptor);
map = new_map; map = new_map;
} }
map->NotifyLeafMapLayoutChange();
InstallDescriptors(map, last_map, nof_descriptors - 1, descriptors, InstallDescriptors(map, last_map, nof_descriptors - 1, descriptors,
full_layout_descriptor); full_layout_descriptor);
return last_map; return last_map;
...@@ -9427,6 +9428,7 @@ Handle<Map> Map::AsLanguageMode(Handle<Map> initial_map, ...@@ -9427,6 +9428,7 @@ Handle<Map> Map::AsLanguageMode(Handle<Map> initial_map,
if (maybe_transition != NULL) { if (maybe_transition != NULL) {
return handle(maybe_transition, isolate); return handle(maybe_transition, isolate);
} }
initial_map->NotifyLeafMapLayoutChange();
// Create new map taking descriptors from the |function_map| and all // Create new map taking descriptors from the |function_map| and all
// the other details from the |initial_map|. // the other details from the |initial_map|.
......
...@@ -621,6 +621,17 @@ static void TestGeneralizeRepresentation( ...@@ -621,6 +621,17 @@ static void TestGeneralizeRepresentation(
CHECK_EQ(expected_field_type_dependency, info.dependencies()->HasAborted()); CHECK_EQ(expected_field_type_dependency, info.dependencies()->HasAborted());
} }
{
// Check that all previous maps are not stable.
Map* tmp = *new_map;
while (true) {
Object* back = tmp->GetBackPointer();
if (back->IsUndefined()) break;
tmp = Map::cast(back);
CHECK(!tmp->is_stable());
}
}
info.dependencies()->Rollback(); // Properly cleanup compilation info. info.dependencies()->Rollback(); // Properly cleanup compilation info.
// Update all deprecated maps and check that they are now the same. // Update all deprecated maps and check that they are now the same.
......
...@@ -759,12 +759,14 @@ static Handle<LayoutDescriptor> TestLayoutDescriptorAppendIfFastOrUseFull( ...@@ -759,12 +759,14 @@ static Handle<LayoutDescriptor> TestLayoutDescriptorAppendIfFastOrUseFull(
int descriptors_length = descriptors->number_of_descriptors(); int descriptors_length = descriptors->number_of_descriptors();
std::vector<Handle<Map>> maps(descriptors_length); std::vector<Handle<Map>> maps(descriptors_length);
{ {
CHECK(last_map->is_stable());
Map* map = *last_map; Map* map = *last_map;
for (int i = 0; i < descriptors_length; i++) { for (int i = 0; i < descriptors_length; i++) {
maps[descriptors_length - 1 - i] = handle(map, isolate); maps[descriptors_length - 1 - i] = handle(map, isolate);
Object* maybe_map = map->GetBackPointer(); Object* maybe_map = map->GetBackPointer();
CHECK(maybe_map->IsMap()); CHECK(maybe_map->IsMap());
map = Map::cast(maybe_map); map = Map::cast(maybe_map);
CHECK(!map->is_stable());
} }
CHECK_EQ(1, maps[0]->NumberOfOwnDescriptors()); CHECK_EQ(1, maps[0]->NumberOfOwnDescriptors());
} }
......
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