| Index: src/objects.cc
|
| diff --git a/src/objects.cc b/src/objects.cc
|
| index 20fd66b37eb90b1f1523627350edace29096bfa9..033a8fccf1f19d1a1bd1d1997db567298bb8b3d1 100644
|
| --- a/src/objects.cc
|
| +++ b/src/objects.cc
|
| @@ -1752,9 +1752,7 @@ void JSObject::AddSlowProperty(Handle<JSObject> object,
|
| dict->SetEntry(entry, name, cell, details);
|
| return;
|
| }
|
| - Handle<PropertyCell> cell = isolate->factory()->NewPropertyCell(value);
|
| - PropertyCell::SetValueInferType(cell, value);
|
| - value = cell;
|
| + value = isolate->factory()->NewPropertyCell(value);
|
| }
|
| PropertyDetails details(attributes, DATA, 0);
|
| Handle<NameDictionary> result =
|
| @@ -3056,6 +3054,7 @@ MaybeHandle<Object> Object::AddDataProperty(LookupIterator* it,
|
| if (receiver->map()->is_dictionary_map()) {
|
| // TODO(verwaest): Probably should ensure this is done beforehand.
|
| it->InternalizeName();
|
| + // TODO(dcarney): just populate TransitionPropertyCell here?
|
| JSObject::AddSlowProperty(receiver, it->name(), value, attributes);
|
| } else {
|
| // Write the property value.
|
| @@ -15133,15 +15132,13 @@ void GlobalObject::InvalidatePropertyCell(Handle<GlobalObject> global,
|
| }
|
|
|
|
|
| -Handle<PropertyCell> JSGlobalObject::EnsurePropertyCell(
|
| - Handle<JSGlobalObject> global,
|
| - Handle<Name> name) {
|
| +Handle<PropertyCell> GlobalObject::EnsurePropertyCell(
|
| + Handle<GlobalObject> global, Handle<Name> name) {
|
| DCHECK(!global->HasFastProperties());
|
| int entry = global->property_dictionary()->FindEntry(name);
|
| if (entry == NameDictionary::kNotFound) {
|
| Isolate* isolate = global->GetIsolate();
|
| - Handle<PropertyCell> cell = isolate->factory()->NewPropertyCell(
|
| - isolate->factory()->the_hole_value());
|
| + Handle<PropertyCell> cell = isolate->factory()->NewPropertyCellWithHole();
|
| PropertyDetails details(NONE, DATA, 0);
|
| details = details.AsDeleted();
|
| Handle<NameDictionary> dictionary = NameDictionary::Add(
|
| @@ -16940,10 +16937,12 @@ Handle<Object> PropertyCell::SetValueInferType(Handle<PropertyCell> cell,
|
| const int kMaxLengthForInternalization = 200;
|
| if ((cell->type()->Is(HeapType::None()) ||
|
| cell->type()->Is(HeapType::Undefined())) &&
|
| - value->IsString() &&
|
| - Handle<String>::cast(value)->length() <= kMaxLengthForInternalization) {
|
| - value = cell->GetIsolate()->factory()->InternalizeString(
|
| - Handle<String>::cast(value));
|
| + value->IsString()) {
|
| + auto string = Handle<String>::cast(value);
|
| + if (string->length() <= kMaxLengthForInternalization &&
|
| + !string->map()->is_undetectable()) {
|
| + value = cell->GetIsolate()->factory()->InternalizeString(string);
|
| + }
|
| }
|
| cell->set_value(*value);
|
| if (!HeapType::Any()->Is(cell->type())) {
|
|
|