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

Side by Side Diff: src/objects.cc

Issue 11233033: Fix deletion of hidden property with inline-stored hash. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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 | « no previous file | test/cctest/test-api.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 3601 matching lines...) Expand 10 before | Expand all | Expand 10 after
3612 ASSERT(key->IsSymbol()); 3612 ASSERT(key->IsSymbol());
3613 if (IsJSGlobalProxy()) { 3613 if (IsJSGlobalProxy()) {
3614 // For a proxy, use the prototype as target object. 3614 // For a proxy, use the prototype as target object.
3615 Object* proxy_parent = GetPrototype(); 3615 Object* proxy_parent = GetPrototype();
3616 // If the proxy is detached, return undefined. 3616 // If the proxy is detached, return undefined.
3617 if (proxy_parent->IsNull()) return GetHeap()->undefined_value(); 3617 if (proxy_parent->IsNull()) return GetHeap()->undefined_value();
3618 ASSERT(proxy_parent->IsJSGlobalObject()); 3618 ASSERT(proxy_parent->IsJSGlobalObject());
3619 return JSObject::cast(proxy_parent)->SetHiddenProperty(key, value); 3619 return JSObject::cast(proxy_parent)->SetHiddenProperty(key, value);
3620 } 3620 }
3621 ASSERT(!IsJSGlobalProxy()); 3621 ASSERT(!IsJSGlobalProxy());
3622 MaybeObject* hidden_lookup =
3623 GetHiddenPropertiesHashTable(ONLY_RETURN_INLINE_VALUE);
3624 ASSERT(!hidden_lookup->IsFailure()); // No failure when passing false as arg.
Yang 2012/10/22 12:35:23 Not your fault, but what I think what I was trying
Michael Starzinger 2012/10/22 12:45:52 Done. As discussed offline, the whole assertion ca
3625 Object* inline_value = hidden_lookup->ToObjectUnchecked();
3622 3626
3623 // If there is no backing store yet, store the identity hash inline. 3627 // If there is no backing store yet, store the identity hash inline.
3624 MaybeObject* hidden_lookup =
3625 GetHiddenPropertiesHashTable(ONLY_RETURN_INLINE_VALUE);
3626 ASSERT(!hidden_lookup->IsFailure());
3627 Object* inline_value = hidden_lookup->ToObjectUnchecked();
3628
3629 if (value->IsSmi() && 3628 if (value->IsSmi() &&
3630 key == GetHeap()->identity_hash_symbol() && 3629 key == GetHeap()->identity_hash_symbol() &&
3631 (inline_value->IsUndefined() || inline_value->IsSmi())) { 3630 (inline_value->IsUndefined() || inline_value->IsSmi())) {
3632 return SetHiddenPropertiesHashTable(value); 3631 return SetHiddenPropertiesHashTable(value);
3633 } 3632 }
3634 3633
3635 hidden_lookup = GetHiddenPropertiesHashTable(CREATE_NEW_IF_ABSENT); 3634 hidden_lookup = GetHiddenPropertiesHashTable(CREATE_NEW_IF_ABSENT);
3636 ObjectHashTable* hashtable; 3635 ObjectHashTable* hashtable;
3637 if (!hidden_lookup->To(&hashtable)) return hidden_lookup; 3636 if (!hidden_lookup->To(&hashtable)) return hidden_lookup;
3638 3637
(...skipping 16 matching lines...) Expand all
3655 ASSERT(key->IsSymbol()); 3654 ASSERT(key->IsSymbol());
3656 if (IsJSGlobalProxy()) { 3655 if (IsJSGlobalProxy()) {
3657 // For a proxy, use the prototype as target object. 3656 // For a proxy, use the prototype as target object.
3658 Object* proxy_parent = GetPrototype(); 3657 Object* proxy_parent = GetPrototype();
3659 // If the proxy is detached, return immediately. 3658 // If the proxy is detached, return immediately.
3660 if (proxy_parent->IsNull()) return; 3659 if (proxy_parent->IsNull()) return;
3661 ASSERT(proxy_parent->IsJSGlobalObject()); 3660 ASSERT(proxy_parent->IsJSGlobalObject());
3662 JSObject::cast(proxy_parent)->DeleteHiddenProperty(key); 3661 JSObject::cast(proxy_parent)->DeleteHiddenProperty(key);
3663 return; 3662 return;
3664 } 3663 }
3664 ASSERT(!IsJSGlobalProxy());
3665 MaybeObject* hidden_lookup = 3665 MaybeObject* hidden_lookup =
3666 GetHiddenPropertiesHashTable(ONLY_RETURN_INLINE_VALUE); 3666 GetHiddenPropertiesHashTable(ONLY_RETURN_INLINE_VALUE);
3667 ASSERT(!hidden_lookup->IsFailure()); // No failure when passing false as arg. 3667 ASSERT(!hidden_lookup->IsFailure()); // No failure when passing false as arg.
Yang 2012/10/22 12:35:23 Ditto.
Michael Starzinger 2012/10/22 12:45:52 Done. Likewise.
3668 if (hidden_lookup->ToObjectUnchecked()->IsUndefined()) return; 3668 Object* inline_value = hidden_lookup->ToObjectUnchecked();
3669
3669 // We never delete (inline-stored) identity hashes. 3670 // We never delete (inline-stored) identity hashes.
3670 ASSERT(!hidden_lookup->ToObjectUnchecked()->IsSmi()); 3671 ASSERT(key != GetHeap()->identity_hash_symbol());
3672 if (inline_value->IsUndefined() || inline_value->IsSmi()) return;
3671 3673
3672 ObjectHashTable* hashtable = 3674 ObjectHashTable* hashtable = ObjectHashTable::cast(inline_value);
3673 ObjectHashTable::cast(hidden_lookup->ToObjectUnchecked());
3674 MaybeObject* delete_result = hashtable->Put(key, GetHeap()->the_hole_value()); 3675 MaybeObject* delete_result = hashtable->Put(key, GetHeap()->the_hole_value());
3675 USE(delete_result); 3676 USE(delete_result);
3676 ASSERT(!delete_result->IsFailure()); // Delete does not cause GC. 3677 ASSERT(!delete_result->IsFailure()); // Delete does not cause GC.
3677 } 3678 }
3678 3679
3679 3680
3680 bool JSObject::HasHiddenProperties() { 3681 bool JSObject::HasHiddenProperties() {
3681 return GetPropertyAttributePostInterceptor(this, 3682 return GetPropertyAttributePostInterceptor(this,
3682 GetHeap()->hidden_symbol(), 3683 GetHeap()->hidden_symbol(),
3683 false) != ABSENT; 3684 false) != ABSENT;
(...skipping 9791 matching lines...) Expand 10 before | Expand all | Expand 10 after
13475 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 13476 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
13476 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 13477 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
13477 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 13478 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
13478 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 13479 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
13479 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 13480 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
13480 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 13481 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
13481 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 13482 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
13482 } 13483 }
13483 13484
13484 } } // namespace v8::internal 13485 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698