Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(685)

Unified Diff: src/lookup.cc

Issue 1177043012: More cleanly separate adding from setting elements (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rename Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lookup.cc
diff --git a/src/lookup.cc b/src/lookup.cc
index b91ad4c9f4bb9ec1b12db7e548bfac0fe27e2fc0..783c3f7536b69a423388f54702943a16b4b35c87 100644
--- a/src/lookup.cc
+++ b/src/lookup.cc
@@ -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,
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698