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

Unified Diff: src/objects.cc

Issue 1156573002: [strong] Implement per-object restrictions behaviour of delete operator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cl feedback Created 5 years, 7 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
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index ecb5bf1b5164265ae48d7f4be04d01181a7c8c65..c5bb190be5c17f60494656d15be769c570c7db40 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -5469,9 +5469,16 @@ MaybeHandle<Object> JSObject::DeleteProperty(Handle<JSObject> object,
}
// Fall through.
case LookupIterator::ACCESSOR: {
- if (!it.IsConfigurable()) {
- // Fail if the property is not configurable.
+ if (!it.IsConfigurable() || object->map()->is_strong()) {
+ // Fail if the property is not configurable, or on a strong object.
if (is_strict(language_mode)) {
+ if (object->map()->is_strong()) {
+ THROW_NEW_ERROR(
+ it.isolate(),
+ NewTypeError(MessageTemplate::kStrongDeleteProperty, object,
+ name),
+ Object);
+ }
THROW_NEW_ERROR(it.isolate(),
NewTypeError(MessageTemplate::kStrictDeleteProperty,
name, object),
@@ -14998,11 +15005,11 @@ Dictionary<NameDictionary, NameDictionaryShape, Handle<Name> >::
template Handle<Object>
Dictionary<NameDictionary, NameDictionaryShape, Handle<Name> >::DeleteProperty(
- Handle<NameDictionary>, int);
+ Handle<NameDictionary>, int, bool);
template Handle<Object>
Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape,
- uint32_t>::DeleteProperty(Handle<SeededNumberDictionary>, int);
+ uint32_t>::DeleteProperty(Handle<SeededNumberDictionary>, int, bool);
template Handle<NameDictionary>
HashTable<NameDictionary, NameDictionaryShape, Handle<Name> >::
@@ -15971,10 +15978,10 @@ Handle<Derived> Dictionary<Derived, Shape, Key>::EnsureCapacity(
template <typename Derived, typename Shape, typename Key>
Handle<Object> Dictionary<Derived, Shape, Key>::DeleteProperty(
- Handle<Derived> dictionary, int entry) {
+ Handle<Derived> dictionary, int entry, bool strong_obj) {
Factory* factory = dictionary->GetIsolate()->factory();
PropertyDetails details = dictionary->DetailsAt(entry);
- if (!details.IsConfigurable()) return factory->false_value();
+ if (!details.IsConfigurable() || strong_obj) return factory->false_value();
dictionary->SetEntry(
entry, factory->the_hole_value(), factory->the_hole_value());

Powered by Google App Engine
This is Rietveld 408576698