Commit 40f39b5d authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[cleanup] Refactor Map::EnsureDescriptorSlack's update loop

Don't call UpdateDescriptors twice on {map} in the cases where {map} is
not the initial map.

Change-Id: I2005b8dda1b15c87e0bf1d933a16a2aedfa7ac6b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2743888Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73372}
parent fb03b88e
......@@ -1116,16 +1116,21 @@ void Map::EnsureDescriptorSlack(Isolate* isolate, Handle<Map> map, int slack) {
WriteBarrier::Marking(*descriptors, descriptors->number_of_descriptors());
#endif
Map current = *map;
// Update the descriptors from {map} (inclusive) until the initial map
// (exclusive). In the case that {map} is the initial map, update it.
map->UpdateDescriptors(isolate, *new_descriptors,
map->NumberOfOwnDescriptors());
Object next = map->GetBackPointer();
if (next.IsUndefined(isolate)) return;
Map current = Map::cast(next);
while (current.instance_descriptors(isolate) == *descriptors) {
Object next = current.GetBackPointer();
if (next.IsUndefined(isolate)) break; // Stop overwriting at initial map.
next = current.GetBackPointer();
if (next.IsUndefined(isolate)) break;
current.UpdateDescriptors(isolate, *new_descriptors,
current.NumberOfOwnDescriptors());
current = Map::cast(next);
}
map->UpdateDescriptors(isolate, *new_descriptors,
map->NumberOfOwnDescriptors());
}
// static
......
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