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 3074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3085 static int ToDetailsIndex(int descriptor_number) { | 3085 static int ToDetailsIndex(int descriptor_number) { |
3086 return kFirstIndex + (descriptor_number * kDescriptorSize) + | 3086 return kFirstIndex + (descriptor_number * kDescriptorSize) + |
3087 kDescriptorDetails; | 3087 kDescriptorDetails; |
3088 } | 3088 } |
3089 | 3089 |
3090 // Conversion from descriptor number to array indices. | 3090 // Conversion from descriptor number to array indices. |
3091 static int ToKeyIndex(int descriptor_number) { | 3091 static int ToKeyIndex(int descriptor_number) { |
3092 return kFirstIndex + (descriptor_number * kDescriptorSize) + kDescriptorKey; | 3092 return kFirstIndex + (descriptor_number * kDescriptorSize) + kDescriptorKey; |
3093 } | 3093 } |
3094 | 3094 |
| 3095 static int ToValueIndex(int descriptor_number) { |
| 3096 return kFirstIndex + (descriptor_number * kDescriptorSize) + |
| 3097 kDescriptorValue; |
| 3098 } |
| 3099 |
3095 private: | 3100 private: |
3096 // An entry in a DescriptorArray, represented as an (array, index) pair. | 3101 // An entry in a DescriptorArray, represented as an (array, index) pair. |
3097 class Entry { | 3102 class Entry { |
3098 public: | 3103 public: |
3099 inline explicit Entry(DescriptorArray* descs, int index) : | 3104 inline explicit Entry(DescriptorArray* descs, int index) : |
3100 descs_(descs), index_(index) { } | 3105 descs_(descs), index_(index) { } |
3101 | 3106 |
3102 inline PropertyType type(); | 3107 inline PropertyType type(); |
3103 inline Object* GetCallbackObject(); | 3108 inline Object* GetCallbackObject(); |
3104 | 3109 |
3105 private: | 3110 private: |
3106 DescriptorArray* descs_; | 3111 DescriptorArray* descs_; |
3107 int index_; | 3112 int index_; |
3108 }; | 3113 }; |
3109 | 3114 |
3110 static int ToValueIndex(int descriptor_number) { | |
3111 return kFirstIndex + | |
3112 (descriptor_number * kDescriptorSize) + | |
3113 kDescriptorValue; | |
3114 } | |
3115 | |
3116 // Transfer a complete descriptor from the src descriptor array to this | 3115 // Transfer a complete descriptor from the src descriptor array to this |
3117 // descriptor array. | 3116 // descriptor array. |
3118 void CopyFrom(int index, DescriptorArray* src); | 3117 void CopyFrom(int index, DescriptorArray* src); |
3119 | 3118 |
3120 inline void SetDescriptor(int descriptor_number, Descriptor* desc); | 3119 inline void SetDescriptor(int descriptor_number, Descriptor* desc); |
3121 | 3120 |
3122 // Swap first and second descriptor. | 3121 // Swap first and second descriptor. |
3123 inline void SwapSortedKeys(int first, int second); | 3122 inline void SwapSortedKeys(int first, int second); |
3124 | 3123 |
3125 DISALLOW_IMPLICIT_CONSTRUCTORS(DescriptorArray); | 3124 DISALLOW_IMPLICIT_CONSTRUCTORS(DescriptorArray); |
(...skipping 7669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10795 } | 10794 } |
10796 return value; | 10795 return value; |
10797 } | 10796 } |
10798 }; | 10797 }; |
10799 | 10798 |
10800 | 10799 |
10801 } // NOLINT, false-positive due to second-order macros. | 10800 } // NOLINT, false-positive due to second-order macros. |
10802 } // NOLINT, false-positive due to second-order macros. | 10801 } // NOLINT, false-positive due to second-order macros. |
10803 | 10802 |
10804 #endif // V8_OBJECTS_H_ | 10803 #endif // V8_OBJECTS_H_ |
OLD | NEW |