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