OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // Review notes: | 5 // Review notes: |
6 // | 6 // |
7 // - The use of macros in these inline functions may seem superfluous | 7 // - The use of macros in these inline functions may seem superfluous |
8 // but it is absolutely needed to make sure gcc generates optimal | 8 // but it is absolutely needed to make sure gcc generates optimal |
9 // code. gcc is not happy when attempting to inline too deep. | 9 // code. gcc is not happy when attempting to inline too deep. |
10 // | 10 // |
(...skipping 7354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7365 template <typename Dictionary> | 7365 template <typename Dictionary> |
7366 void BaseDictionaryShape<Key>::SetEntry(Dictionary* dict, int entry, | 7366 void BaseDictionaryShape<Key>::SetEntry(Dictionary* dict, int entry, |
7367 Handle<Object> key, | 7367 Handle<Object> key, |
7368 Handle<Object> value, | 7368 Handle<Object> value, |
7369 PropertyDetails details) { | 7369 PropertyDetails details) { |
7370 STATIC_ASSERT(Dictionary::kEntrySize == 3); | 7370 STATIC_ASSERT(Dictionary::kEntrySize == 3); |
7371 DCHECK(!key->IsName() || details.dictionary_index() > 0); | 7371 DCHECK(!key->IsName() || details.dictionary_index() > 0); |
7372 int index = dict->EntryToIndex(entry); | 7372 int index = dict->EntryToIndex(entry); |
7373 DisallowHeapAllocation no_gc; | 7373 DisallowHeapAllocation no_gc; |
7374 WriteBarrierMode mode = dict->GetWriteBarrierMode(no_gc); | 7374 WriteBarrierMode mode = dict->GetWriteBarrierMode(no_gc); |
7375 dict->set(index, *key, mode); | 7375 dict->set(index + Dictionary::kEntryKeyIndex, *key, mode); |
7376 dict->set(index + 1, *value, mode); | 7376 dict->set(index + Dictionary::kEntryValueIndex, *value, mode); |
7377 dict->set(index + 2, details.AsSmi()); | 7377 dict->set(index + Dictionary::kEntryDetailsIndex, details.AsSmi()); |
7378 } | 7378 } |
7379 | 7379 |
7380 | 7380 |
7381 template <typename Dictionary> | 7381 template <typename Dictionary> |
7382 void GlobalDictionaryShape::SetEntry(Dictionary* dict, int entry, | 7382 void GlobalDictionaryShape::SetEntry(Dictionary* dict, int entry, |
7383 Handle<Object> key, Handle<Object> value, | 7383 Handle<Object> key, Handle<Object> value, |
7384 PropertyDetails details) { | 7384 PropertyDetails details) { |
7385 STATIC_ASSERT(Dictionary::kEntrySize == 2); | 7385 STATIC_ASSERT(Dictionary::kEntrySize == 2); |
7386 DCHECK(!key->IsName() || details.dictionary_index() > 0); | 7386 DCHECK(!key->IsName() || details.dictionary_index() > 0); |
7387 DCHECK(value->IsPropertyCell()); | 7387 DCHECK(value->IsPropertyCell()); |
7388 int index = dict->EntryToIndex(entry); | 7388 int index = dict->EntryToIndex(entry); |
7389 DisallowHeapAllocation no_gc; | 7389 DisallowHeapAllocation no_gc; |
7390 WriteBarrierMode mode = dict->GetWriteBarrierMode(no_gc); | 7390 WriteBarrierMode mode = dict->GetWriteBarrierMode(no_gc); |
7391 dict->set(index, *key, mode); | 7391 dict->set(index + Dictionary::kEntryKeyIndex, *key, mode); |
7392 dict->set(index + 1, *value, mode); | 7392 dict->set(index + Dictionary::kEntryValueIndex, *value, mode); |
7393 PropertyCell::cast(*value)->set_property_details(details); | 7393 PropertyCell::cast(*value)->set_property_details(details); |
7394 } | 7394 } |
7395 | 7395 |
7396 | 7396 |
7397 bool NumberDictionaryShape::IsMatch(uint32_t key, Object* other) { | 7397 bool NumberDictionaryShape::IsMatch(uint32_t key, Object* other) { |
7398 DCHECK(other->IsNumber()); | 7398 DCHECK(other->IsNumber()); |
7399 return key == static_cast<uint32_t>(other->Number()); | 7399 return key == static_cast<uint32_t>(other->Number()); |
7400 } | 7400 } |
7401 | 7401 |
7402 | 7402 |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7909 #undef WRITE_INT64_FIELD | 7909 #undef WRITE_INT64_FIELD |
7910 #undef READ_BYTE_FIELD | 7910 #undef READ_BYTE_FIELD |
7911 #undef WRITE_BYTE_FIELD | 7911 #undef WRITE_BYTE_FIELD |
7912 #undef NOBARRIER_READ_BYTE_FIELD | 7912 #undef NOBARRIER_READ_BYTE_FIELD |
7913 #undef NOBARRIER_WRITE_BYTE_FIELD | 7913 #undef NOBARRIER_WRITE_BYTE_FIELD |
7914 | 7914 |
7915 } // namespace internal | 7915 } // namespace internal |
7916 } // namespace v8 | 7916 } // namespace v8 |
7917 | 7917 |
7918 #endif // V8_OBJECTS_INL_H_ | 7918 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |