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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <iomanip> 5 #include <iomanip>
6 #include <sstream> 6 #include <sstream>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 5451 matching lines...) Expand 10 before | Expand all | Expand 10 after
5462 break; 5462 break;
5463 } 5463 }
5464 case LookupIterator::INTEGER_INDEXED_EXOTIC: 5464 case LookupIterator::INTEGER_INDEXED_EXOTIC:
5465 return it.isolate()->factory()->true_value(); 5465 return it.isolate()->factory()->true_value();
5466 case LookupIterator::DATA: 5466 case LookupIterator::DATA:
5467 if (is_observed) { 5467 if (is_observed) {
5468 old_value = it.GetDataValue(); 5468 old_value = it.GetDataValue();
5469 } 5469 }
5470 // Fall through. 5470 // Fall through.
5471 case LookupIterator::ACCESSOR: { 5471 case LookupIterator::ACCESSOR: {
5472 if (!it.IsConfigurable()) { 5472 if (!it.IsConfigurable() || object->map()->is_strong()) {
5473 // Fail if the property is not configurable. 5473 // Fail if the property is not configurable, or on a strong object.
5474 if (is_strict(language_mode)) { 5474 if (is_strict(language_mode)) {
5475 if (object->map()->is_strong()) {
5476 THROW_NEW_ERROR(
5477 it.isolate(),
5478 NewTypeError(MessageTemplate::kStrongDeleteProperty, object,
5479 name),
5480 Object);
5481 }
5475 THROW_NEW_ERROR(it.isolate(), 5482 THROW_NEW_ERROR(it.isolate(),
5476 NewTypeError(MessageTemplate::kStrictDeleteProperty, 5483 NewTypeError(MessageTemplate::kStrictDeleteProperty,
5477 name, object), 5484 name, object),
5478 Object); 5485 Object);
5479 } 5486 }
5480 return it.isolate()->factory()->false_value(); 5487 return it.isolate()->factory()->false_value();
5481 } 5488 }
5482 5489
5483 PropertyNormalizationMode mode = object->map()->is_prototype_map() 5490 PropertyNormalizationMode mode = object->map()->is_prototype_map()
5484 ? KEEP_INOBJECT_PROPERTIES 5491 ? KEEP_INOBJECT_PROPERTIES
(...skipping 9506 matching lines...) Expand 10 before | Expand all | Expand 10 after
14991 template Object* 14998 template Object*
14992 Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>:: 14999 Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
14993 SlowReverseLookup(Object* value); 15000 SlowReverseLookup(Object* value);
14994 15001
14995 template Object* 15002 template Object*
14996 Dictionary<NameDictionary, NameDictionaryShape, Handle<Name> >:: 15003 Dictionary<NameDictionary, NameDictionaryShape, Handle<Name> >::
14997 SlowReverseLookup(Object* value); 15004 SlowReverseLookup(Object* value);
14998 15005
14999 template Handle<Object> 15006 template Handle<Object>
15000 Dictionary<NameDictionary, NameDictionaryShape, Handle<Name> >::DeleteProperty( 15007 Dictionary<NameDictionary, NameDictionaryShape, Handle<Name> >::DeleteProperty(
15001 Handle<NameDictionary>, int); 15008 Handle<NameDictionary>, int, bool);
15002 15009
15003 template Handle<Object> 15010 template Handle<Object>
15004 Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, 15011 Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape,
15005 uint32_t>::DeleteProperty(Handle<SeededNumberDictionary>, int); 15012 uint32_t>::DeleteProperty(Handle<SeededNumberDictionary>, int, bool);
15006 15013
15007 template Handle<NameDictionary> 15014 template Handle<NameDictionary>
15008 HashTable<NameDictionary, NameDictionaryShape, Handle<Name> >:: 15015 HashTable<NameDictionary, NameDictionaryShape, Handle<Name> >::
15009 New(Isolate*, int, MinimumCapacity, PretenureFlag); 15016 New(Isolate*, int, MinimumCapacity, PretenureFlag);
15010 15017
15011 template Handle<NameDictionary> 15018 template Handle<NameDictionary>
15012 HashTable<NameDictionary, NameDictionaryShape, Handle<Name> >:: 15019 HashTable<NameDictionary, NameDictionaryShape, Handle<Name> >::
15013 Shrink(Handle<NameDictionary>, Handle<Name>); 15020 Shrink(Handle<NameDictionary>, Handle<Name>);
15014 15021
15015 template Handle<SeededNumberDictionary> 15022 template Handle<SeededNumberDictionary>
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
15964 !PropertyDetails::IsValidIndex(dictionary->NextEnumerationIndex() + n)) { 15971 !PropertyDetails::IsValidIndex(dictionary->NextEnumerationIndex() + n)) {
15965 // If not, we generate new indices for the properties. 15972 // If not, we generate new indices for the properties.
15966 GenerateNewEnumerationIndices(dictionary); 15973 GenerateNewEnumerationIndices(dictionary);
15967 } 15974 }
15968 return DerivedHashTable::EnsureCapacity(dictionary, n, key); 15975 return DerivedHashTable::EnsureCapacity(dictionary, n, key);
15969 } 15976 }
15970 15977
15971 15978
15972 template <typename Derived, typename Shape, typename Key> 15979 template <typename Derived, typename Shape, typename Key>
15973 Handle<Object> Dictionary<Derived, Shape, Key>::DeleteProperty( 15980 Handle<Object> Dictionary<Derived, Shape, Key>::DeleteProperty(
15974 Handle<Derived> dictionary, int entry) { 15981 Handle<Derived> dictionary, int entry, bool strong_obj) {
15975 Factory* factory = dictionary->GetIsolate()->factory(); 15982 Factory* factory = dictionary->GetIsolate()->factory();
15976 PropertyDetails details = dictionary->DetailsAt(entry); 15983 PropertyDetails details = dictionary->DetailsAt(entry);
15977 if (!details.IsConfigurable()) return factory->false_value(); 15984 if (!details.IsConfigurable() || strong_obj) return factory->false_value();
15978 15985
15979 dictionary->SetEntry( 15986 dictionary->SetEntry(
15980 entry, factory->the_hole_value(), factory->the_hole_value()); 15987 entry, factory->the_hole_value(), factory->the_hole_value());
15981 dictionary->ElementRemoved(); 15988 dictionary->ElementRemoved();
15982 return factory->true_value(); 15989 return factory->true_value();
15983 } 15990 }
15984 15991
15985 15992
15986 template<typename Derived, typename Shape, typename Key> 15993 template<typename Derived, typename Shape, typename Key>
15987 Handle<Derived> Dictionary<Derived, Shape, Key>::AtPut( 15994 Handle<Derived> Dictionary<Derived, Shape, Key>::AtPut(
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after
17253 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell, 17260 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell,
17254 Handle<Object> new_value) { 17261 Handle<Object> new_value) {
17255 if (cell->value() != *new_value) { 17262 if (cell->value() != *new_value) {
17256 cell->set_value(*new_value); 17263 cell->set_value(*new_value);
17257 Isolate* isolate = cell->GetIsolate(); 17264 Isolate* isolate = cell->GetIsolate();
17258 cell->dependent_code()->DeoptimizeDependentCodeGroup( 17265 cell->dependent_code()->DeoptimizeDependentCodeGroup(
17259 isolate, DependentCode::kPropertyCellChangedGroup); 17266 isolate, DependentCode::kPropertyCellChangedGroup);
17260 } 17267 }
17261 } 17268 }
17262 } } // namespace v8::internal 17269 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698