OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "src/assert-scope.h" | 10 #include "src/assert-scope.h" |
(...skipping 3056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3067 // Are two DescriptorArrays equal? | 3067 // Are two DescriptorArrays equal? |
3068 bool IsEqualTo(DescriptorArray* other); | 3068 bool IsEqualTo(DescriptorArray* other); |
3069 #endif | 3069 #endif |
3070 | 3070 |
3071 // Returns the fixed array length required to hold number_of_descriptors | 3071 // Returns the fixed array length required to hold number_of_descriptors |
3072 // descriptors. | 3072 // descriptors. |
3073 static int LengthFor(int number_of_descriptors) { | 3073 static int LengthFor(int number_of_descriptors) { |
3074 return ToKeyIndex(number_of_descriptors); | 3074 return ToKeyIndex(number_of_descriptors); |
3075 } | 3075 } |
3076 | 3076 |
| 3077 static int ToDetailsIndex(int descriptor_number) { |
| 3078 return kFirstIndex + (descriptor_number * kDescriptorSize) + |
| 3079 kDescriptorDetails; |
| 3080 } |
| 3081 |
3077 private: | 3082 private: |
3078 // An entry in a DescriptorArray, represented as an (array, index) pair. | 3083 // An entry in a DescriptorArray, represented as an (array, index) pair. |
3079 class Entry { | 3084 class Entry { |
3080 public: | 3085 public: |
3081 inline explicit Entry(DescriptorArray* descs, int index) : | 3086 inline explicit Entry(DescriptorArray* descs, int index) : |
3082 descs_(descs), index_(index) { } | 3087 descs_(descs), index_(index) { } |
3083 | 3088 |
3084 inline PropertyType type(); | 3089 inline PropertyType type(); |
3085 inline Object* GetCallbackObject(); | 3090 inline Object* GetCallbackObject(); |
3086 | 3091 |
3087 private: | 3092 private: |
3088 DescriptorArray* descs_; | 3093 DescriptorArray* descs_; |
3089 int index_; | 3094 int index_; |
3090 }; | 3095 }; |
3091 | 3096 |
3092 // Conversion from descriptor number to array indices. | 3097 // Conversion from descriptor number to array indices. |
3093 static int ToKeyIndex(int descriptor_number) { | 3098 static int ToKeyIndex(int descriptor_number) { |
3094 return kFirstIndex + | 3099 return kFirstIndex + |
3095 (descriptor_number * kDescriptorSize) + | 3100 (descriptor_number * kDescriptorSize) + |
3096 kDescriptorKey; | 3101 kDescriptorKey; |
3097 } | 3102 } |
3098 | 3103 |
3099 static int ToDetailsIndex(int descriptor_number) { | |
3100 return kFirstIndex + | |
3101 (descriptor_number * kDescriptorSize) + | |
3102 kDescriptorDetails; | |
3103 } | |
3104 | |
3105 static int ToValueIndex(int descriptor_number) { | 3104 static int ToValueIndex(int descriptor_number) { |
3106 return kFirstIndex + | 3105 return kFirstIndex + |
3107 (descriptor_number * kDescriptorSize) + | 3106 (descriptor_number * kDescriptorSize) + |
3108 kDescriptorValue; | 3107 kDescriptorValue; |
3109 } | 3108 } |
3110 | 3109 |
3111 // Transfer a complete descriptor from the src descriptor array to this | 3110 // Transfer a complete descriptor from the src descriptor array to this |
3112 // descriptor array. | 3111 // descriptor array. |
3113 void CopyFrom(int index, DescriptorArray* src); | 3112 void CopyFrom(int index, DescriptorArray* src); |
3114 | 3113 |
(...skipping 7770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10885 } | 10884 } |
10886 return value; | 10885 return value; |
10887 } | 10886 } |
10888 }; | 10887 }; |
10889 | 10888 |
10890 | 10889 |
10891 } // NOLINT, false-positive due to second-order macros. | 10890 } // NOLINT, false-positive due to second-order macros. |
10892 } // NOLINT, false-positive due to second-order macros. | 10891 } // NOLINT, false-positive due to second-order macros. |
10893 | 10892 |
10894 #endif // V8_OBJECTS_H_ | 10893 #endif // V8_OBJECTS_H_ |
OLD | NEW |