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

Unified Diff: src/objects.cc

Issue 1207613005: Move reconfiguration into the elements accessor (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « src/lookup.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index bd40f4eb599611bdb6067c0adc1ced3ca1148915..df60b493f97eac7e33e56fd3903b0cbe0265c213 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -12391,89 +12391,6 @@ static void AddDictionaryElement(Handle<JSObject> object,
}
-void JSObject::SetDictionaryArgumentsElement(Handle<JSObject> object,
- uint32_t index,
- Handle<Object> value,
- PropertyAttributes attributes) {
- // TODO(verwaest): Handle with the elements accessor.
- Isolate* isolate = object->GetIsolate();
-
- DCHECK(object->HasDictionaryArgumentsElements());
-
- Handle<FixedArray> parameter_map(FixedArray::cast(object->elements()));
- uint32_t length = parameter_map->length();
- Handle<Object> probe =
- index < length - 2
- ? handle(parameter_map->get(index + 2), isolate)
- : Handle<Object>::cast(isolate->factory()->the_hole_value());
- if (!probe->IsTheHole()) {
- Handle<Context> context(Context::cast(parameter_map->get(0)));
- int context_index = Handle<Smi>::cast(probe)->value();
- DCHECK(!context->get(context_index)->IsTheHole());
- context->set(context_index, *value);
-
- DCHECK_NE(NONE, attributes);
-
- // Redefining attributes of an aliased element destroys fast aliasing.
- parameter_map->set_the_hole(index + 2);
- // For elements that are still writable we re-establish slow aliasing.
- if ((attributes & READ_ONLY) == 0) {
- value = isolate->factory()->NewAliasedArgumentsEntry(context_index);
- }
- Handle<SeededNumberDictionary> dictionary(
- SeededNumberDictionary::cast(parameter_map->get(1)));
- AddDictionaryElement(object, dictionary, index, value, attributes);
- } else {
- SetDictionaryElement(object, index, value, attributes);
- }
-}
-
-
-void JSObject::SetDictionaryElement(Handle<JSObject> object, uint32_t index,
- Handle<Object> value,
- PropertyAttributes attributes) {
- // TODO(verwaest): Handle with the elements accessor.
- Isolate* isolate = object->GetIsolate();
-
- // Insert element in the dictionary.
- Handle<FixedArray> elements(FixedArray::cast(object->elements()));
- bool is_arguments =
- (elements->map() == isolate->heap()->sloppy_arguments_elements_map());
-
- DCHECK(object->HasDictionaryElements() ||
- object->HasDictionaryArgumentsElements());
-
- Handle<SeededNumberDictionary> dictionary(is_arguments
- ? SeededNumberDictionary::cast(elements->get(1))
- : SeededNumberDictionary::cast(*elements));
-
- int entry = dictionary->FindEntry(index);
- DCHECK_NE(SeededNumberDictionary::kNotFound, entry);
-
- PropertyDetails details = dictionary->DetailsAt(entry);
- details = PropertyDetails(attributes, DATA, details.dictionary_index(),
- PropertyCellType::kNoCell);
- dictionary->DetailsAtPut(entry, details);
-
- // Elements of the arguments object in slow mode might be slow aliases.
- if (is_arguments) {
- Handle<Object> element(dictionary->ValueAt(entry), isolate);
- if (element->IsAliasedArgumentsEntry()) {
- Handle<AliasedArgumentsEntry> entry =
- Handle<AliasedArgumentsEntry>::cast(element);
- Handle<Context> context(Context::cast(elements->get(0)));
- int context_index = entry->aliased_context_slot();
- DCHECK(!context->get(context_index)->IsTheHole());
- context->set(context_index, *value);
- // For elements that are still writable we keep slow aliasing.
- if (!details.IsReadOnly()) value = element;
- }
- }
-
- dictionary->ValueAtPut(entry, *value);
-}
-
-
// static
MaybeHandle<Object> JSReceiver::SetElement(Handle<JSReceiver> object,
uint32_t index, Handle<Object> value,
« no previous file with comments | « src/lookup.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698