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

Unified Diff: src/objects.cc

Issue 1218813012: Cleanup Delete backend implementation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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/objects.h ('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 719aa9d754c64798c6029878b9eecfb1255950d8..24b54c0d4a3710160d5cde7b57d2bb9a732c2a86 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -5145,14 +5145,13 @@ MaybeHandle<Object> JSObject::DeletePropertyWithInterceptor(
void JSObject::DeleteNormalizedProperty(Handle<JSObject> object,
- Handle<Name> name) {
+ Handle<Name> name, int entry) {
DCHECK(!object->HasFastProperties());
Isolate* isolate = object->GetIsolate();
if (object->IsGlobalObject()) {
// If we have a global object, invalidate the cell and swap in a new one.
Handle<GlobalDictionary> dictionary(object->global_dictionary());
- int entry = dictionary->FindEntry(name);
DCHECK_NE(GlobalDictionary::kNotFound, entry);
auto cell = PropertyCell::InvalidateEntry(dictionary, entry);
@@ -5162,7 +5161,6 @@ void JSObject::DeleteNormalizedProperty(Handle<JSObject> object,
cell->property_details().set_cell_type(PropertyCellType::kInvalidated));
} else {
Handle<NameDictionary> dictionary(object->property_dictionary());
- int entry = dictionary->FindEntry(name);
DCHECK_NE(NameDictionary::kNotFound, entry);
NameDictionary::DeleteProperty(dictionary, entry);
@@ -5221,16 +5219,12 @@ MaybeHandle<Object> JSReceiver::DeleteProperty(LookupIterator* it,
if (!it->IsConfigurable() || receiver->map()->is_strong()) {
// Fail if the property is not configurable, or on a strong object.
if (is_strict(language_mode)) {
- if (receiver->map()->is_strong()) {
- THROW_NEW_ERROR(
- isolate, NewTypeError(MessageTemplate::kStrongDeleteProperty,
- receiver, it->GetName()),
- Object);
- }
- THROW_NEW_ERROR(isolate,
- NewTypeError(MessageTemplate::kStrictDeleteProperty,
- it->GetName(), receiver),
- Object);
+ MessageTemplate::Template templ =
+ receiver->map()->is_strong()
+ ? MessageTemplate::kStrongDeleteProperty
+ : MessageTemplate::kStrictDeleteProperty;
+ THROW_NEW_ERROR(
+ isolate, NewTypeError(templ, it->GetName(), receiver), Object);
}
return it->factory()->false_value();
}
@@ -5243,18 +5237,7 @@ MaybeHandle<Object> JSReceiver::DeleteProperty(LookupIterator* it,
return it->factory()->true_value();
}
- if (it->IsElement()) {
- ElementsAccessor* accessor = holder->GetElementsAccessor();
- accessor->Delete(holder, it->index(), language_mode);
- } else {
- PropertyNormalizationMode mode = holder->map()->is_prototype_map()
- ? KEEP_INOBJECT_PROPERTIES
- : CLEAR_INOBJECT_PROPERTIES;
-
- JSObject::NormalizeProperties(holder, mode, 0, "DeletingProperty");
- JSObject::DeleteNormalizedProperty(holder, it->name());
- JSObject::ReoptimizeIfPrototype(holder);
- }
+ it->Delete();
if (is_observed) {
RETURN_ON_EXCEPTION(isolate,
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698