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