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

Side by Side Diff: src/objects.cc

Issue 17781002: Allow users of the V8 API to distinguish between unset and undefined HiddenValues (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 4716 matching lines...) Expand 10 before | Expand all | Expand 10 after
4727 return hash; 4727 return hash;
4728 } 4728 }
4729 4729
4730 4730
4731 Object* JSObject::GetHiddenProperty(Name* key) { 4731 Object* JSObject::GetHiddenProperty(Name* key) {
4732 ASSERT(key->IsUniqueName()); 4732 ASSERT(key->IsUniqueName());
4733 if (IsJSGlobalProxy()) { 4733 if (IsJSGlobalProxy()) {
4734 // For a proxy, use the prototype as target object. 4734 // For a proxy, use the prototype as target object.
4735 Object* proxy_parent = GetPrototype(); 4735 Object* proxy_parent = GetPrototype();
4736 // If the proxy is detached, return undefined. 4736 // If the proxy is detached, return undefined.
4737 if (proxy_parent->IsNull()) return GetHeap()->undefined_value(); 4737 if (proxy_parent->IsNull()) return GetHeap()->the_hole_value();
4738 ASSERT(proxy_parent->IsJSGlobalObject()); 4738 ASSERT(proxy_parent->IsJSGlobalObject());
4739 return JSObject::cast(proxy_parent)->GetHiddenProperty(key); 4739 return JSObject::cast(proxy_parent)->GetHiddenProperty(key);
4740 } 4740 }
4741 ASSERT(!IsJSGlobalProxy()); 4741 ASSERT(!IsJSGlobalProxy());
4742 MaybeObject* hidden_lookup = 4742 MaybeObject* hidden_lookup =
4743 GetHiddenPropertiesHashTable(ONLY_RETURN_INLINE_VALUE); 4743 GetHiddenPropertiesHashTable(ONLY_RETURN_INLINE_VALUE);
4744 Object* inline_value = hidden_lookup->ToObjectUnchecked(); 4744 Object* inline_value = hidden_lookup->ToObjectUnchecked();
4745 4745
4746 if (inline_value->IsSmi()) { 4746 if (inline_value->IsSmi()) {
4747 // Handle inline-stored identity hash. 4747 // Handle inline-stored identity hash.
4748 if (key == GetHeap()->identity_hash_string()) { 4748 if (key == GetHeap()->identity_hash_string()) {
4749 return inline_value; 4749 return inline_value;
4750 } else { 4750 } else {
4751 return GetHeap()->undefined_value(); 4751 return GetHeap()->the_hole_value();
4752 } 4752 }
4753 } 4753 }
4754 4754
4755 if (inline_value->IsUndefined()) return GetHeap()->undefined_value(); 4755 if (inline_value->IsUndefined()) return GetHeap()->the_hole_value();
4756 4756
4757 ObjectHashTable* hashtable = ObjectHashTable::cast(inline_value); 4757 ObjectHashTable* hashtable = ObjectHashTable::cast(inline_value);
4758 Object* entry = hashtable->Lookup(key); 4758 Object* entry = hashtable->Lookup(key);
4759 if (entry->IsTheHole()) return GetHeap()->undefined_value();
4760 return entry; 4759 return entry;
4761 } 4760 }
4762 4761
4763 4762
4764 Handle<Object> JSObject::SetHiddenProperty(Handle<JSObject> obj, 4763 Handle<Object> JSObject::SetHiddenProperty(Handle<JSObject> obj,
4765 Handle<Name> key, 4764 Handle<Name> key,
4766 Handle<Object> value) { 4765 Handle<Object> value) {
4767 CALL_HEAP_FUNCTION(obj->GetIsolate(), 4766 CALL_HEAP_FUNCTION(obj->GetIsolate(),
4768 obj->SetHiddenProperty(*key, *value), 4767 obj->SetHiddenProperty(*key, *value),
4769 Object); 4768 Object);
(...skipping 10985 matching lines...) Expand 10 before | Expand all | Expand 10 after
15755 return static_cast<Type*>(type_raw()); 15754 return static_cast<Type*>(type_raw());
15756 } 15755 }
15757 15756
15758 15757
15759 void PropertyCell::set_type(Type* type, WriteBarrierMode ignored) { 15758 void PropertyCell::set_type(Type* type, WriteBarrierMode ignored) {
15760 set_type_raw(type, ignored); 15759 set_type_raw(type, ignored);
15761 } 15760 }
15762 15761
15763 15762
15764 } } // namespace v8::internal 15763 } } // 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