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

Side by Side Diff: src/objects.cc

Issue 23600011: Handlify JSObject::DeleteHiddenProperty method. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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') | src/runtime.cc » ('j') | 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 4825 matching lines...) Expand 10 before | Expand all | Expand 10 after
4836 // If adding the key expanded the dictionary (i.e., Add returned a new 4836 // If adding the key expanded the dictionary (i.e., Add returned a new
4837 // dictionary), store it back to the object. 4837 // dictionary), store it back to the object.
4838 MaybeObject* store_result = SetHiddenPropertiesHashTable(new_table); 4838 MaybeObject* store_result = SetHiddenPropertiesHashTable(new_table);
4839 if (store_result->IsFailure()) return store_result; 4839 if (store_result->IsFailure()) return store_result;
4840 } 4840 }
4841 // Return this to mark success. 4841 // Return this to mark success.
4842 return this; 4842 return this;
4843 } 4843 }
4844 4844
4845 4845
4846 void JSObject::DeleteHiddenProperty(Name* key) { 4846 void JSObject::DeleteHiddenProperty(Handle<JSObject> object, Handle<Name> key) {
4847 Isolate* isolate = object->GetIsolate();
4847 ASSERT(key->IsUniqueName()); 4848 ASSERT(key->IsUniqueName());
4848 if (IsJSGlobalProxy()) { 4849
4849 // For a proxy, use the prototype as target object. 4850 if (object->IsJSGlobalProxy()) {
4850 Object* proxy_parent = GetPrototype(); 4851 Handle<Object> proto(object->GetPrototype(), isolate);
4851 // If the proxy is detached, return immediately. 4852 if (proto->IsNull()) return;
4852 if (proxy_parent->IsNull()) return; 4853 ASSERT(proto->IsJSGlobalObject());
4853 ASSERT(proxy_parent->IsJSGlobalObject()); 4854 return DeleteHiddenProperty(Handle<JSObject>::cast(proto), key);
4854 JSObject::cast(proxy_parent)->DeleteHiddenProperty(key);
4855 return;
4856 } 4855 }
4857 ASSERT(!IsJSGlobalProxy()); 4856
4858 MaybeObject* hidden_lookup = 4857 MaybeObject* hidden_lookup =
4859 GetHiddenPropertiesHashTable(ONLY_RETURN_INLINE_VALUE); 4858 object->GetHiddenPropertiesHashTable(ONLY_RETURN_INLINE_VALUE);
4860 Object* inline_value = hidden_lookup->ToObjectUnchecked(); 4859 Object* inline_value = hidden_lookup->ToObjectUnchecked();
4861 4860
4862 // We never delete (inline-stored) identity hashes. 4861 // We never delete (inline-stored) identity hashes.
4863 ASSERT(key != GetHeap()->identity_hash_string()); 4862 ASSERT(*key != isolate->heap()->identity_hash_string());
4864 if (inline_value->IsUndefined() || inline_value->IsSmi()) return; 4863 if (inline_value->IsUndefined() || inline_value->IsSmi()) return;
4865 4864
4866 ObjectHashTable* hashtable = ObjectHashTable::cast(inline_value); 4865 Handle<ObjectHashTable> hashtable(ObjectHashTable::cast(inline_value));
4867 MaybeObject* delete_result = hashtable->Put(key, GetHeap()->the_hole_value()); 4866 PutIntoObjectHashTable(hashtable, key, isolate->factory()->the_hole_value());
4868 USE(delete_result);
4869 ASSERT(!delete_result->IsFailure()); // Delete does not cause GC.
4870 } 4867 }
4871 4868
4872 4869
4873 bool JSObject::HasHiddenProperties() { 4870 bool JSObject::HasHiddenProperties() {
4874 return GetPropertyAttributePostInterceptor(this, 4871 return GetPropertyAttributePostInterceptor(this,
4875 GetHeap()->hidden_string(), 4872 GetHeap()->hidden_string(),
4876 false) != ABSENT; 4873 false) != ABSENT;
4877 } 4874 }
4878 4875
4879 4876
(...skipping 11112 matching lines...) Expand 10 before | Expand all | Expand 10 after
15992 #define ERROR_MESSAGES_TEXTS(C, T) T, 15989 #define ERROR_MESSAGES_TEXTS(C, T) T,
15993 static const char* error_messages_[] = { 15990 static const char* error_messages_[] = {
15994 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 15991 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
15995 }; 15992 };
15996 #undef ERROR_MESSAGES_TEXTS 15993 #undef ERROR_MESSAGES_TEXTS
15997 return error_messages_[reason]; 15994 return error_messages_[reason];
15998 } 15995 }
15999 15996
16000 15997
16001 } } // namespace v8::internal 15998 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698