Commit 6a3ba3cc authored by verwaest's avatar verwaest Committed by Commit bot

More cleanly separate adding from setting elements

This is a first step towards disentangling the backend code. In the future we should just use ElementsAccessors.
BUG=v8:4137
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#29111}
parent aac18f39
......@@ -173,21 +173,17 @@ void LookupIterator::ReconfigureDataProperty(Handle<Object> value,
Handle<JSObject> holder = GetHolder<JSObject>();
if (IsElement()) {
// TODO(verwaest): Clean up.
if (attributes == NONE && !holder->HasDictionaryElements() &&
!holder->HasDictionaryArgumentsElements()) {
ElementsAccessor* accessor = holder->GetElementsAccessor();
accessor->Set(holder, index(), value);
DCHECK(holder->HasFastElements() || holder->HasDictionaryElements() ||
holder->HasSloppyArgumentsElements());
DCHECK(attributes != NONE || !holder->HasFastElements());
Handle<SeededNumberDictionary> d = JSObject::NormalizeElements(holder);
// TODO(verwaest): Move this into NormalizeElements.
d->set_requires_slow_elements();
if (holder->HasDictionaryElements()) {
JSObject::SetDictionaryElement(holder, index(), value, attributes);
} else {
DCHECK(holder->HasFastElements() || holder->HasDictionaryElements() ||
holder->HasSloppyArgumentsElements());
Handle<SeededNumberDictionary> d = JSObject::NormalizeElements(holder);
// TODO(verwaest): Move this into NormalizeElements.
d->set_requires_slow_elements();
if (holder->HasDictionaryElements()) {
JSObject::SetDictionaryElement(holder, index(), value, attributes);
} else {
JSObject::SetSloppyArgumentsElement(holder, index(), value, attributes);
}
JSObject::SetDictionaryArgumentsElement(holder, index(), value,
attributes);
}
} else if (holder_map_->is_dictionary_map()) {
PropertyDetails details(attributes, v8::internal::DATA, 0,
......
This diff is collapsed.
......@@ -1899,16 +1899,23 @@ class JSObject: public JSReceiver {
static void SetNormalizedProperty(Handle<JSObject> object, Handle<Name> name,
Handle<Object> value,
PropertyDetails details);
static void SetDictionaryElement(Handle<JSObject> object, uint32_t index,
static void AddDictionaryElement(Handle<JSObject> object, uint32_t index,
Handle<Object> value,
PropertyAttributes attributes);
static void SetSloppyArgumentsElement(Handle<JSObject> object, uint32_t index,
static void AddSloppyArgumentsElement(Handle<JSObject> object, uint32_t index,
Handle<Object> value,
PropertyAttributes attributes);
static void SetDictionaryElement(Handle<JSObject> object, uint32_t index,
Handle<Object> value,
PropertyAttributes attributes);
static void SetDictionaryArgumentsElement(Handle<JSObject> object,
uint32_t index,
Handle<Object> value,
PropertyAttributes attributes);
static void SetFastElement(Handle<JSObject> object, uint32_t index,
static void AddFastElement(Handle<JSObject> object, uint32_t index,
Handle<Object> value);
static void SetFastDoubleElement(Handle<JSObject> object, uint32_t index,
static void AddFastDoubleElement(Handle<JSObject> object, uint32_t index,
Handle<Object> value);
static void OptimizeAsPrototype(Handle<JSObject> object,
......
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