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 6630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6641 | 6641 |
6642 MaybeObject* NumberDictionaryShape::AsObject(Heap* heap, uint32_t key) { | 6642 MaybeObject* NumberDictionaryShape::AsObject(Heap* heap, uint32_t key) { |
6643 return heap->NumberFromUint32(key); | 6643 return heap->NumberFromUint32(key); |
6644 } | 6644 } |
6645 | 6645 |
6646 Handle<Object> NumberDictionaryShape::AsHandle(Isolate* isolate, uint32_t key) { | 6646 Handle<Object> NumberDictionaryShape::AsHandle(Isolate* isolate, uint32_t key) { |
6647 return isolate->factory()->NewNumberFromUint(key); | 6647 return isolate->factory()->NewNumberFromUint(key); |
6648 } | 6648 } |
6649 | 6649 |
6650 | 6650 |
6651 bool NameDictionaryShape::IsMatch(Name* key, Object* other) { | 6651 bool NameDictionaryShape::IsMatch(Handle<Name> key, Object* other) { |
6652 // We know that all entries in a hash table had their hash keys created. | 6652 // We know that all entries in a hash table had their hash keys created. |
6653 // Use that knowledge to have fast failure. | 6653 // Use that knowledge to have fast failure. |
6654 if (key->Hash() != Name::cast(other)->Hash()) return false; | 6654 if (key->Hash() != Name::cast(other)->Hash()) return false; |
6655 return key->Equals(Name::cast(other)); | 6655 return key->Equals(Name::cast(other)); |
6656 } | 6656 } |
6657 | 6657 |
6658 | 6658 |
6659 uint32_t NameDictionaryShape::Hash(Name* key) { | 6659 uint32_t NameDictionaryShape::Hash(Handle<Name> key) { |
6660 return key->Hash(); | 6660 return key->Hash(); |
6661 } | 6661 } |
6662 | 6662 |
6663 | 6663 |
6664 uint32_t NameDictionaryShape::HashForObject(Name* key, Object* other) { | 6664 uint32_t NameDictionaryShape::HashForObject(Handle<Name> key, Object* other) { |
6665 return Name::cast(other)->Hash(); | 6665 return Name::cast(other)->Hash(); |
6666 } | 6666 } |
6667 | 6667 |
6668 | 6668 |
6669 MaybeObject* NameDictionaryShape::AsObject(Heap* heap, Name* key) { | 6669 MaybeObject* NameDictionaryShape::AsObject(Heap* heap, Handle<Name> key) { |
| 6670 ASSERT(key->IsUniqueName()); |
| 6671 return *key; |
| 6672 } |
| 6673 |
| 6674 |
| 6675 Handle<Object> NameDictionaryShape::AsHandle(Isolate* isolate, |
| 6676 Handle<Name> key) { |
6670 ASSERT(key->IsUniqueName()); | 6677 ASSERT(key->IsUniqueName()); |
6671 return key; | 6678 return key; |
6672 } | 6679 } |
6673 | 6680 |
6674 | 6681 |
6675 Handle<Object> NameDictionaryShape::AsHandle(Isolate* isolate, Name* key) { | |
6676 ASSERT(key->IsUniqueName()); | |
6677 // TODO(ishell): Convert Name* to Handle<Name> to avoid re-wrapping here. | |
6678 return handle(key, isolate); | |
6679 } | |
6680 | |
6681 | |
6682 bool ObjectHashTableShape::IsMatch(Object* key, Object* other) { | 6682 bool ObjectHashTableShape::IsMatch(Object* key, Object* other) { |
6683 return key->SameValue(other); | 6683 return key->SameValue(other); |
6684 } | 6684 } |
6685 | 6685 |
6686 | 6686 |
6687 uint32_t ObjectHashTableShape::Hash(Object* key) { | 6687 uint32_t ObjectHashTableShape::Hash(Object* key) { |
6688 return Smi::cast(key->GetHash())->value(); | 6688 return Smi::cast(key->GetHash())->value(); |
6689 } | 6689 } |
6690 | 6690 |
6691 | 6691 |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7021 #undef READ_SHORT_FIELD | 7021 #undef READ_SHORT_FIELD |
7022 #undef WRITE_SHORT_FIELD | 7022 #undef WRITE_SHORT_FIELD |
7023 #undef READ_BYTE_FIELD | 7023 #undef READ_BYTE_FIELD |
7024 #undef WRITE_BYTE_FIELD | 7024 #undef WRITE_BYTE_FIELD |
7025 #undef NOBARRIER_READ_BYTE_FIELD | 7025 #undef NOBARRIER_READ_BYTE_FIELD |
7026 #undef NOBARRIER_WRITE_BYTE_FIELD | 7026 #undef NOBARRIER_WRITE_BYTE_FIELD |
7027 | 7027 |
7028 } } // namespace v8::internal | 7028 } } // namespace v8::internal |
7029 | 7029 |
7030 #endif // V8_OBJECTS_INL_H_ | 7030 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |