Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 850b6ff49f1a0e31222d599cd7172c2f718fef71..934c8f39335e3dcdecfcf55ede0e0f3220ea540c 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -4215,13 +4215,7 @@ MaybeHandle<Object> JSObject::DefineOwnPropertyIgnoreAttributes( |
ExecutableAccessorInfo::ClearSetter(new_data); |
} |
- if (it->IsElement()) { |
- SetElementCallback(it->GetHolder<JSObject>(), it->index(), new_data, |
- attributes); |
- } else { |
- SetPropertyCallback(it->GetHolder<JSObject>(), it->name(), new_data, |
- attributes); |
- } |
+ it->TransitionToAccessorPair(new_data, attributes); |
} else { |
it->ReconfigureDataProperty(value, attributes); |
it->WriteDataValue(value); |
@@ -6259,66 +6253,6 @@ bool Map::DictionaryElementsInPrototypeChainOnly() { |
} |
-void JSObject::SetElementCallback(Handle<JSObject> object, |
- uint32_t index, |
- Handle<Object> structure, |
- PropertyAttributes attributes) { |
- Heap* heap = object->GetHeap(); |
- PropertyDetails details = PropertyDetails(attributes, ACCESSOR_CONSTANT, 0, |
- PropertyCellType::kNoCell); |
- |
- // Normalize elements to make this operation simple. |
- bool had_dictionary_elements = object->HasDictionaryElements(); |
- Handle<SeededNumberDictionary> dictionary = NormalizeElements(object); |
- DCHECK(object->HasDictionaryElements() || object->HasSlowArgumentsElements()); |
- // Update the dictionary with the new ACCESSOR_CONSTANT property. |
- dictionary = SeededNumberDictionary::Set(dictionary, index, structure, |
- details); |
- dictionary->set_requires_slow_elements(); |
- |
- // Update the dictionary backing store on the object. |
- if (object->elements()->map() == heap->sloppy_arguments_elements_map()) { |
- // Also delete any parameter alias. |
- // |
- // TODO(kmillikin): when deleting the last parameter alias we could |
- // switch to a direct backing store without the parameter map. This |
- // would allow GC of the context. |
- FixedArray* parameter_map = FixedArray::cast(object->elements()); |
- if (index < static_cast<uint32_t>(parameter_map->length()) - 2) { |
- parameter_map->set(index + 2, heap->the_hole_value()); |
- } |
- parameter_map->set(1, *dictionary); |
- } else { |
- object->set_elements(*dictionary); |
- |
- if (!had_dictionary_elements) { |
- // KeyedStoreICs (at least the non-generic ones) need a reset. |
- heap->ClearAllICsByKind(Code::KEYED_STORE_IC); |
- } |
- } |
-} |
- |
- |
-void JSObject::SetPropertyCallback(Handle<JSObject> object, |
- Handle<Name> name, |
- Handle<Object> structure, |
- PropertyAttributes attributes) { |
- PropertyNormalizationMode mode = object->map()->is_prototype_map() |
- ? KEEP_INOBJECT_PROPERTIES |
- : CLEAR_INOBJECT_PROPERTIES; |
- // Normalize object to make this operation simple. |
- NormalizeProperties(object, mode, 0, "SetPropertyCallback"); |
- |
- |
- // Update the dictionary with the new ACCESSOR_CONSTANT property. |
- PropertyDetails details = PropertyDetails(attributes, ACCESSOR_CONSTANT, 0, |
- PropertyCellType::kMutable); |
- SetNormalizedProperty(object, name, structure, details); |
- |
- ReoptimizeIfPrototype(object); |
-} |
- |
- |
MaybeHandle<Object> JSObject::DefineAccessor(Handle<JSObject> object, |
Handle<Name> name, |
Handle<Object> getter, |
@@ -6428,11 +6362,7 @@ MaybeHandle<Object> JSObject::SetAccessor(Handle<JSObject> object, |
return it.factory()->undefined_value(); |
} |
- if (it.IsElement()) { |
- SetElementCallback(object, it.index(), info, info->property_attributes()); |
- } else { |
- SetPropertyCallback(object, name, info, info->property_attributes()); |
- } |
+ it.TransitionToAccessorPair(info, info->property_attributes()); |
return object; |
} |