Commit 7a80dbdb authored by jgruber's avatar jgruber Committed by Commit Bot

Internalize string constants in code assembler

This avoids generation of duplicate strings. Especially debug builds
suffer from this and generate 16000+ strings, mostly for CSA_ASSERT
and CAST statements. Deduplicating these trims that down to roughly
1000 strings.

Release builds are affected at a smaller scale. There, we have roughly
100 duplicate strings in the snapshot.

Bug: v8:6666
Change-Id: I688d3b97431b8cea1e98983eab5f07278dae91a0
Reviewed-on: https://chromium-review.googlesource.com/931041Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51472}
parent aa7ccc23
......@@ -270,8 +270,9 @@ TNode<HeapObject> CodeAssembler::UntypedHeapConstant(
}
TNode<String> CodeAssembler::StringConstant(const char* str) {
return UncheckedCast<String>(
HeapConstant(factory()->NewStringFromAsciiChecked(str, TENURED)));
Handle<String> internalized_string =
factory()->InternalizeOneByteString(OneByteVector(str));
return UncheckedCast<String>(HeapConstant(internalized_string));
}
TNode<Oddball> CodeAssembler::BooleanConstant(bool value) {
......
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