OLD | NEW |
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 "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 Handle<Name> name, | 702 Handle<Name> name, |
703 DeleteMode mode) { | 703 DeleteMode mode) { |
704 DCHECK(!object->HasFastProperties()); | 704 DCHECK(!object->HasFastProperties()); |
705 Isolate* isolate = object->GetIsolate(); | 705 Isolate* isolate = object->GetIsolate(); |
706 Handle<NameDictionary> dictionary(object->property_dictionary()); | 706 Handle<NameDictionary> dictionary(object->property_dictionary()); |
707 int entry = dictionary->FindEntry(name); | 707 int entry = dictionary->FindEntry(name); |
708 if (entry != NameDictionary::kNotFound) { | 708 if (entry != NameDictionary::kNotFound) { |
709 // If we have a global object set the cell to the hole. | 709 // If we have a global object set the cell to the hole. |
710 if (object->IsGlobalObject()) { | 710 if (object->IsGlobalObject()) { |
711 PropertyDetails details = dictionary->DetailsAt(entry); | 711 PropertyDetails details = dictionary->DetailsAt(entry); |
712 if (details.IsDontDelete()) { | 712 if (!details.IsConfigurable()) { |
713 if (mode != FORCE_DELETION) return isolate->factory()->false_value(); | 713 if (mode != FORCE_DELETION) return isolate->factory()->false_value(); |
714 // When forced to delete global properties, we have to make a | 714 // When forced to delete global properties, we have to make a |
715 // map change to invalidate any ICs that think they can load | 715 // map change to invalidate any ICs that think they can load |
716 // from the DontDelete cell without checking if it contains | 716 // from the non-configurable cell without checking if it contains |
717 // the hole value. | 717 // the hole value. |
718 Handle<Map> new_map = Map::CopyDropDescriptors(handle(object->map())); | 718 Handle<Map> new_map = Map::CopyDropDescriptors(handle(object->map())); |
719 DCHECK(new_map->is_dictionary_map()); | 719 DCHECK(new_map->is_dictionary_map()); |
720 JSObject::MigrateToMap(object, new_map); | 720 JSObject::MigrateToMap(object, new_map); |
721 } | 721 } |
722 Handle<PropertyCell> cell(PropertyCell::cast(dictionary->ValueAt(entry))); | 722 Handle<PropertyCell> cell(PropertyCell::cast(dictionary->ValueAt(entry))); |
723 Handle<Object> value = isolate->factory()->the_hole_value(); | 723 Handle<Object> value = isolate->factory()->the_hole_value(); |
724 PropertyCell::SetValueInferType(cell, value); | 724 PropertyCell::SetValueInferType(cell, value); |
725 dictionary->DetailsAtPut(entry, details.AsDeleted()); | 725 dictionary->DetailsAtPut(entry, details.AsDeleted()); |
726 } else { | 726 } else { |
(...skipping 5274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6001 SeededNumberDictionary* dictionary, | 6001 SeededNumberDictionary* dictionary, |
6002 uint32_t index, | 6002 uint32_t index, |
6003 Object* getter, | 6003 Object* getter, |
6004 Object* setter, | 6004 Object* setter, |
6005 PropertyAttributes attributes) { | 6005 PropertyAttributes attributes) { |
6006 int entry = dictionary->FindEntry(index); | 6006 int entry = dictionary->FindEntry(index); |
6007 if (entry != SeededNumberDictionary::kNotFound) { | 6007 if (entry != SeededNumberDictionary::kNotFound) { |
6008 Object* result = dictionary->ValueAt(entry); | 6008 Object* result = dictionary->ValueAt(entry); |
6009 PropertyDetails details = dictionary->DetailsAt(entry); | 6009 PropertyDetails details = dictionary->DetailsAt(entry); |
6010 if (details.type() == CALLBACKS && result->IsAccessorPair()) { | 6010 if (details.type() == CALLBACKS && result->IsAccessorPair()) { |
6011 DCHECK(!details.IsDontDelete()); | 6011 DCHECK(details.IsConfigurable()); |
6012 if (details.attributes() != attributes) { | 6012 if (details.attributes() != attributes) { |
6013 dictionary->DetailsAtPut( | 6013 dictionary->DetailsAtPut( |
6014 entry, | 6014 entry, |
6015 PropertyDetails(attributes, CALLBACKS, index)); | 6015 PropertyDetails(attributes, CALLBACKS, index)); |
6016 } | 6016 } |
6017 AccessorPair::cast(result)->SetComponents(getter, setter); | 6017 AccessorPair::cast(result)->SetComponents(getter, setter); |
6018 return true; | 6018 return true; |
6019 } | 6019 } |
6020 } | 6020 } |
6021 return false; | 6021 return false; |
(...skipping 9092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15114 | 15114 |
15115 | 15115 |
15116 template<typename Derived, typename Shape, typename Key> | 15116 template<typename Derived, typename Shape, typename Key> |
15117 Handle<Object> Dictionary<Derived, Shape, Key>::DeleteProperty( | 15117 Handle<Object> Dictionary<Derived, Shape, Key>::DeleteProperty( |
15118 Handle<Derived> dictionary, | 15118 Handle<Derived> dictionary, |
15119 int entry, | 15119 int entry, |
15120 JSObject::DeleteMode mode) { | 15120 JSObject::DeleteMode mode) { |
15121 Factory* factory = dictionary->GetIsolate()->factory(); | 15121 Factory* factory = dictionary->GetIsolate()->factory(); |
15122 PropertyDetails details = dictionary->DetailsAt(entry); | 15122 PropertyDetails details = dictionary->DetailsAt(entry); |
15123 // Ignore attributes if forcing a deletion. | 15123 // Ignore attributes if forcing a deletion. |
15124 if (details.IsDontDelete() && mode != JSReceiver::FORCE_DELETION) { | 15124 if (!details.IsConfigurable() && mode != JSReceiver::FORCE_DELETION) { |
15125 return factory->false_value(); | 15125 return factory->false_value(); |
15126 } | 15126 } |
15127 | 15127 |
15128 dictionary->SetEntry( | 15128 dictionary->SetEntry( |
15129 entry, factory->the_hole_value(), factory->the_hole_value()); | 15129 entry, factory->the_hole_value(), factory->the_hole_value()); |
15130 dictionary->ElementRemoved(); | 15130 dictionary->ElementRemoved(); |
15131 return factory->true_value(); | 15131 return factory->true_value(); |
15132 } | 15132 } |
15133 | 15133 |
15134 | 15134 |
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16527 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16527 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16528 static const char* error_messages_[] = { | 16528 static const char* error_messages_[] = { |
16529 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16529 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16530 }; | 16530 }; |
16531 #undef ERROR_MESSAGES_TEXTS | 16531 #undef ERROR_MESSAGES_TEXTS |
16532 return error_messages_[reason]; | 16532 return error_messages_[reason]; |
16533 } | 16533 } |
16534 | 16534 |
16535 | 16535 |
16536 } } // namespace v8::internal | 16536 } } // namespace v8::internal |
OLD | NEW |