Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Unified Diff: src/objects.cc

Issue 809723002: Follow-up to r25822: only internalize short strings optimistically (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698