Commit a338f273 authored by dcarney's avatar dcarney Committed by Commit bot

drop interalization of strings entering global constant slots

BUG=

Review URL: https://codereview.chromium.org/1110393003

Cr-Commit-Position: refs/heads/master@{#28155}
parent 7681432d
...@@ -1028,7 +1028,7 @@ MUST_USE_RESULT static MaybeHandle<Object> ReplaceAccessorWithDataProperty( ...@@ -1028,7 +1028,7 @@ MUST_USE_RESULT static MaybeHandle<Object> ReplaceAccessorWithDataProperty(
CHECK_EQ(LookupIterator::ACCESSOR, it.state()); CHECK_EQ(LookupIterator::ACCESSOR, it.state());
DCHECK(it.HolderIsReceiverOrHiddenPrototype()); DCHECK(it.HolderIsReceiverOrHiddenPrototype());
it.ReconfigureDataProperty(value, it.property_details().attributes()); it.ReconfigureDataProperty(value, it.property_details().attributes());
value = it.WriteDataValue(value); it.WriteDataValue(value);
if (is_observed && !old_value->SameValue(*value)) { if (is_observed && !old_value->SameValue(*value)) {
return JSObject::EnqueueChangeRecord(object, "update", name, old_value); return JSObject::EnqueueChangeRecord(object, "update", name, old_value);
......
...@@ -332,15 +332,15 @@ Handle<Object> LookupIterator::GetDataValue() const { ...@@ -332,15 +332,15 @@ Handle<Object> LookupIterator::GetDataValue() const {
} }
Handle<Object> LookupIterator::WriteDataValue(Handle<Object> value) { void LookupIterator::WriteDataValue(Handle<Object> value) {
DCHECK_EQ(DATA, state_); DCHECK_EQ(DATA, state_);
Handle<JSObject> holder = GetHolder<JSObject>(); Handle<JSObject> holder = GetHolder<JSObject>();
if (holder_map_->is_dictionary_map()) { if (holder_map_->is_dictionary_map()) {
Handle<NameDictionary> property_dictionary = Handle<NameDictionary> property_dictionary =
handle(holder->property_dictionary()); handle(holder->property_dictionary());
if (holder->IsGlobalObject()) { if (holder->IsGlobalObject()) {
value = PropertyCell::UpdateCell(property_dictionary, dictionary_entry(), PropertyCell::UpdateCell(property_dictionary, dictionary_entry(), value,
value, property_details_); property_details_);
} else { } else {
property_dictionary->ValueAtPut(dictionary_entry(), *value); property_dictionary->ValueAtPut(dictionary_entry(), *value);
} }
...@@ -349,7 +349,6 @@ Handle<Object> LookupIterator::WriteDataValue(Handle<Object> value) { ...@@ -349,7 +349,6 @@ Handle<Object> LookupIterator::WriteDataValue(Handle<Object> value) {
} else { } else {
DCHECK_EQ(v8::internal::DATA_CONSTANT, property_details_.type()); DCHECK_EQ(v8::internal::DATA_CONSTANT, property_details_.type());
} }
return value;
} }
......
...@@ -142,7 +142,7 @@ class LookupIterator final BASE_EMBEDDED { ...@@ -142,7 +142,7 @@ class LookupIterator final BASE_EMBEDDED {
Handle<Object> GetDataValue() const; Handle<Object> GetDataValue() const;
// Usually returns the value that was passed in, but may perform // Usually returns the value that was passed in, but may perform
// non-observable modifications on it, such as internalize strings. // non-observable modifications on it, such as internalize strings.
Handle<Object> WriteDataValue(Handle<Object> value); void WriteDataValue(Handle<Object> value);
void InternalizeName(); void InternalizeName();
private: private:
......
...@@ -3374,7 +3374,7 @@ MaybeHandle<Object> Object::SetDataProperty(LookupIterator* it, ...@@ -3374,7 +3374,7 @@ MaybeHandle<Object> Object::SetDataProperty(LookupIterator* it,
it->PrepareForDataProperty(value); it->PrepareForDataProperty(value);
// Write the property value. // Write the property value.
value = it->WriteDataValue(value); it->WriteDataValue(value);
// Send the change record if there are observers. // Send the change record if there are observers.
if (is_observed && !value->SameValue(*maybe_old.ToHandleChecked())) { if (is_observed && !value->SameValue(*maybe_old.ToHandleChecked())) {
...@@ -3429,7 +3429,7 @@ MaybeHandle<Object> Object::AddDataProperty(LookupIterator* it, ...@@ -3429,7 +3429,7 @@ MaybeHandle<Object> Object::AddDataProperty(LookupIterator* it,
JSObject::AddSlowProperty(receiver, it->name(), value, attributes); JSObject::AddSlowProperty(receiver, it->name(), value, attributes);
} else { } else {
// Write the property value. // Write the property value.
value = it->WriteDataValue(value); it->WriteDataValue(value);
} }
// Send the change record if there are observers. // Send the change record if there are observers.
...@@ -4293,7 +4293,7 @@ MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes( ...@@ -4293,7 +4293,7 @@ MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes(
} }
it.ReconfigureDataProperty(value, attributes); it.ReconfigureDataProperty(value, attributes);
value = it.WriteDataValue(value); it.WriteDataValue(value);
if (is_observed) { if (is_observed) {
RETURN_ON_EXCEPTION( RETURN_ON_EXCEPTION(
...@@ -4317,7 +4317,7 @@ MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes( ...@@ -4317,7 +4317,7 @@ MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes(
if (is_observed) old_value = it.GetDataValue(); if (is_observed) old_value = it.GetDataValue();
it.ReconfigureDataProperty(value, attributes); it.ReconfigureDataProperty(value, attributes);
value = it.WriteDataValue(value); it.WriteDataValue(value);
if (is_observed) { if (is_observed) {
if (old_value->SameValue(*value)) { if (old_value->SameValue(*value)) {
...@@ -17156,9 +17156,8 @@ PropertyCellType PropertyCell::UpdatedType(Handle<PropertyCell> cell, ...@@ -17156,9 +17156,8 @@ PropertyCellType PropertyCell::UpdatedType(Handle<PropertyCell> cell,
} }
Handle<Object> PropertyCell::UpdateCell(Handle<NameDictionary> dictionary, void PropertyCell::UpdateCell(Handle<NameDictionary> dictionary, int entry,
int entry, Handle<Object> value, Handle<Object> value, PropertyDetails details) {
PropertyDetails details) {
DCHECK(!value->IsTheHole()); DCHECK(!value->IsTheHole());
DCHECK(dictionary->ValueAt(entry)->IsPropertyCell()); DCHECK(dictionary->ValueAt(entry)->IsPropertyCell());
Handle<PropertyCell> cell(PropertyCell::cast(dictionary->ValueAt(entry))); Handle<PropertyCell> cell(PropertyCell::cast(dictionary->ValueAt(entry)));
...@@ -17179,18 +17178,6 @@ Handle<Object> PropertyCell::UpdateCell(Handle<NameDictionary> dictionary, ...@@ -17179,18 +17178,6 @@ Handle<Object> PropertyCell::UpdateCell(Handle<NameDictionary> dictionary,
DCHECK(index > 0); DCHECK(index > 0);
details = details.set_index(index); details = details.set_index(index);
// Heuristic: if a small-ish string is stored in a previously uninitialized
// property cell, internalize it.
const int kMaxLengthForInternalization = 200;
if ((old_type == PropertyCellType::kUninitialized ||
old_type == PropertyCellType::kUndefined) &&
value->IsString()) {
auto string = Handle<String>::cast(value);
if (string->length() <= kMaxLengthForInternalization) {
value = cell->GetIsolate()->factory()->InternalizeString(string);
}
}
auto new_type = UpdatedType(cell, value, original_details); auto new_type = UpdatedType(cell, value, original_details);
if (invalidate) cell = PropertyCell::InvalidateEntry(dictionary, entry); if (invalidate) cell = PropertyCell::InvalidateEntry(dictionary, entry);
...@@ -17205,7 +17192,6 @@ Handle<Object> PropertyCell::UpdateCell(Handle<NameDictionary> dictionary, ...@@ -17205,7 +17192,6 @@ Handle<Object> PropertyCell::UpdateCell(Handle<NameDictionary> dictionary,
cell->dependent_code()->DeoptimizeDependentCodeGroup( cell->dependent_code()->DeoptimizeDependentCodeGroup(
isolate, DependentCode::kPropertyCellChangedGroup); isolate, DependentCode::kPropertyCellChangedGroup);
} }
return value;
} }
......
...@@ -9848,9 +9848,8 @@ class PropertyCell : public HeapObject { ...@@ -9848,9 +9848,8 @@ class PropertyCell : public HeapObject {
static PropertyCellType UpdatedType(Handle<PropertyCell> cell, static PropertyCellType UpdatedType(Handle<PropertyCell> cell,
Handle<Object> value, Handle<Object> value,
PropertyDetails details); PropertyDetails details);
static Handle<Object> UpdateCell(Handle<NameDictionary> dictionary, int entry, static void UpdateCell(Handle<NameDictionary> dictionary, int entry,
Handle<Object> value, Handle<Object> value, PropertyDetails details);
PropertyDetails details);
static Handle<PropertyCell> InvalidateEntry(Handle<NameDictionary> dictionary, static Handle<PropertyCell> InvalidateEntry(Handle<NameDictionary> dictionary,
int entry); int entry);
......
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