Commit 60f108f9 authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[ast] Allocate cons strings in young space on main thread

In the case of function names, we allocate ConsStrings only to flatten
them during finalization. Allocating these ConsStrings in old space
appears to have regressed some benchmarks (especially memory benchmarks),
but is necessary for off-thread allocation which doesn't have a young
space.

Ideally, we would avoid allocating these ConsStrings in the first place,
and would flatten the data directly from the AstConsString. For now, we
make them allocate in old space for off-thread allocation only, to
revert the regressions. In the future we can investigate smarter
flattening.

Bug: chromium:1011762
Bug: chromium:1044477, chromium:1044147, chromium:1043573, chromium:1043168
Change-Id: If24b738d6f2eeb8c0fea042a711deb2a19015fbd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2020948
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66025}
parent 861da54f
......@@ -170,10 +170,18 @@ void AstConsString::Internalize(Factory* factory) {
FactoryHandle<Factory, String> tmp(segment_.string->string().get<Factory>());
for (AstConsString::Segment* current = segment_.next; current != nullptr;
current = current->next) {
tmp = factory
->NewConsString(current->string->string().get<Factory>(), tmp,
AllocationType::kOld)
.ToHandleChecked();
tmp =
factory
->NewConsString(
current->string->string().get<Factory>(), tmp,
// TODO(leszeks): This is to avoid memory regressions while this
// path is under development -- the off-thread factory doesn't
// support young allocations. Figure out a way to avoid memory
// regressions related to ConsStrings in the off-thread path.
std::is_same<Factory, OffThreadFactory>::value
? AllocationType::kOld
: AllocationType::kYoung)
.ToHandleChecked();
}
set_string(tmp);
}
......
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