Commit 1bc7d174 authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by V8 LUCI CQ

[string] Remove FLAG_thin_string and enable it all the time

It was added years ago and in 2017 it was enabled by default[1], which
means enough time has passed and we can remove the flag.

[1]: https://chromium-review.googlesource.com/c/v8/v8/+/528076/

Change-Id: I059417d4683910e86ebfddd93f504006094fa342
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2947406Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75039}
parent 368a20bc
......@@ -1545,7 +1545,6 @@ DEFINE_BOOL(super_ic, true, "use an IC for super property loads")
DEFINE_BOOL(enable_mega_dom_ic, false, "use MegaDOM IC state for API objects")
// objects.cc
DEFINE_BOOL(thin_strings, true, "Enable ThinString support")
DEFINE_BOOL(trace_prototype_users, false,
"Trace updates to prototype user tracking")
DEFINE_BOOL(trace_for_in_enumerate, false, "Trace for-in enumerate slow-paths")
......
......@@ -373,7 +373,6 @@ class InternalizedStringKey final : public StringTableKey {
DCHECK(string_->IsInternalizedString());
return string_;
}
if (FLAG_thin_strings) {
// External strings get special treatment, to avoid copying their
// contents as long as they are not uncached.
StringShape shape(*string_);
......@@ -383,12 +382,12 @@ class InternalizedStringKey final : public StringTableKey {
} else if (shape.IsExternalTwoByte() && !shape.IsUncachedExternal()) {
return isolate->factory()
->InternalizeExternalString<ExternalTwoByteString>(string_);
}
}
} else {
// Otherwise allocate a new internalized string.
return isolate->factory()->NewInternalizedStringImpl(
string_, string_->length(), string_->raw_hash_field());
}
}
private:
Handle<String> string_;
......@@ -402,29 +401,9 @@ Handle<String> StringTable::LookupString(Isolate* isolate,
InternalizedStringKey key(string);
Handle<String> result = LookupKey(isolate, &key);
if (FLAG_thin_strings) {
if (!string->IsInternalizedString()) {
string->MakeThin(isolate, *result);
}
} else { // !FLAG_thin_strings
if (string->IsConsString()) {
Handle<ConsString> cons = Handle<ConsString>::cast(string);
cons->set_first(*result);
cons->set_second(ReadOnlyRoots(isolate).empty_string());
} else if (string->IsSlicedString()) {
STATIC_ASSERT(static_cast<int>(ConsString::kSize) ==
static_cast<int>(SlicedString::kSize));
DisallowGarbageCollection no_gc;
bool one_byte = result->IsOneByteRepresentation();
Handle<Map> map = one_byte
? isolate->factory()->cons_one_byte_string_map()
: isolate->factory()->cons_string_map();
string->set_map(*map);
Handle<ConsString> cons = Handle<ConsString>::cast(string);
cons->set_first(*result);
cons->set_second(ReadOnlyRoots(isolate).empty_string());
}
}
return result;
}
......@@ -628,9 +607,7 @@ Address StringTable::Data::TryStringToIndexOrLookupExisting(Isolate* isolate,
}
String internalized = String::cast(string_table_data->Get(isolate, entry));
if (FLAG_thin_strings) {
string.MakeThin(isolate, internalized);
}
return internalized.ptr();
}
......
......@@ -357,7 +357,7 @@ void Deserializer::PostProcessNewObject(Handle<Map> map, Handle<HeapObject> obj,
Handle<String> result =
isolate()->string_table()->LookupKey(isolate(), &key);
if (FLAG_thin_strings && *result != *string) {
if (*result != *string) {
string->MakeThin(isolate(), *result);
// Mutate the given object handle so that the backreference entry is
// also updated.
......
......@@ -768,14 +768,14 @@ TEST(TryToName) {
ft.CheckTrue(key, expect_bailout);
}
if (FLAG_thin_strings) {
{
// TryToName(<thin string>) => internalized version.
Handle<String> s = isolate->factory()->NewStringFromAsciiChecked("foo");
Handle<String> internalized = isolate->factory()->InternalizeString(s);
ft.CheckTrue(s, expect_unique, internalized);
}
if (FLAG_thin_strings) {
{
// TryToName(<thin two-byte string>) => internalized version.
uc16 array1[] = {2001, 2002, 2003};
Handle<String> s = isolate->factory()
......
......@@ -239,8 +239,6 @@ TEST(InspectTwoByteExternalizing) {
// Inspect a one byte string, while the main thread externalizes it. Same as
// InspectOneByteExternalizing, but using thin strings.
TEST(InspectOneByteExternalizing_ThinString) {
if (!FLAG_thin_strings) return;
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
......@@ -302,7 +300,6 @@ TEST(InspectOneByteExternalizing_ThinString) {
// bytes string. Same as InspectOneIntoTwoByteExternalizing, but using thin
// strings.
TEST(InspectOneIntoTwoByteExternalizing_ThinString) {
if (!FLAG_thin_strings) return;
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
......@@ -364,8 +361,6 @@ TEST(InspectOneIntoTwoByteExternalizing_ThinString) {
// Inspect a two byte string, while the main thread externalizes it. Same as
// InspectTwoByteExternalizing, but using thin strings.
TEST(InspectTwoByteExternalizing_ThinString) {
if (!FLAG_thin_strings) return;
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
......
......@@ -804,7 +804,7 @@ TEST(GCShortCutting) {
factory->NewStringFromAsciiChecked("thin_string");
Handle<String> internalized_string =
factory->InternalizeString(thin_string);
DCHECK_IMPLIES(FLAG_thin_strings, thin_string->IsThinString());
DCHECK(thin_string->IsThinString());
DCHECK_NE(*thin_string, *internalized_string);
// Insert both keys into the map.
......@@ -815,7 +815,7 @@ TEST(GCShortCutting) {
// to the internalized string.
t.heap()->CollectGarbage(i::NEW_SPACE,
i::GarbageCollectionReason::kTesting);
DCHECK_IMPLIES(FLAG_thin_strings && !FLAG_optimize_for_size,
DCHECK_IMPLIES(!FLAG_optimize_for_size,
*thin_string == *internalized_string);
// Check that getting the object points to one of the handles.
......
......@@ -1367,7 +1367,6 @@ TEST(InternalizeExternal) {
if (FLAG_minor_mc) return;
#endif // ENABLE_MINOR_MC
FLAG_stress_incremental_marking = false;
FLAG_thin_strings = true;
CcTest::InitializeVM();
i::Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory();
......
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