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 2778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2789 if (length != kInvalidEnumCacheSentinel) { | 2789 if (length != kInvalidEnumCacheSentinel) { |
2790 DCHECK(length >= 0); | 2790 DCHECK(length >= 0); |
2791 DCHECK(length == 0 || instance_descriptors()->HasEnumCache()); | 2791 DCHECK(length == 0 || instance_descriptors()->HasEnumCache()); |
2792 DCHECK(length <= NumberOfOwnDescriptors()); | 2792 DCHECK(length <= NumberOfOwnDescriptors()); |
2793 } | 2793 } |
2794 set_bit_field3(EnumLengthBits::update(bit_field3(), length)); | 2794 set_bit_field3(EnumLengthBits::update(bit_field3(), length)); |
2795 } | 2795 } |
2796 | 2796 |
2797 | 2797 |
2798 FixedArrayBase* Map::GetInitialElements() { | 2798 FixedArrayBase* Map::GetInitialElements() { |
| 2799 FixedArrayBase* result = nullptr; |
2799 if (has_fast_elements() || has_fast_string_wrapper_elements()) { | 2800 if (has_fast_elements() || has_fast_string_wrapper_elements()) { |
2800 DCHECK(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array())); | 2801 result = GetHeap()->empty_fixed_array(); |
2801 return GetHeap()->empty_fixed_array(); | 2802 } else if (has_fast_sloppy_arguments_elements()) { |
| 2803 result = GetHeap()->empty_sloppy_arguments_elements(); |
2802 } else if (has_fixed_typed_array_elements()) { | 2804 } else if (has_fixed_typed_array_elements()) { |
2803 FixedTypedArrayBase* empty_array = | 2805 result = GetHeap()->EmptyFixedTypedArrayForMap(this); |
2804 GetHeap()->EmptyFixedTypedArrayForMap(this); | |
2805 DCHECK(!GetHeap()->InNewSpace(empty_array)); | |
2806 return empty_array; | |
2807 } else { | 2806 } else { |
2808 UNREACHABLE(); | 2807 UNREACHABLE(); |
2809 } | 2808 } |
2810 return NULL; | 2809 DCHECK(!GetHeap()->InNewSpace(result)); |
| 2810 return result; |
2811 } | 2811 } |
2812 | 2812 |
2813 | 2813 |
2814 Object** DescriptorArray::GetKeySlot(int descriptor_number) { | 2814 Object** DescriptorArray::GetKeySlot(int descriptor_number) { |
2815 DCHECK(descriptor_number < number_of_descriptors()); | 2815 DCHECK(descriptor_number < number_of_descriptors()); |
2816 return RawFieldOfElementAt(ToKeyIndex(descriptor_number)); | 2816 return RawFieldOfElementAt(ToKeyIndex(descriptor_number)); |
2817 } | 2817 } |
2818 | 2818 |
2819 | 2819 |
2820 Object** DescriptorArray::GetDescriptorStartSlot(int descriptor_number) { | 2820 Object** DescriptorArray::GetDescriptorStartSlot(int descriptor_number) { |
(...skipping 1745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4566 bool Map::has_fast_double_elements() { | 4566 bool Map::has_fast_double_elements() { |
4567 return IsFastDoubleElementsKind(elements_kind()); | 4567 return IsFastDoubleElementsKind(elements_kind()); |
4568 } | 4568 } |
4569 | 4569 |
4570 bool Map::has_fast_elements() { return IsFastElementsKind(elements_kind()); } | 4570 bool Map::has_fast_elements() { return IsFastElementsKind(elements_kind()); } |
4571 | 4571 |
4572 bool Map::has_sloppy_arguments_elements() { | 4572 bool Map::has_sloppy_arguments_elements() { |
4573 return IsSloppyArgumentsElements(elements_kind()); | 4573 return IsSloppyArgumentsElements(elements_kind()); |
4574 } | 4574 } |
4575 | 4575 |
| 4576 bool Map::has_fast_sloppy_arguments_elements() { |
| 4577 return elements_kind() == FAST_SLOPPY_ARGUMENTS_ELEMENTS; |
| 4578 } |
| 4579 |
4576 bool Map::has_fast_string_wrapper_elements() { | 4580 bool Map::has_fast_string_wrapper_elements() { |
4577 return elements_kind() == FAST_STRING_WRAPPER_ELEMENTS; | 4581 return elements_kind() == FAST_STRING_WRAPPER_ELEMENTS; |
4578 } | 4582 } |
4579 | 4583 |
4580 bool Map::has_fixed_typed_array_elements() { | 4584 bool Map::has_fixed_typed_array_elements() { |
4581 return IsFixedTypedArrayElementsKind(elements_kind()); | 4585 return IsFixedTypedArrayElementsKind(elements_kind()); |
4582 } | 4586 } |
4583 | 4587 |
4584 bool Map::has_dictionary_elements() { | 4588 bool Map::has_dictionary_elements() { |
4585 return IsDictionaryElementsKind(elements_kind()); | 4589 return IsDictionaryElementsKind(elements_kind()); |
(...skipping 3296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7882 #undef WRITE_INT64_FIELD | 7886 #undef WRITE_INT64_FIELD |
7883 #undef READ_BYTE_FIELD | 7887 #undef READ_BYTE_FIELD |
7884 #undef WRITE_BYTE_FIELD | 7888 #undef WRITE_BYTE_FIELD |
7885 #undef NOBARRIER_READ_BYTE_FIELD | 7889 #undef NOBARRIER_READ_BYTE_FIELD |
7886 #undef NOBARRIER_WRITE_BYTE_FIELD | 7890 #undef NOBARRIER_WRITE_BYTE_FIELD |
7887 | 7891 |
7888 } // namespace internal | 7892 } // namespace internal |
7889 } // namespace v8 | 7893 } // namespace v8 |
7890 | 7894 |
7891 #endif // V8_OBJECTS_INL_H_ | 7895 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |