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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 String::cast(this)->IsOneByteRepresentation(); | 279 String::cast(this)->IsOneByteRepresentation(); |
280 } | 280 } |
281 | 281 |
282 | 282 |
283 bool Object::IsExternalTwoByteString() { | 283 bool Object::IsExternalTwoByteString() { |
284 if (!IsString()) return false; | 284 if (!IsString()) return false; |
285 return StringShape(String::cast(this)).IsExternal() && | 285 return StringShape(String::cast(this)).IsExternal() && |
286 String::cast(this)->IsTwoByteRepresentation(); | 286 String::cast(this)->IsTwoByteRepresentation(); |
287 } | 287 } |
288 | 288 |
289 | |
290 bool Object::HasValidElements() { | 289 bool Object::HasValidElements() { |
291 // Dictionary is covered under FixedArray. | 290 // Dictionary is covered under FixedArray. |
292 return IsFixedArray() || IsFixedDoubleArray() || IsExternalArray() || | 291 return IsFixedArray() || IsFixedDoubleArray() || IsExternalArray() || |
293 IsFixedTypedArrayBase(); | 292 IsFixedTypedArrayBase(); |
294 } | 293 } |
295 | 294 |
296 | 295 |
297 MaybeObject* Object::AllocateNewStorageFor(Heap* heap, | 296 MaybeObject* Object::AllocateNewStorageFor(Heap* heap, |
298 Representation representation) { | 297 Representation representation) { |
299 if (representation.IsSmi() && IsUninitialized()) { | 298 if (representation.IsSmi() && IsUninitialized()) { |
(...skipping 2417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2717 | 2716 |
2718 void DescriptorArray::SetRepresentation(int descriptor_index, | 2717 void DescriptorArray::SetRepresentation(int descriptor_index, |
2719 Representation representation) { | 2718 Representation representation) { |
2720 ASSERT(!representation.IsNone()); | 2719 ASSERT(!representation.IsNone()); |
2721 PropertyDetails details = GetDetails(descriptor_index); | 2720 PropertyDetails details = GetDetails(descriptor_index); |
2722 set(ToDetailsIndex(descriptor_index), | 2721 set(ToDetailsIndex(descriptor_index), |
2723 details.CopyWithRepresentation(representation).AsSmi()); | 2722 details.CopyWithRepresentation(representation).AsSmi()); |
2724 } | 2723 } |
2725 | 2724 |
2726 | 2725 |
| 2726 void DescriptorArray::InitializeRepresentations(Representation representation) { |
| 2727 int length = number_of_descriptors(); |
| 2728 for (int i = 0; i < length; i++) { |
| 2729 SetRepresentation(i, representation); |
| 2730 } |
| 2731 } |
| 2732 |
| 2733 |
2727 Object** DescriptorArray::GetValueSlot(int descriptor_number) { | 2734 Object** DescriptorArray::GetValueSlot(int descriptor_number) { |
2728 ASSERT(descriptor_number < number_of_descriptors()); | 2735 ASSERT(descriptor_number < number_of_descriptors()); |
2729 return RawFieldOfElementAt(ToValueIndex(descriptor_number)); | 2736 return RawFieldOfElementAt(ToValueIndex(descriptor_number)); |
2730 } | 2737 } |
2731 | 2738 |
2732 | 2739 |
2733 Object* DescriptorArray::GetValue(int descriptor_number) { | 2740 Object* DescriptorArray::GetValue(int descriptor_number) { |
2734 ASSERT(descriptor_number < number_of_descriptors()); | 2741 ASSERT(descriptor_number < number_of_descriptors()); |
2735 return get(ToValueIndex(descriptor_number)); | 2742 return get(ToValueIndex(descriptor_number)); |
2736 } | 2743 } |
2737 | 2744 |
2738 | 2745 |
2739 void DescriptorArray::SetValue(int descriptor_index, Object* value) { | |
2740 set(ToValueIndex(descriptor_index), value); | |
2741 } | |
2742 | |
2743 | |
2744 PropertyDetails DescriptorArray::GetDetails(int descriptor_number) { | 2746 PropertyDetails DescriptorArray::GetDetails(int descriptor_number) { |
2745 ASSERT(descriptor_number < number_of_descriptors()); | 2747 ASSERT(descriptor_number < number_of_descriptors()); |
2746 Object* details = get(ToDetailsIndex(descriptor_number)); | 2748 Object* details = get(ToDetailsIndex(descriptor_number)); |
2747 return PropertyDetails(Smi::cast(details)); | 2749 return PropertyDetails(Smi::cast(details)); |
2748 } | 2750 } |
2749 | 2751 |
2750 | 2752 |
2751 PropertyType DescriptorArray::GetType(int descriptor_number) { | 2753 PropertyType DescriptorArray::GetType(int descriptor_number) { |
2752 return GetDetails(descriptor_number).type(); | 2754 return GetDetails(descriptor_number).type(); |
2753 } | 2755 } |
2754 | 2756 |
2755 | 2757 |
2756 int DescriptorArray::GetFieldIndex(int descriptor_number) { | 2758 int DescriptorArray::GetFieldIndex(int descriptor_number) { |
2757 ASSERT(GetDetails(descriptor_number).type() == FIELD); | 2759 ASSERT(GetDetails(descriptor_number).type() == FIELD); |
2758 return GetDetails(descriptor_number).field_index(); | 2760 return GetDetails(descriptor_number).field_index(); |
2759 } | 2761 } |
2760 | 2762 |
2761 | 2763 |
2762 HeapType* DescriptorArray::GetFieldType(int descriptor_number) { | |
2763 ASSERT(GetDetails(descriptor_number).type() == FIELD); | |
2764 return HeapType::cast(GetValue(descriptor_number)); | |
2765 } | |
2766 | |
2767 | |
2768 Object* DescriptorArray::GetConstant(int descriptor_number) { | 2764 Object* DescriptorArray::GetConstant(int descriptor_number) { |
2769 return GetValue(descriptor_number); | 2765 return GetValue(descriptor_number); |
2770 } | 2766 } |
2771 | 2767 |
2772 | 2768 |
2773 Object* DescriptorArray::GetCallbacksObject(int descriptor_number) { | 2769 Object* DescriptorArray::GetCallbacksObject(int descriptor_number) { |
2774 ASSERT(GetType(descriptor_number) == CALLBACKS); | 2770 ASSERT(GetType(descriptor_number) == CALLBACKS); |
2775 return GetValue(descriptor_number); | 2771 return GetValue(descriptor_number); |
2776 } | 2772 } |
2777 | 2773 |
(...skipping 4326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7104 #undef READ_SHORT_FIELD | 7100 #undef READ_SHORT_FIELD |
7105 #undef WRITE_SHORT_FIELD | 7101 #undef WRITE_SHORT_FIELD |
7106 #undef READ_BYTE_FIELD | 7102 #undef READ_BYTE_FIELD |
7107 #undef WRITE_BYTE_FIELD | 7103 #undef WRITE_BYTE_FIELD |
7108 #undef NOBARRIER_READ_BYTE_FIELD | 7104 #undef NOBARRIER_READ_BYTE_FIELD |
7109 #undef NOBARRIER_WRITE_BYTE_FIELD | 7105 #undef NOBARRIER_WRITE_BYTE_FIELD |
7110 | 7106 |
7111 } } // namespace v8::internal | 7107 } } // namespace v8::internal |
7112 | 7108 |
7113 #endif // V8_OBJECTS_INL_H_ | 7109 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |