| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 | 45 |
| 46 Smi* PropertyDetails::AsSmi() const { | 46 Smi* PropertyDetails::AsSmi() const { |
| 47 // Ensure the upper 2 bits have the same value by sign extending it. This is | 47 // Ensure the upper 2 bits have the same value by sign extending it. This is |
| 48 // necessary to be able to use the 31st bit of the property details. | 48 // necessary to be able to use the 31st bit of the property details. |
| 49 int value = value_ << 1; | 49 int value = value_ << 1; |
| 50 return Smi::FromInt(value >> 1); | 50 return Smi::FromInt(value >> 1); |
| 51 } | 51 } |
| 52 | 52 |
| 53 | 53 |
| 54 PropertyDetails PropertyDetails::AsDeleted() const { | |
| 55 Smi* smi = Smi::FromInt(value_ | DeletedField::encode(1)); | |
| 56 return PropertyDetails(smi); | |
| 57 } | |
| 58 | |
| 59 | |
| 60 int PropertyDetails::field_width_in_words() const { | 54 int PropertyDetails::field_width_in_words() const { |
| 61 DCHECK(location() == kField); | 55 DCHECK(location() == kField); |
| 62 if (!FLAG_unbox_double_fields) return 1; | 56 if (!FLAG_unbox_double_fields) return 1; |
| 63 if (kDoubleSize == kPointerSize) return 1; | 57 if (kDoubleSize == kPointerSize) return 1; |
| 64 return representation().IsDouble() ? kDoubleSize / kPointerSize : 1; | 58 return representation().IsDouble() ? kDoubleSize / kPointerSize : 1; |
| 65 } | 59 } |
| 66 | 60 |
| 67 | 61 |
| 68 #define TYPE_CHECKER(type, instancetype) \ | 62 #define TYPE_CHECKER(type, instancetype) \ |
| 69 bool Object::Is##type() const { \ | 63 bool Object::Is##type() const { \ |
| (...skipping 6927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6997 Handle<Object> value) { | 6991 Handle<Object> value) { |
| 6998 SetEntry(entry, key, value, PropertyDetails(Smi::FromInt(0))); | 6992 SetEntry(entry, key, value, PropertyDetails(Smi::FromInt(0))); |
| 6999 } | 6993 } |
| 7000 | 6994 |
| 7001 | 6995 |
| 7002 template<typename Derived, typename Shape, typename Key> | 6996 template<typename Derived, typename Shape, typename Key> |
| 7003 void Dictionary<Derived, Shape, Key>::SetEntry(int entry, | 6997 void Dictionary<Derived, Shape, Key>::SetEntry(int entry, |
| 7004 Handle<Object> key, | 6998 Handle<Object> key, |
| 7005 Handle<Object> value, | 6999 Handle<Object> value, |
| 7006 PropertyDetails details) { | 7000 PropertyDetails details) { |
| 7007 DCHECK(!key->IsName() || | 7001 DCHECK(!key->IsName() || details.dictionary_index() > 0); |
| 7008 details.IsDeleted() || | |
| 7009 details.dictionary_index() > 0); | |
| 7010 int index = DerivedHashTable::EntryToIndex(entry); | 7002 int index = DerivedHashTable::EntryToIndex(entry); |
| 7011 DisallowHeapAllocation no_gc; | 7003 DisallowHeapAllocation no_gc; |
| 7012 WriteBarrierMode mode = FixedArray::GetWriteBarrierMode(no_gc); | 7004 WriteBarrierMode mode = FixedArray::GetWriteBarrierMode(no_gc); |
| 7013 FixedArray::set(index, *key, mode); | 7005 FixedArray::set(index, *key, mode); |
| 7014 FixedArray::set(index+1, *value, mode); | 7006 FixedArray::set(index+1, *value, mode); |
| 7015 FixedArray::set(index+2, details.AsSmi()); | 7007 FixedArray::set(index+2, details.AsSmi()); |
| 7016 } | 7008 } |
| 7017 | 7009 |
| 7018 | 7010 |
| 7019 bool NumberDictionaryShape::IsMatch(uint32_t key, Object* other) { | 7011 bool NumberDictionaryShape::IsMatch(uint32_t key, Object* other) { |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7517 #undef READ_SHORT_FIELD | 7509 #undef READ_SHORT_FIELD |
| 7518 #undef WRITE_SHORT_FIELD | 7510 #undef WRITE_SHORT_FIELD |
| 7519 #undef READ_BYTE_FIELD | 7511 #undef READ_BYTE_FIELD |
| 7520 #undef WRITE_BYTE_FIELD | 7512 #undef WRITE_BYTE_FIELD |
| 7521 #undef NOBARRIER_READ_BYTE_FIELD | 7513 #undef NOBARRIER_READ_BYTE_FIELD |
| 7522 #undef NOBARRIER_WRITE_BYTE_FIELD | 7514 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 7523 | 7515 |
| 7524 } } // namespace v8::internal | 7516 } } // namespace v8::internal |
| 7525 | 7517 |
| 7526 #endif // V8_OBJECTS_INL_H_ | 7518 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |