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

Side by Side Diff: src/objects.cc

Issue 250023002: Dictionary::DeleteProperty() handlified. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 // the hole value. 718 // the hole value.
719 Handle<Map> new_map = Map::CopyDropDescriptors(handle(object->map())); 719 Handle<Map> new_map = Map::CopyDropDescriptors(handle(object->map()));
720 ASSERT(new_map->is_dictionary_map()); 720 ASSERT(new_map->is_dictionary_map());
721 object->set_map(*new_map); 721 object->set_map(*new_map);
722 } 722 }
723 Handle<PropertyCell> cell(PropertyCell::cast(dictionary->ValueAt(entry))); 723 Handle<PropertyCell> cell(PropertyCell::cast(dictionary->ValueAt(entry)));
724 Handle<Object> value = isolate->factory()->the_hole_value(); 724 Handle<Object> value = isolate->factory()->the_hole_value();
725 PropertyCell::SetValueInferType(cell, value); 725 PropertyCell::SetValueInferType(cell, value);
726 dictionary->DetailsAtPut(entry, details.AsDeleted()); 726 dictionary->DetailsAtPut(entry, details.AsDeleted());
727 } else { 727 } else {
728 Handle<Object> deleted(dictionary->DeleteProperty(entry, mode), isolate); 728 Handle<Object> deleted(
729 NameDictionary::DeleteProperty(dictionary, entry, mode));
729 if (*deleted == isolate->heap()->true_value()) { 730 if (*deleted == isolate->heap()->true_value()) {
730 Handle<NameDictionary> new_properties = 731 Handle<NameDictionary> new_properties =
731 NameDictionary::Shrink(dictionary, *name); 732 NameDictionary::Shrink(dictionary, *name);
732 object->set_properties(*new_properties); 733 object->set_properties(*new_properties);
733 } 734 }
734 return deleted; 735 return deleted;
735 } 736 }
736 } 737 }
737 return isolate->factory()->true_value(); 738 return isolate->factory()->true_value();
738 } 739 }
(...skipping 14178 matching lines...) Expand 10 before | Expand all | Expand 10 after
14917 14918
14918 template void 14919 template void
14919 Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>:: 14920 Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
14920 CopyKeysTo( 14921 CopyKeysTo(
14921 FixedArray*, 14922 FixedArray*,
14922 PropertyAttributes, 14923 PropertyAttributes,
14923 Dictionary<SeededNumberDictionary, 14924 Dictionary<SeededNumberDictionary,
14924 SeededNumberDictionaryShape, 14925 SeededNumberDictionaryShape,
14925 uint32_t>::SortMode); 14926 uint32_t>::SortMode);
14926 14927
14927 template Object*
14928 Dictionary<NameDictionary, NameDictionaryShape, Name*>::DeleteProperty(
14929 int, JSObject::DeleteMode);
14930
14931 template Handle<Object> 14928 template Handle<Object>
14932 Dictionary<NameDictionary, NameDictionaryShape, Name*>::DeleteProperty( 14929 Dictionary<NameDictionary, NameDictionaryShape, Name*>::DeleteProperty(
14933 Handle<Dictionary<NameDictionary, NameDictionaryShape, Name*> >, 14930 Handle<NameDictionary>, int, JSObject::DeleteMode);
14934 int,
14935 JSObject::DeleteMode);
14936
14937 template Object*
14938 Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
14939 DeleteProperty(int, JSObject::DeleteMode);
14940 14931
14941 template Handle<Object> 14932 template Handle<Object>
14942 Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>:: 14933 Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
14943 DeleteProperty( 14934 DeleteProperty(Handle<SeededNumberDictionary>, int, JSObject::DeleteMode);
14944 Handle<Dictionary<SeededNumberDictionary,
14945 SeededNumberDictionaryShape,
14946 uint32_t> >,
14947 int,
14948 JSObject::DeleteMode);
14949 14935
14950 template Handle<NameDictionary> 14936 template Handle<NameDictionary>
14951 HashTable<NameDictionary, NameDictionaryShape, Name*>:: 14937 HashTable<NameDictionary, NameDictionaryShape, Name*>::
14952 New(Isolate*, int, MinimumCapacity, PretenureFlag); 14938 New(Isolate*, int, MinimumCapacity, PretenureFlag);
14953 14939
14954 template Handle<NameDictionary> 14940 template Handle<NameDictionary>
14955 HashTable<NameDictionary, NameDictionaryShape, Name*>:: 14941 HashTable<NameDictionary, NameDictionaryShape, Name*>::
14956 Shrink(Handle<NameDictionary>, Name* n); 14942 Shrink(Handle<NameDictionary>, Name* n);
14957 14943
14958 template Handle<SeededNumberDictionary> 14944 template Handle<SeededNumberDictionary>
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after
15848 // Check whether there are enough enumeration indices to add n elements. 15834 // Check whether there are enough enumeration indices to add n elements.
15849 if (Shape::kIsEnumerable && 15835 if (Shape::kIsEnumerable &&
15850 !PropertyDetails::IsValidIndex(dictionary->NextEnumerationIndex() + n)) { 15836 !PropertyDetails::IsValidIndex(dictionary->NextEnumerationIndex() + n)) {
15851 // If not, we generate new indices for the properties. 15837 // If not, we generate new indices for the properties.
15852 GenerateNewEnumerationIndices(dictionary); 15838 GenerateNewEnumerationIndices(dictionary);
15853 } 15839 }
15854 return DerivedHashTable::EnsureCapacity(dictionary, n, key); 15840 return DerivedHashTable::EnsureCapacity(dictionary, n, key);
15855 } 15841 }
15856 15842
15857 15843
15858 // TODO(ishell): Temporary wrapper until handlified.
15859 template<typename Derived, typename Shape, typename Key>
15860 Handle<Object> Dictionary<Derived, Shape, Key>::DeleteProperty(
15861 Handle<Dictionary<Derived, Shape, Key> > dictionary,
15862 int entry,
15863 JSObject::DeleteMode mode) {
15864 CALL_HEAP_FUNCTION(dictionary->GetIsolate(),
15865 dictionary->DeleteProperty(entry, mode),
15866 Object);
15867 }
15868
15869
15870 template<typename Derived, typename Shape, typename Key> 15844 template<typename Derived, typename Shape, typename Key>
15871 Object* Dictionary<Derived, Shape, Key>::DeleteProperty( 15845 Handle<Object> Dictionary<Derived, Shape, Key>::DeleteProperty(
15846 Handle<Derived> dictionary,
15872 int entry, 15847 int entry,
15873 JSReceiver::DeleteMode mode) { 15848 JSObject::DeleteMode mode) {
15874 Heap* heap = Dictionary::GetHeap(); 15849 Factory* factory = dictionary->GetIsolate()->factory();
15875 PropertyDetails details = DetailsAt(entry); 15850 PropertyDetails details = dictionary->DetailsAt(entry);
15876 // Ignore attributes if forcing a deletion. 15851 // Ignore attributes if forcing a deletion.
15877 if (details.IsDontDelete() && mode != JSReceiver::FORCE_DELETION) { 15852 if (details.IsDontDelete() && mode != JSReceiver::FORCE_DELETION) {
15878 return heap->false_value(); 15853 return factory->false_value();
15879 } 15854 }
15880 SetEntry(entry, heap->the_hole_value(), heap->the_hole_value()); 15855 dictionary->SetEntry(
15881 DerivedHashTable::ElementRemoved(); 15856 entry, *factory->the_hole_value(), *factory->the_hole_value());
15882 return heap->true_value(); 15857 dictionary->ElementRemoved();
15858 return factory->true_value();
15883 } 15859 }
15884 15860
15885 15861
15886 template<typename Derived, typename Shape, typename Key> 15862 template<typename Derived, typename Shape, typename Key>
15887 Handle<Derived> Dictionary<Derived, Shape, Key>::AtPut( 15863 Handle<Derived> Dictionary<Derived, Shape, Key>::AtPut(
15888 Handle<Derived> dictionary, Key key, Handle<Object> value) { 15864 Handle<Derived> dictionary, Key key, Handle<Object> value) {
15889 int entry = dictionary->FindEntry(key); 15865 int entry = dictionary->FindEntry(key);
15890 15866
15891 // If the entry is present set the value; 15867 // If the entry is present set the value;
15892 if (entry != Dictionary::kNotFound) { 15868 if (entry != Dictionary::kNotFound) {
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after
17361 #define ERROR_MESSAGES_TEXTS(C, T) T, 17337 #define ERROR_MESSAGES_TEXTS(C, T) T,
17362 static const char* error_messages_[] = { 17338 static const char* error_messages_[] = {
17363 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 17339 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
17364 }; 17340 };
17365 #undef ERROR_MESSAGES_TEXTS 17341 #undef ERROR_MESSAGES_TEXTS
17366 return error_messages_[reason]; 17342 return error_messages_[reason];
17367 } 17343 }
17368 17344
17369 17345
17370 } } // namespace v8::internal 17346 } } // namespace v8::internal
OLDNEW
« 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