Reviewers: mvstanton,

Description:
Follow-up to r25822: only internalize short strings optimistically

BUG=chromium:442703
LOG=n
[email protected]

Please review this at https://codereview.chromium.org/809723002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+4, -2 lines):
  M src/objects.cc


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));
   }


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to