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