| 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 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 TYPE_CHECKER(JSMap, JS_MAP_TYPE) | 711 TYPE_CHECKER(JSMap, JS_MAP_TYPE) |
| 712 TYPE_CHECKER(JSSetIterator, JS_SET_ITERATOR_TYPE) | 712 TYPE_CHECKER(JSSetIterator, JS_SET_ITERATOR_TYPE) |
| 713 TYPE_CHECKER(JSMapIterator, JS_MAP_ITERATOR_TYPE) | 713 TYPE_CHECKER(JSMapIterator, JS_MAP_ITERATOR_TYPE) |
| 714 TYPE_CHECKER(JSWeakMap, JS_WEAK_MAP_TYPE) | 714 TYPE_CHECKER(JSWeakMap, JS_WEAK_MAP_TYPE) |
| 715 TYPE_CHECKER(JSWeakSet, JS_WEAK_SET_TYPE) | 715 TYPE_CHECKER(JSWeakSet, JS_WEAK_SET_TYPE) |
| 716 TYPE_CHECKER(JSContextExtensionObject, JS_CONTEXT_EXTENSION_OBJECT_TYPE) | 716 TYPE_CHECKER(JSContextExtensionObject, JS_CONTEXT_EXTENSION_OBJECT_TYPE) |
| 717 TYPE_CHECKER(Map, MAP_TYPE) | 717 TYPE_CHECKER(Map, MAP_TYPE) |
| 718 TYPE_CHECKER(FixedArray, FIXED_ARRAY_TYPE) | 718 TYPE_CHECKER(FixedArray, FIXED_ARRAY_TYPE) |
| 719 TYPE_CHECKER(FixedDoubleArray, FIXED_DOUBLE_ARRAY_TYPE) | 719 TYPE_CHECKER(FixedDoubleArray, FIXED_DOUBLE_ARRAY_TYPE) |
| 720 TYPE_CHECKER(WeakFixedArray, FIXED_ARRAY_TYPE) | 720 TYPE_CHECKER(WeakFixedArray, FIXED_ARRAY_TYPE) |
| 721 TYPE_CHECKER(TypeFeedbackVector, FEEDBACK_VECTOR_TYPE) |
| 721 | 722 |
| 722 | 723 |
| 723 bool Object::IsJSWeakCollection() const { | 724 bool Object::IsJSWeakCollection() const { |
| 724 return IsJSWeakMap() || IsJSWeakSet(); | 725 return IsJSWeakMap() || IsJSWeakSet(); |
| 725 } | 726 } |
| 726 | 727 |
| 727 | 728 |
| 728 bool Object::IsDescriptorArray() const { | 729 bool Object::IsDescriptorArray() const { |
| 729 return IsFixedArray(); | 730 return IsFixedArray(); |
| 730 } | 731 } |
| 731 | 732 |
| 732 | 733 |
| 733 bool Object::IsArrayList() const { return IsFixedArray(); } | 734 bool Object::IsArrayList() const { return IsFixedArray(); } |
| 734 | 735 |
| 735 | 736 |
| 736 bool Object::IsLayoutDescriptor() const { | 737 bool Object::IsLayoutDescriptor() const { |
| 737 return IsSmi() || IsFixedTypedArrayBase(); | 738 return IsSmi() || IsFixedTypedArrayBase(); |
| 738 } | 739 } |
| 739 | 740 |
| 740 | 741 |
| 741 bool Object::IsTransitionArray() const { | 742 bool Object::IsTransitionArray() const { |
| 742 return IsFixedArray(); | 743 return IsFixedArray(); |
| 743 } | 744 } |
| 744 | 745 |
| 745 | 746 |
| 746 bool Object::IsTypeFeedbackVector() const { return IsFixedArray(); } | |
| 747 | |
| 748 | |
| 749 bool Object::IsDeoptimizationInputData() const { | 747 bool Object::IsDeoptimizationInputData() const { |
| 750 // Must be a fixed array. | 748 // Must be a fixed array. |
| 751 if (!IsFixedArray()) return false; | 749 if (!IsFixedArray()) return false; |
| 752 | 750 |
| 753 // There's no sure way to detect the difference between a fixed array and | 751 // There's no sure way to detect the difference between a fixed array and |
| 754 // a deoptimization data array. Since this is used for asserts we can | 752 // a deoptimization data array. Since this is used for asserts we can |
| 755 // check that the length is zero or else the fixed size plus a multiple of | 753 // check that the length is zero or else the fixed size plus a multiple of |
| 756 // the entry size. | 754 // the entry size. |
| 757 int length = FixedArray::cast(this)->length(); | 755 int length = FixedArray::cast(this)->length(); |
| 758 if (length == 0) return true; | 756 if (length == 0) return true; |
| (...skipping 3345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4104 return CopyInstallDescriptors(map, new_descriptor, descriptors, | 4102 return CopyInstallDescriptors(map, new_descriptor, descriptors, |
| 4105 layout_descriptor); | 4103 layout_descriptor); |
| 4106 } | 4104 } |
| 4107 | 4105 |
| 4108 | 4106 |
| 4109 int HeapObject::SizeFromMap(Map* map) { | 4107 int HeapObject::SizeFromMap(Map* map) { |
| 4110 int instance_size = map->instance_size(); | 4108 int instance_size = map->instance_size(); |
| 4111 if (instance_size != kVariableSizeSentinel) return instance_size; | 4109 if (instance_size != kVariableSizeSentinel) return instance_size; |
| 4112 // Only inline the most frequent cases. | 4110 // Only inline the most frequent cases. |
| 4113 InstanceType instance_type = map->instance_type(); | 4111 InstanceType instance_type = map->instance_type(); |
| 4114 if (instance_type == FIXED_ARRAY_TYPE) { | 4112 if (instance_type == FIXED_ARRAY_TYPE || |
| 4113 instance_type == FEEDBACK_VECTOR_TYPE) { |
| 4115 return FixedArray::BodyDescriptor::SizeOf(map, this); | 4114 return FixedArray::BodyDescriptor::SizeOf(map, this); |
| 4116 } | 4115 } |
| 4117 if (instance_type == ONE_BYTE_STRING_TYPE || | 4116 if (instance_type == ONE_BYTE_STRING_TYPE || |
| 4118 instance_type == ONE_BYTE_INTERNALIZED_STRING_TYPE) { | 4117 instance_type == ONE_BYTE_INTERNALIZED_STRING_TYPE) { |
| 4119 // Strings may get concurrently truncated, hence we have to access its | 4118 // Strings may get concurrently truncated, hence we have to access its |
| 4120 // length synchronized. | 4119 // length synchronized. |
| 4121 return SeqOneByteString::SizeFor( | 4120 return SeqOneByteString::SizeFor( |
| 4122 reinterpret_cast<SeqOneByteString*>(this)->synchronized_length()); | 4121 reinterpret_cast<SeqOneByteString*>(this)->synchronized_length()); |
| 4123 } | 4122 } |
| 4124 if (instance_type == BYTE_ARRAY_TYPE) { | 4123 if (instance_type == BYTE_ARRAY_TYPE) { |
| (...skipping 3172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7297 #undef READ_SHORT_FIELD | 7296 #undef READ_SHORT_FIELD |
| 7298 #undef WRITE_SHORT_FIELD | 7297 #undef WRITE_SHORT_FIELD |
| 7299 #undef READ_BYTE_FIELD | 7298 #undef READ_BYTE_FIELD |
| 7300 #undef WRITE_BYTE_FIELD | 7299 #undef WRITE_BYTE_FIELD |
| 7301 #undef NOBARRIER_READ_BYTE_FIELD | 7300 #undef NOBARRIER_READ_BYTE_FIELD |
| 7302 #undef NOBARRIER_WRITE_BYTE_FIELD | 7301 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 7303 | 7302 |
| 7304 } } // namespace v8::internal | 7303 } } // namespace v8::internal |
| 7305 | 7304 |
| 7306 #endif // V8_OBJECTS_INL_H_ | 7305 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |