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 5828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5839 if (IsJSGlobalProxy()) { | 5839 if (IsJSGlobalProxy()) { |
5840 Object* proto = GetPrototype(); | 5840 Object* proto = GetPrototype(); |
5841 if (proto->IsNull()) return GetHeap()->undefined_value(); | 5841 if (proto->IsNull()) return GetHeap()->undefined_value(); |
5842 ASSERT(proto->IsJSGlobalObject()); | 5842 ASSERT(proto->IsJSGlobalObject()); |
5843 return proto; | 5843 return proto; |
5844 } | 5844 } |
5845 return this; | 5845 return this; |
5846 } | 5846 } |
5847 | 5847 |
5848 | 5848 |
5849 MaybeObject* JSReceiver::GetIdentityHash(CreationFlag flag) { | 5849 Handle<Object> JSReceiver::GetOrCreateIdentityHash(Handle<JSReceiver> object) { |
5850 return IsJSProxy() | 5850 return object->IsJSProxy() |
5851 ? JSProxy::cast(this)->GetIdentityHash(flag) | 5851 ? JSProxy::GetOrCreateIdentityHash(Handle<JSProxy>::cast(object)) |
5852 : JSObject::cast(this)->GetIdentityHash(flag); | 5852 : JSObject::GetOrCreateIdentityHash(Handle<JSObject>::cast(object)); |
5853 } | 5853 } |
5854 | 5854 |
5855 | 5855 |
| 5856 Object* JSReceiver::GetIdentityHash() { |
| 5857 return IsJSProxy() |
| 5858 ? JSProxy::cast(this)->GetIdentityHash() |
| 5859 : JSObject::cast(this)->GetIdentityHash(); |
| 5860 } |
| 5861 |
| 5862 |
5856 bool JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) { | 5863 bool JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) { |
5857 if (object->IsJSProxy()) { | 5864 if (object->IsJSProxy()) { |
5858 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); | 5865 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); |
5859 return JSProxy::HasElementWithHandler(proxy, index); | 5866 return JSProxy::HasElementWithHandler(proxy, index); |
5860 } | 5867 } |
5861 return Handle<JSObject>::cast(object)->GetElementAttributeWithReceiver( | 5868 return Handle<JSObject>::cast(object)->GetElementAttributeWithReceiver( |
5862 *object, index, true) != ABSENT; | 5869 *object, index, true) != ABSENT; |
5863 } | 5870 } |
5864 | 5871 |
5865 | 5872 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6042 | 6049 |
6043 | 6050 |
6044 template <int entrysize> | 6051 template <int entrysize> |
6045 bool ObjectHashTableShape<entrysize>::IsMatch(Object* key, Object* other) { | 6052 bool ObjectHashTableShape<entrysize>::IsMatch(Object* key, Object* other) { |
6046 return key->SameValue(other); | 6053 return key->SameValue(other); |
6047 } | 6054 } |
6048 | 6055 |
6049 | 6056 |
6050 template <int entrysize> | 6057 template <int entrysize> |
6051 uint32_t ObjectHashTableShape<entrysize>::Hash(Object* key) { | 6058 uint32_t ObjectHashTableShape<entrysize>::Hash(Object* key) { |
6052 MaybeObject* maybe_hash = key->GetHash(OMIT_CREATION); | 6059 return Smi::cast(key->GetHash())->value(); |
6053 return Smi::cast(maybe_hash->ToObjectChecked())->value(); | |
6054 } | 6060 } |
6055 | 6061 |
6056 | 6062 |
6057 template <int entrysize> | 6063 template <int entrysize> |
6058 uint32_t ObjectHashTableShape<entrysize>::HashForObject(Object* key, | 6064 uint32_t ObjectHashTableShape<entrysize>::HashForObject(Object* key, |
6059 Object* other) { | 6065 Object* other) { |
6060 MaybeObject* maybe_hash = other->GetHash(OMIT_CREATION); | 6066 return Smi::cast(other->GetHash())->value(); |
6061 return Smi::cast(maybe_hash->ToObjectChecked())->value(); | |
6062 } | 6067 } |
6063 | 6068 |
6064 | 6069 |
6065 template <int entrysize> | 6070 template <int entrysize> |
6066 MaybeObject* ObjectHashTableShape<entrysize>::AsObject(Heap* heap, | 6071 MaybeObject* ObjectHashTableShape<entrysize>::AsObject(Heap* heap, |
6067 Object* key) { | 6072 Object* key) { |
6068 return key; | 6073 return key; |
6069 } | 6074 } |
6070 | 6075 |
6071 | 6076 |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6400 #undef WRITE_UINT32_FIELD | 6405 #undef WRITE_UINT32_FIELD |
6401 #undef READ_SHORT_FIELD | 6406 #undef READ_SHORT_FIELD |
6402 #undef WRITE_SHORT_FIELD | 6407 #undef WRITE_SHORT_FIELD |
6403 #undef READ_BYTE_FIELD | 6408 #undef READ_BYTE_FIELD |
6404 #undef WRITE_BYTE_FIELD | 6409 #undef WRITE_BYTE_FIELD |
6405 | 6410 |
6406 | 6411 |
6407 } } // namespace v8::internal | 6412 } } // namespace v8::internal |
6408 | 6413 |
6409 #endif // V8_OBJECTS_INL_H_ | 6414 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |