OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1767 | 1767 |
1768 | 1768 |
1769 bool DescriptorArray::IsDontEnum(int descriptor_number) { | 1769 bool DescriptorArray::IsDontEnum(int descriptor_number) { |
1770 return PropertyDetails(GetDetails(descriptor_number)).IsDontEnum(); | 1770 return PropertyDetails(GetDetails(descriptor_number)).IsDontEnum(); |
1771 } | 1771 } |
1772 | 1772 |
1773 | 1773 |
1774 void DescriptorArray::Get(int descriptor_number, Descriptor* desc) { | 1774 void DescriptorArray::Get(int descriptor_number, Descriptor* desc) { |
1775 desc->Init(GetKey(descriptor_number), | 1775 desc->Init(GetKey(descriptor_number), |
1776 GetValue(descriptor_number), | 1776 GetValue(descriptor_number), |
1777 GetDetails(descriptor_number)); | 1777 PropertyDetails(GetDetails(descriptor_number))); |
1778 } | 1778 } |
1779 | 1779 |
1780 | 1780 |
1781 void DescriptorArray::Set(int descriptor_number, Descriptor* desc) { | 1781 void DescriptorArray::Set(int descriptor_number, Descriptor* desc) { |
1782 // Range check. | 1782 // Range check. |
1783 ASSERT(descriptor_number < number_of_descriptors()); | 1783 ASSERT(descriptor_number < number_of_descriptors()); |
1784 | 1784 |
1785 // Make sure none of the elements in desc are in new space. | 1785 // Make sure none of the elements in desc are in new space. |
1786 ASSERT(!HEAP->InNewSpace(desc->GetKey())); | 1786 ASSERT(!HEAP->InNewSpace(desc->GetKey())); |
1787 ASSERT(!HEAP->InNewSpace(desc->GetValue())); | 1787 ASSERT(!HEAP->InNewSpace(desc->GetValue())); |
(...skipping 2158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3946 return AttributesField::decode(static_cast<uint32_t>(flag()->value())); | 3946 return AttributesField::decode(static_cast<uint32_t>(flag()->value())); |
3947 } | 3947 } |
3948 | 3948 |
3949 | 3949 |
3950 void AccessorInfo::set_property_attributes(PropertyAttributes attributes) { | 3950 void AccessorInfo::set_property_attributes(PropertyAttributes attributes) { |
3951 ASSERT(AttributesField::is_valid(attributes)); | 3951 ASSERT(AttributesField::is_valid(attributes)); |
3952 int rest_value = flag()->value() & ~AttributesField::mask(); | 3952 int rest_value = flag()->value() & ~AttributesField::mask(); |
3953 set_flag(Smi::FromInt(rest_value | AttributesField::encode(attributes))); | 3953 set_flag(Smi::FromInt(rest_value | AttributesField::encode(attributes))); |
3954 } | 3954 } |
3955 | 3955 |
| 3956 |
3956 template<typename Shape, typename Key> | 3957 template<typename Shape, typename Key> |
3957 void Dictionary<Shape, Key>::SetEntry(int entry, | 3958 void Dictionary<Shape, Key>::SetEntry(int entry, |
3958 Object* key, | 3959 Object* key, |
| 3960 Object* value) { |
| 3961 SetEntry(entry, key, value, PropertyDetails(Smi::FromInt(0))); |
| 3962 } |
| 3963 |
| 3964 |
| 3965 template<typename Shape, typename Key> |
| 3966 void Dictionary<Shape, Key>::SetEntry(int entry, |
| 3967 Object* key, |
3959 Object* value, | 3968 Object* value, |
3960 PropertyDetails details) { | 3969 PropertyDetails details) { |
3961 ASSERT(!key->IsString() || details.IsDeleted() || details.index() > 0); | 3970 ASSERT(!key->IsString() || details.IsDeleted() || details.index() > 0); |
3962 int index = HashTable<Shape, Key>::EntryToIndex(entry); | 3971 int index = HashTable<Shape, Key>::EntryToIndex(entry); |
3963 AssertNoAllocation no_gc; | 3972 AssertNoAllocation no_gc; |
3964 WriteBarrierMode mode = FixedArray::GetWriteBarrierMode(no_gc); | 3973 WriteBarrierMode mode = FixedArray::GetWriteBarrierMode(no_gc); |
3965 FixedArray::set(index, key, mode); | 3974 FixedArray::set(index, key, mode); |
3966 FixedArray::set(index+1, value, mode); | 3975 FixedArray::set(index+1, value, mode); |
3967 FixedArray::fast_set(this, index+2, details.AsSmi()); | 3976 FixedArray::fast_set(this, index+2, details.AsSmi()); |
3968 } | 3977 } |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4157 #undef WRITE_INT_FIELD | 4166 #undef WRITE_INT_FIELD |
4158 #undef READ_SHORT_FIELD | 4167 #undef READ_SHORT_FIELD |
4159 #undef WRITE_SHORT_FIELD | 4168 #undef WRITE_SHORT_FIELD |
4160 #undef READ_BYTE_FIELD | 4169 #undef READ_BYTE_FIELD |
4161 #undef WRITE_BYTE_FIELD | 4170 #undef WRITE_BYTE_FIELD |
4162 | 4171 |
4163 | 4172 |
4164 } } // namespace v8::internal | 4173 } } // namespace v8::internal |
4165 | 4174 |
4166 #endif // V8_OBJECTS_INL_H_ | 4175 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |