Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 6b5d80c992d22517346caaf5e330426796275707..5d224d792eb2789ecb93aa1e4b9c5194a23668f6 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -17067,11 +17067,13 @@ Handle<HeapType> PropertyCell::UpdatedType(Handle<PropertyCell> cell, |
Handle<Object> PropertyCell::SetValueInferType(Handle<PropertyCell> cell, |
Handle<Object> value) { |
- // Heuristic: if a string is stored in a previously uninitialized |
+ // Heuristic: if a small-ish string is stored in a previously uninitialized |
// property cell, internalize it. |
+ const int kMaxLengthForInternalization = 200; |
if ((cell->type()->Is(HeapType::None()) || |
cell->type()->Is(HeapType::Undefined())) && |
- value->IsString()) { |
+ value->IsString() && |
+ Handle<String>::cast(value)->length() <= kMaxLengthForInternalization) { |
value = cell->GetIsolate()->factory()->InternalizeString( |
Handle<String>::cast(value)); |
} |