| 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 3062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3073 // Are two DescriptorArrays equal? | 3073 // Are two DescriptorArrays equal? |
| 3074 bool IsEqualTo(DescriptorArray* other); | 3074 bool IsEqualTo(DescriptorArray* other); |
| 3075 #endif | 3075 #endif |
| 3076 | 3076 |
| 3077 // Returns the fixed array length required to hold number_of_descriptors | 3077 // Returns the fixed array length required to hold number_of_descriptors |
| 3078 // descriptors. | 3078 // descriptors. |
| 3079 static int LengthFor(int number_of_descriptors) { | 3079 static int LengthFor(int number_of_descriptors) { |
| 3080 return ToKeyIndex(number_of_descriptors); | 3080 return ToKeyIndex(number_of_descriptors); |
| 3081 } | 3081 } |
| 3082 | 3082 |
| 3083 static int ToDetailsIndex(int descriptor_number) { |
| 3084 return kFirstIndex + (descriptor_number * kDescriptorSize) + |
| 3085 kDescriptorDetails; |
| 3086 } |
| 3087 |
| 3083 private: | 3088 private: |
| 3084 // An entry in a DescriptorArray, represented as an (array, index) pair. | 3089 // An entry in a DescriptorArray, represented as an (array, index) pair. |
| 3085 class Entry { | 3090 class Entry { |
| 3086 public: | 3091 public: |
| 3087 inline explicit Entry(DescriptorArray* descs, int index) : | 3092 inline explicit Entry(DescriptorArray* descs, int index) : |
| 3088 descs_(descs), index_(index) { } | 3093 descs_(descs), index_(index) { } |
| 3089 | 3094 |
| 3090 inline PropertyType type(); | 3095 inline PropertyType type(); |
| 3091 inline Object* GetCallbackObject(); | 3096 inline Object* GetCallbackObject(); |
| 3092 | 3097 |
| 3093 private: | 3098 private: |
| 3094 DescriptorArray* descs_; | 3099 DescriptorArray* descs_; |
| 3095 int index_; | 3100 int index_; |
| 3096 }; | 3101 }; |
| 3097 | 3102 |
| 3098 // Conversion from descriptor number to array indices. | 3103 // Conversion from descriptor number to array indices. |
| 3099 static int ToKeyIndex(int descriptor_number) { | 3104 static int ToKeyIndex(int descriptor_number) { |
| 3100 return kFirstIndex + | 3105 return kFirstIndex + |
| 3101 (descriptor_number * kDescriptorSize) + | 3106 (descriptor_number * kDescriptorSize) + |
| 3102 kDescriptorKey; | 3107 kDescriptorKey; |
| 3103 } | 3108 } |
| 3104 | 3109 |
| 3105 static int ToDetailsIndex(int descriptor_number) { | |
| 3106 return kFirstIndex + | |
| 3107 (descriptor_number * kDescriptorSize) + | |
| 3108 kDescriptorDetails; | |
| 3109 } | |
| 3110 | |
| 3111 static int ToValueIndex(int descriptor_number) { | 3110 static int ToValueIndex(int descriptor_number) { |
| 3112 return kFirstIndex + | 3111 return kFirstIndex + |
| 3113 (descriptor_number * kDescriptorSize) + | 3112 (descriptor_number * kDescriptorSize) + |
| 3114 kDescriptorValue; | 3113 kDescriptorValue; |
| 3115 } | 3114 } |
| 3116 | 3115 |
| 3117 // Transfer a complete descriptor from the src descriptor array to this | 3116 // Transfer a complete descriptor from the src descriptor array to this |
| 3118 // descriptor array. | 3117 // descriptor array. |
| 3119 void CopyFrom(int index, DescriptorArray* src); | 3118 void CopyFrom(int index, DescriptorArray* src); |
| 3120 | 3119 |
| (...skipping 7776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10897 } | 10896 } |
| 10898 return value; | 10897 return value; |
| 10899 } | 10898 } |
| 10900 }; | 10899 }; |
| 10901 | 10900 |
| 10902 | 10901 |
| 10903 } // NOLINT, false-positive due to second-order macros. | 10902 } // NOLINT, false-positive due to second-order macros. |
| 10904 } // NOLINT, false-positive due to second-order macros. | 10903 } // NOLINT, false-positive due to second-order macros. |
| 10905 | 10904 |
| 10906 #endif // V8_OBJECTS_H_ | 10905 #endif // V8_OBJECTS_H_ |
| OLD | NEW |