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(
CHECK_EQ(LookupIterator::ACCESSOR, it.state());
DCHECK(it.HolderIsReceiverOrHiddenPrototype());
it.ReconfigureDataProperty(value, it.property_details().attributes());
value = it.WriteDataValue(value);
it.WriteDataValue(value);
if (is_observed && !old_value->SameValue(*value)) {
return JSObject::EnqueueChangeRecord(object, "update", name, old_value);
......
......@@ -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_);
Handle<JSObject> holder = GetHolder<JSObject>();
if (holder_map_->is_dictionary_map()) {
Handle<NameDictionary> property_dictionary =
handle(holder->property_dictionary());
if (holder->IsGlobalObject()) {
value = PropertyCell::UpdateCell(property_dictionary, dictionary_entry(),
value, property_details_);
PropertyCell::UpdateCell(property_dictionary, dictionary_entry(), value,
property_details_);
} else {
property_dictionary->ValueAtPut(dictionary_entry(), *value);
}
......@@ -349,7 +349,6 @@ Handle<Object> LookupIterator::WriteDataValue(Handle<Object> value) {
} else {
DCHECK_EQ(v8::internal::DATA_CONSTANT, property_details_.type());
}
return value;
}
......
......@@ -142,7 +142,7 @@ class LookupIterator final BASE_EMBEDDED {
Handle<Object> GetDataValue() const;
// Usually returns the value that was passed in, but may perform
// non-observable modifications on it, such as internalize strings.
Handle<Object> WriteDataValue(Handle<Object> value);
void WriteDataValue(Handle<Object> value);
void InternalizeName();
private:
......
......@@ -3374,7 +3374,7 @@ MaybeHandle<Object> Object::SetDataProperty(LookupIterator* it,
it->PrepareForDataProperty(value);
// Write the property value.
value = it->WriteDataValue(value);
it->WriteDataValue(value);
// Send the change record if there are observers.
if (is_observed && !value->SameValue(*maybe_old.ToHandleChecked())) {
......@@ -3429,7 +3429,7 @@ MaybeHandle<Object> Object::AddDataProperty(LookupIterator* it,
JSObject::AddSlowProperty(receiver, it->name(), value, attributes);
} else {
// Write the property value.
value = it->WriteDataValue(value);
it->WriteDataValue(value);
}
// Send the change record if there are observers.
......@@ -4293,7 +4293,7 @@ MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes(
}
it.ReconfigureDataProperty(value, attributes);
value = it.WriteDataValue(value);
it.WriteDataValue(value);
if (is_observed) {
RETURN_ON_EXCEPTION(
......@@ -4317,7 +4317,7 @@ MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes(
if (is_observed) old_value = it.GetDataValue();
it.ReconfigureDataProperty(value, attributes);
value = it.WriteDataValue(value);
it.WriteDataValue(value);
if (is_observed) {
if (old_value->SameValue(*value)) {
......@@ -17156,9 +17156,8 @@ PropertyCellType PropertyCell::UpdatedType(Handle<PropertyCell> cell,
}
Handle<Object> PropertyCell::UpdateCell(Handle<NameDictionary> dictionary,
int entry, Handle<Object> value,
PropertyDetails details) {
void PropertyCell::UpdateCell(Handle<NameDictionary> dictionary, int entry,
Handle<Object> value, PropertyDetails details) {
DCHECK(!value->IsTheHole());
DCHECK(dictionary->ValueAt(entry)->IsPropertyCell());
Handle<PropertyCell> cell(PropertyCell::cast(dictionary->ValueAt(entry)));
......@@ -17179,18 +17178,6 @@ Handle<Object> PropertyCell::UpdateCell(Handle<NameDictionary> dictionary,
DCHECK(index > 0);
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);
if (invalidate) cell = PropertyCell::InvalidateEntry(dictionary, entry);
......@@ -17205,7 +17192,6 @@ Handle<Object> PropertyCell::UpdateCell(Handle<NameDictionary> dictionary,
cell->dependent_code()->DeoptimizeDependentCodeGroup(
isolate, DependentCode::kPropertyCellChangedGroup);
}
return value;
}
......
......@@ -9848,9 +9848,8 @@ class PropertyCell : public HeapObject {
static PropertyCellType UpdatedType(Handle<PropertyCell> cell,
Handle<Object> value,
PropertyDetails details);
static Handle<Object> UpdateCell(Handle<NameDictionary> dictionary, int entry,
Handle<Object> value,
PropertyDetails details);
static void UpdateCell(Handle<NameDictionary> dictionary, int entry,
Handle<Object> value, PropertyDetails details);
static Handle<PropertyCell> InvalidateEntry(Handle<NameDictionary> dictionary,
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