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 5612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5623 return ComputeIntegerHash(key, seed); | 5623 return ComputeIntegerHash(key, seed); |
5624 } | 5624 } |
5625 | 5625 |
5626 uint32_t SeededNumberDictionaryShape::SeededHashForObject(uint32_t key, | 5626 uint32_t SeededNumberDictionaryShape::SeededHashForObject(uint32_t key, |
5627 uint32_t seed, | 5627 uint32_t seed, |
5628 Object* other) { | 5628 Object* other) { |
5629 ASSERT(other->IsNumber()); | 5629 ASSERT(other->IsNumber()); |
5630 return ComputeIntegerHash(static_cast<uint32_t>(other->Number()), seed); | 5630 return ComputeIntegerHash(static_cast<uint32_t>(other->Number()), seed); |
5631 } | 5631 } |
5632 | 5632 |
5633 MaybeObject* NumberDictionaryShape::AsObject(Isolate* isolate, uint32_t key) { | 5633 MaybeObject* NumberDictionaryShape::AsObject(Heap* heap, uint32_t key) { |
5634 return isolate->heap()->NumberFromUint32(key); | 5634 return heap->NumberFromUint32(key); |
5635 } | 5635 } |
5636 | 5636 |
5637 | 5637 |
5638 bool NameDictionaryShape::IsMatch(Name* key, Object* other) { | 5638 bool NameDictionaryShape::IsMatch(Name* key, Object* other) { |
5639 // We know that all entries in a hash table had their hash keys created. | 5639 // We know that all entries in a hash table had their hash keys created. |
5640 // Use that knowledge to have fast failure. | 5640 // Use that knowledge to have fast failure. |
5641 if (key->Hash() != Name::cast(other)->Hash()) return false; | 5641 if (key->Hash() != Name::cast(other)->Hash()) return false; |
5642 return key->Equals(Name::cast(other)); | 5642 return key->Equals(Name::cast(other)); |
5643 } | 5643 } |
5644 | 5644 |
5645 | 5645 |
5646 uint32_t NameDictionaryShape::Hash(Name* key) { | 5646 uint32_t NameDictionaryShape::Hash(Name* key) { |
5647 return key->Hash(); | 5647 return key->Hash(); |
5648 } | 5648 } |
5649 | 5649 |
5650 | 5650 |
5651 uint32_t NameDictionaryShape::HashForObject(Name* key, Object* other) { | 5651 uint32_t NameDictionaryShape::HashForObject(Name* key, Object* other) { |
5652 return Name::cast(other)->Hash(); | 5652 return Name::cast(other)->Hash(); |
5653 } | 5653 } |
5654 | 5654 |
5655 | 5655 |
5656 MaybeObject* NameDictionaryShape::AsObject(Isolate* isolate, Name* key) { | 5656 MaybeObject* NameDictionaryShape::AsObject(Heap* heap, Name* key) { |
5657 return key; | 5657 return key; |
5658 } | 5658 } |
5659 | 5659 |
5660 | 5660 |
5661 template <int entrysize> | 5661 template <int entrysize> |
5662 bool ObjectHashTableShape<entrysize>::IsMatch(Object* key, Object* other) { | 5662 bool ObjectHashTableShape<entrysize>::IsMatch(Object* key, Object* other) { |
5663 return key->SameValue(other); | 5663 return key->SameValue(other); |
5664 } | 5664 } |
5665 | 5665 |
5666 | 5666 |
5667 template <int entrysize> | 5667 template <int entrysize> |
5668 uint32_t ObjectHashTableShape<entrysize>::Hash(Object* key) { | 5668 uint32_t ObjectHashTableShape<entrysize>::Hash(Object* key) { |
5669 MaybeObject* maybe_hash = key->GetHash(OMIT_CREATION); | 5669 MaybeObject* maybe_hash = key->GetHash(OMIT_CREATION); |
5670 return Smi::cast(maybe_hash->ToObjectChecked())->value(); | 5670 return Smi::cast(maybe_hash->ToObjectChecked())->value(); |
5671 } | 5671 } |
5672 | 5672 |
5673 | 5673 |
5674 template <int entrysize> | 5674 template <int entrysize> |
5675 uint32_t ObjectHashTableShape<entrysize>::HashForObject(Object* key, | 5675 uint32_t ObjectHashTableShape<entrysize>::HashForObject(Object* key, |
5676 Object* other) { | 5676 Object* other) { |
5677 MaybeObject* maybe_hash = other->GetHash(OMIT_CREATION); | 5677 MaybeObject* maybe_hash = other->GetHash(OMIT_CREATION); |
5678 return Smi::cast(maybe_hash->ToObjectChecked())->value(); | 5678 return Smi::cast(maybe_hash->ToObjectChecked())->value(); |
5679 } | 5679 } |
5680 | 5680 |
5681 | 5681 |
5682 template <int entrysize> | 5682 template <int entrysize> |
5683 MaybeObject* ObjectHashTableShape<entrysize>::AsObject(Isolate* isolate, | 5683 MaybeObject* ObjectHashTableShape<entrysize>::AsObject(Heap* heap, |
5684 Object* key) { | 5684 Object* key) { |
5685 return key; | 5685 return key; |
5686 } | 5686 } |
5687 | 5687 |
5688 | 5688 |
5689 void Map::ClearCodeCache(Heap* heap) { | 5689 void Map::ClearCodeCache(Heap* heap) { |
5690 // No write barrier is needed since empty_fixed_array is not in new space. | 5690 // No write barrier is needed since empty_fixed_array is not in new space. |
5691 // Please note this function is used during marking: | 5691 // Please note this function is used during marking: |
5692 // - MarkCompactCollector::MarkUnmarkedObject | 5692 // - MarkCompactCollector::MarkUnmarkedObject |
5693 // - IncrementalMarking::Step | 5693 // - IncrementalMarking::Step |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5985 #undef WRITE_UINT32_FIELD | 5985 #undef WRITE_UINT32_FIELD |
5986 #undef READ_SHORT_FIELD | 5986 #undef READ_SHORT_FIELD |
5987 #undef WRITE_SHORT_FIELD | 5987 #undef WRITE_SHORT_FIELD |
5988 #undef READ_BYTE_FIELD | 5988 #undef READ_BYTE_FIELD |
5989 #undef WRITE_BYTE_FIELD | 5989 #undef WRITE_BYTE_FIELD |
5990 | 5990 |
5991 | 5991 |
5992 } } // namespace v8::internal | 5992 } } // namespace v8::internal |
5993 | 5993 |
5994 #endif // V8_OBJECTS_INL_H_ | 5994 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |