OLD | NEW |
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 3539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3550 // For a proxy, use the prototype as target object. | 3550 // For a proxy, use the prototype as target object. |
3551 Object* proxy_parent = GetPrototype(); | 3551 Object* proxy_parent = GetPrototype(); |
3552 // If the proxy is detached, return undefined. | 3552 // If the proxy is detached, return undefined. |
3553 if (proxy_parent->IsNull()) return GetHeap()->undefined_value(); | 3553 if (proxy_parent->IsNull()) return GetHeap()->undefined_value(); |
3554 ASSERT(proxy_parent->IsJSGlobalObject()); | 3554 ASSERT(proxy_parent->IsJSGlobalObject()); |
3555 return JSObject::cast(proxy_parent)->GetHiddenProperty(key); | 3555 return JSObject::cast(proxy_parent)->GetHiddenProperty(key); |
3556 } | 3556 } |
3557 ASSERT(!IsJSGlobalProxy()); | 3557 ASSERT(!IsJSGlobalProxy()); |
3558 MaybeObject* hidden_lookup = | 3558 MaybeObject* hidden_lookup = |
3559 GetHiddenPropertiesHashTable(ONLY_RETURN_INLINE_VALUE); | 3559 GetHiddenPropertiesHashTable(ONLY_RETURN_INLINE_VALUE); |
3560 ASSERT(!hidden_lookup->IsFailure()); // No failure when passing false as arg. | |
3561 Object* inline_value = hidden_lookup->ToObjectUnchecked(); | 3560 Object* inline_value = hidden_lookup->ToObjectUnchecked(); |
3562 | 3561 |
3563 if (inline_value->IsSmi()) { | 3562 if (inline_value->IsSmi()) { |
3564 // Handle inline-stored identity hash. | 3563 // Handle inline-stored identity hash. |
3565 if (key == GetHeap()->identity_hash_symbol()) { | 3564 if (key == GetHeap()->identity_hash_symbol()) { |
3566 return inline_value; | 3565 return inline_value; |
3567 } else { | 3566 } else { |
3568 return GetHeap()->undefined_value(); | 3567 return GetHeap()->undefined_value(); |
3569 } | 3568 } |
3570 } | 3569 } |
(...skipping 20 matching lines...) Expand all Loading... |
3591 ASSERT(key->IsSymbol()); | 3590 ASSERT(key->IsSymbol()); |
3592 if (IsJSGlobalProxy()) { | 3591 if (IsJSGlobalProxy()) { |
3593 // For a proxy, use the prototype as target object. | 3592 // For a proxy, use the prototype as target object. |
3594 Object* proxy_parent = GetPrototype(); | 3593 Object* proxy_parent = GetPrototype(); |
3595 // If the proxy is detached, return undefined. | 3594 // If the proxy is detached, return undefined. |
3596 if (proxy_parent->IsNull()) return GetHeap()->undefined_value(); | 3595 if (proxy_parent->IsNull()) return GetHeap()->undefined_value(); |
3597 ASSERT(proxy_parent->IsJSGlobalObject()); | 3596 ASSERT(proxy_parent->IsJSGlobalObject()); |
3598 return JSObject::cast(proxy_parent)->SetHiddenProperty(key, value); | 3597 return JSObject::cast(proxy_parent)->SetHiddenProperty(key, value); |
3599 } | 3598 } |
3600 ASSERT(!IsJSGlobalProxy()); | 3599 ASSERT(!IsJSGlobalProxy()); |
| 3600 MaybeObject* hidden_lookup = |
| 3601 GetHiddenPropertiesHashTable(ONLY_RETURN_INLINE_VALUE); |
| 3602 Object* inline_value = hidden_lookup->ToObjectUnchecked(); |
3601 | 3603 |
3602 // If there is no backing store yet, store the identity hash inline. | 3604 // If there is no backing store yet, store the identity hash inline. |
3603 MaybeObject* hidden_lookup = | |
3604 GetHiddenPropertiesHashTable(ONLY_RETURN_INLINE_VALUE); | |
3605 ASSERT(!hidden_lookup->IsFailure()); | |
3606 Object* inline_value = hidden_lookup->ToObjectUnchecked(); | |
3607 | |
3608 if (value->IsSmi() && | 3605 if (value->IsSmi() && |
3609 key == GetHeap()->identity_hash_symbol() && | 3606 key == GetHeap()->identity_hash_symbol() && |
3610 (inline_value->IsUndefined() || inline_value->IsSmi())) { | 3607 (inline_value->IsUndefined() || inline_value->IsSmi())) { |
3611 return SetHiddenPropertiesHashTable(value); | 3608 return SetHiddenPropertiesHashTable(value); |
3612 } | 3609 } |
3613 | 3610 |
3614 hidden_lookup = GetHiddenPropertiesHashTable(CREATE_NEW_IF_ABSENT); | 3611 hidden_lookup = GetHiddenPropertiesHashTable(CREATE_NEW_IF_ABSENT); |
3615 ObjectHashTable* hashtable; | 3612 ObjectHashTable* hashtable; |
3616 if (!hidden_lookup->To(&hashtable)) return hidden_lookup; | 3613 if (!hidden_lookup->To(&hashtable)) return hidden_lookup; |
3617 | 3614 |
(...skipping 16 matching lines...) Expand all Loading... |
3634 ASSERT(key->IsSymbol()); | 3631 ASSERT(key->IsSymbol()); |
3635 if (IsJSGlobalProxy()) { | 3632 if (IsJSGlobalProxy()) { |
3636 // For a proxy, use the prototype as target object. | 3633 // For a proxy, use the prototype as target object. |
3637 Object* proxy_parent = GetPrototype(); | 3634 Object* proxy_parent = GetPrototype(); |
3638 // If the proxy is detached, return immediately. | 3635 // If the proxy is detached, return immediately. |
3639 if (proxy_parent->IsNull()) return; | 3636 if (proxy_parent->IsNull()) return; |
3640 ASSERT(proxy_parent->IsJSGlobalObject()); | 3637 ASSERT(proxy_parent->IsJSGlobalObject()); |
3641 JSObject::cast(proxy_parent)->DeleteHiddenProperty(key); | 3638 JSObject::cast(proxy_parent)->DeleteHiddenProperty(key); |
3642 return; | 3639 return; |
3643 } | 3640 } |
| 3641 ASSERT(!IsJSGlobalProxy()); |
3644 MaybeObject* hidden_lookup = | 3642 MaybeObject* hidden_lookup = |
3645 GetHiddenPropertiesHashTable(ONLY_RETURN_INLINE_VALUE); | 3643 GetHiddenPropertiesHashTable(ONLY_RETURN_INLINE_VALUE); |
3646 ASSERT(!hidden_lookup->IsFailure()); // No failure when passing false as arg. | 3644 Object* inline_value = hidden_lookup->ToObjectUnchecked(); |
3647 if (hidden_lookup->ToObjectUnchecked()->IsUndefined()) return; | 3645 |
3648 // We never delete (inline-stored) identity hashes. | 3646 // We never delete (inline-stored) identity hashes. |
3649 ASSERT(!hidden_lookup->ToObjectUnchecked()->IsSmi()); | 3647 ASSERT(key != GetHeap()->identity_hash_symbol()); |
| 3648 if (inline_value->IsUndefined() || inline_value->IsSmi()) return; |
3650 | 3649 |
3651 ObjectHashTable* hashtable = | 3650 ObjectHashTable* hashtable = ObjectHashTable::cast(inline_value); |
3652 ObjectHashTable::cast(hidden_lookup->ToObjectUnchecked()); | |
3653 MaybeObject* delete_result = hashtable->Put(key, GetHeap()->the_hole_value()); | 3651 MaybeObject* delete_result = hashtable->Put(key, GetHeap()->the_hole_value()); |
3654 USE(delete_result); | 3652 USE(delete_result); |
3655 ASSERT(!delete_result->IsFailure()); // Delete does not cause GC. | 3653 ASSERT(!delete_result->IsFailure()); // Delete does not cause GC. |
3656 } | 3654 } |
3657 | 3655 |
3658 | 3656 |
3659 bool JSObject::HasHiddenProperties() { | 3657 bool JSObject::HasHiddenProperties() { |
3660 return GetPropertyAttributePostInterceptor(this, | 3658 return GetPropertyAttributePostInterceptor(this, |
3661 GetHeap()->hidden_symbol(), | 3659 GetHeap()->hidden_symbol(), |
3662 false) != ABSENT; | 3660 false) != ABSENT; |
(...skipping 9556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13219 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13217 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
13220 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13218 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
13221 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13219 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
13222 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13220 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
13223 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13221 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
13224 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13222 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
13225 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13223 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
13226 } | 13224 } |
13227 | 13225 |
13228 } } // namespace v8::internal | 13226 } } // namespace v8::internal |
OLD | NEW |