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