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 2390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2689 | 2690 |
2690 void DescriptorArray::SetRepresentation(int descriptor_index, | 2691 void DescriptorArray::SetRepresentation(int descriptor_index, |
2691 Representation representation) { | 2692 Representation representation) { |
2692 ASSERT(!representation.IsNone()); | 2693 ASSERT(!representation.IsNone()); |
2693 PropertyDetails details = GetDetails(descriptor_index); | 2694 PropertyDetails details = GetDetails(descriptor_index); |
2694 set(ToDetailsIndex(descriptor_index), | 2695 set(ToDetailsIndex(descriptor_index), |
2695 details.CopyWithRepresentation(representation).AsSmi()); | 2696 details.CopyWithRepresentation(representation).AsSmi()); |
2696 } | 2697 } |
2697 | 2698 |
2698 | 2699 |
2699 void DescriptorArray::InitializeRepresentations(Representation representation) { | |
2700 int length = number_of_descriptors(); | |
2701 for (int i = 0; i < length; i++) { | |
2702 SetRepresentation(i, representation); | |
2703 } | |
2704 } | |
2705 | |
2706 | |
2707 Object** DescriptorArray::GetValueSlot(int descriptor_number) { | 2700 Object** DescriptorArray::GetValueSlot(int descriptor_number) { |
2708 ASSERT(descriptor_number < number_of_descriptors()); | 2701 ASSERT(descriptor_number < number_of_descriptors()); |
2709 return RawFieldOfElementAt(ToValueIndex(descriptor_number)); | 2702 return RawFieldOfElementAt(ToValueIndex(descriptor_number)); |
2710 } | 2703 } |
2711 | 2704 |
2712 | 2705 |
2713 Object* DescriptorArray::GetValue(int descriptor_number) { | 2706 Object* DescriptorArray::GetValue(int descriptor_number) { |
2714 ASSERT(descriptor_number < number_of_descriptors()); | 2707 ASSERT(descriptor_number < number_of_descriptors()); |
2715 return get(ToValueIndex(descriptor_number)); | 2708 return get(ToValueIndex(descriptor_number)); |
2716 } | 2709 } |
2717 | 2710 |
2718 | 2711 |
| 2712 void DescriptorArray::SetValue(int descriptor_index, Object* value) { |
| 2713 set(ToValueIndex(descriptor_index), value); |
| 2714 } |
| 2715 |
| 2716 |
2719 PropertyDetails DescriptorArray::GetDetails(int descriptor_number) { | 2717 PropertyDetails DescriptorArray::GetDetails(int descriptor_number) { |
2720 ASSERT(descriptor_number < number_of_descriptors()); | 2718 ASSERT(descriptor_number < number_of_descriptors()); |
2721 Object* details = get(ToDetailsIndex(descriptor_number)); | 2719 Object* details = get(ToDetailsIndex(descriptor_number)); |
2722 return PropertyDetails(Smi::cast(details)); | 2720 return PropertyDetails(Smi::cast(details)); |
2723 } | 2721 } |
2724 | 2722 |
2725 | 2723 |
2726 PropertyType DescriptorArray::GetType(int descriptor_number) { | 2724 PropertyType DescriptorArray::GetType(int descriptor_number) { |
2727 return GetDetails(descriptor_number).type(); | 2725 return GetDetails(descriptor_number).type(); |
2728 } | 2726 } |
2729 | 2727 |
2730 | 2728 |
2731 int DescriptorArray::GetFieldIndex(int descriptor_number) { | 2729 int DescriptorArray::GetFieldIndex(int descriptor_number) { |
2732 ASSERT(GetDetails(descriptor_number).type() == FIELD); | 2730 ASSERT(GetDetails(descriptor_number).type() == FIELD); |
2733 return GetDetails(descriptor_number).field_index(); | 2731 return GetDetails(descriptor_number).field_index(); |
2734 } | 2732 } |
2735 | 2733 |
2736 | 2734 |
| 2735 HeapType* DescriptorArray::GetFieldType(int descriptor_number) { |
| 2736 ASSERT(GetDetails(descriptor_number).type() == FIELD); |
| 2737 return HeapType::cast(GetValue(descriptor_number)); |
| 2738 } |
| 2739 |
| 2740 |
2737 Object* DescriptorArray::GetConstant(int descriptor_number) { | 2741 Object* DescriptorArray::GetConstant(int descriptor_number) { |
2738 return GetValue(descriptor_number); | 2742 return GetValue(descriptor_number); |
2739 } | 2743 } |
2740 | 2744 |
2741 | 2745 |
2742 Object* DescriptorArray::GetCallbacksObject(int descriptor_number) { | 2746 Object* DescriptorArray::GetCallbacksObject(int descriptor_number) { |
2743 ASSERT(GetType(descriptor_number) == CALLBACKS); | 2747 ASSERT(GetType(descriptor_number) == CALLBACKS); |
2744 return GetValue(descriptor_number); | 2748 return GetValue(descriptor_number); |
2745 } | 2749 } |
2746 | 2750 |
(...skipping 4341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7088 #undef READ_SHORT_FIELD | 7092 #undef READ_SHORT_FIELD |
7089 #undef WRITE_SHORT_FIELD | 7093 #undef WRITE_SHORT_FIELD |
7090 #undef READ_BYTE_FIELD | 7094 #undef READ_BYTE_FIELD |
7091 #undef WRITE_BYTE_FIELD | 7095 #undef WRITE_BYTE_FIELD |
7092 #undef NOBARRIER_READ_BYTE_FIELD | 7096 #undef NOBARRIER_READ_BYTE_FIELD |
7093 #undef NOBARRIER_WRITE_BYTE_FIELD | 7097 #undef NOBARRIER_WRITE_BYTE_FIELD |
7094 | 7098 |
7095 } } // namespace v8::internal | 7099 } } // namespace v8::internal |
7096 | 7100 |
7097 #endif // V8_OBJECTS_INL_H_ | 7101 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |