Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Side by Side Diff: src/objects.h

Issue 2688573003: [cleanup] CSA: add helpers for accessing details/value via key_index (Closed)
Patch Set: rebased Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ic/keyed-store-generic.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <memory> 9 #include <memory>
10 10
(...skipping 3115 matching lines...) Expand 10 before | Expand all | Expand 10 after
3126 DISALLOW_IMPLICIT_CONSTRUCTORS(FrameArray); 3126 DISALLOW_IMPLICIT_CONSTRUCTORS(FrameArray);
3127 }; 3127 };
3128 3128
3129 // DescriptorArrays are fixed arrays used to hold instance descriptors. 3129 // DescriptorArrays are fixed arrays used to hold instance descriptors.
3130 // The format of the these objects is: 3130 // The format of the these objects is:
3131 // [0]: Number of descriptors 3131 // [0]: Number of descriptors
3132 // [1]: Either Smi(0) if uninitialized, or a pointer to small fixed array: 3132 // [1]: Either Smi(0) if uninitialized, or a pointer to small fixed array:
3133 // [0]: pointer to fixed array with enum cache 3133 // [0]: pointer to fixed array with enum cache
3134 // [1]: either Smi(0) or pointer to fixed array with indices 3134 // [1]: either Smi(0) or pointer to fixed array with indices
3135 // [2]: first key 3135 // [2]: first key
3136 // [2 + number of descriptors * kDescriptorSize]: start of slack 3136 // [2 + number of descriptors * kEntrySize]: start of slack
3137 class DescriptorArray: public FixedArray { 3137 class DescriptorArray: public FixedArray {
3138 public: 3138 public:
3139 // Returns true for both shared empty_descriptor_array and for smis, which the 3139 // Returns true for both shared empty_descriptor_array and for smis, which the
3140 // map uses to encode additional bit fields when the descriptor array is not 3140 // map uses to encode additional bit fields when the descriptor array is not
3141 // yet used. 3141 // yet used.
3142 inline bool IsEmpty(); 3142 inline bool IsEmpty();
3143 3143
3144 // Returns the number of descriptors in the array. 3144 // Returns the number of descriptors in the array.
3145 inline int number_of_descriptors(); 3145 inline int number_of_descriptors();
3146 3146
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
3247 3247
3248 // Layout description. 3248 // Layout description.
3249 static const int kDescriptorLengthOffset = FixedArray::kHeaderSize; 3249 static const int kDescriptorLengthOffset = FixedArray::kHeaderSize;
3250 static const int kEnumCacheOffset = kDescriptorLengthOffset + kPointerSize; 3250 static const int kEnumCacheOffset = kDescriptorLengthOffset + kPointerSize;
3251 static const int kFirstOffset = kEnumCacheOffset + kPointerSize; 3251 static const int kFirstOffset = kEnumCacheOffset + kPointerSize;
3252 3252
3253 // Layout description for the bridge array. 3253 // Layout description for the bridge array.
3254 static const int kEnumCacheBridgeCacheOffset = FixedArray::kHeaderSize; 3254 static const int kEnumCacheBridgeCacheOffset = FixedArray::kHeaderSize;
3255 3255
3256 // Layout of descriptor. 3256 // Layout of descriptor.
3257 static const int kDescriptorKey = 0; 3257 // Naming is consistent with Dictionary classes for easy templating.
3258 static const int kDescriptorDetails = 1; 3258 static const int kEntryKeyIndex = 0;
3259 static const int kDescriptorValue = 2; 3259 static const int kEntryDetailsIndex = 1;
3260 static const int kDescriptorSize = 3; 3260 static const int kEntryValueIndex = 2;
3261 static const int kEntrySize = 3;
3261 3262
3262 #if defined(DEBUG) || defined(OBJECT_PRINT) 3263 #if defined(DEBUG) || defined(OBJECT_PRINT)
3263 // For our gdb macros, we should perhaps change these in the future. 3264 // For our gdb macros, we should perhaps change these in the future.
3264 void Print(); 3265 void Print();
3265 3266
3266 // Print all the descriptors. 3267 // Print all the descriptors.
3267 void PrintDescriptors(std::ostream& os); // NOLINT 3268 void PrintDescriptors(std::ostream& os); // NOLINT
3268 3269
3269 void PrintDescriptorDetails(std::ostream& os, int descriptor, 3270 void PrintDescriptorDetails(std::ostream& os, int descriptor,
3270 PropertyDetails::PrintMode mode); 3271 PropertyDetails::PrintMode mode);
(...skipping 10 matching lines...) Expand all
3281 bool IsEqualTo(DescriptorArray* other); 3282 bool IsEqualTo(DescriptorArray* other);
3282 #endif 3283 #endif
3283 3284
3284 // Returns the fixed array length required to hold number_of_descriptors 3285 // Returns the fixed array length required to hold number_of_descriptors
3285 // descriptors. 3286 // descriptors.
3286 static int LengthFor(int number_of_descriptors) { 3287 static int LengthFor(int number_of_descriptors) {
3287 return ToKeyIndex(number_of_descriptors); 3288 return ToKeyIndex(number_of_descriptors);
3288 } 3289 }
3289 3290
3290 static int ToDetailsIndex(int descriptor_number) { 3291 static int ToDetailsIndex(int descriptor_number) {
3291 return kFirstIndex + (descriptor_number * kDescriptorSize) + 3292 return kFirstIndex + (descriptor_number * kEntrySize) + kEntryDetailsIndex;
3292 kDescriptorDetails;
3293 } 3293 }
3294 3294
3295 // Conversion from descriptor number to array indices. 3295 // Conversion from descriptor number to array indices.
3296 static int ToKeyIndex(int descriptor_number) { 3296 static int ToKeyIndex(int descriptor_number) {
3297 return kFirstIndex + (descriptor_number * kDescriptorSize) + kDescriptorKey; 3297 return kFirstIndex + (descriptor_number * kEntrySize) + kEntryKeyIndex;
3298 } 3298 }
3299 3299
3300 static int ToValueIndex(int descriptor_number) { 3300 static int ToValueIndex(int descriptor_number) {
3301 return kFirstIndex + (descriptor_number * kDescriptorSize) + 3301 return kFirstIndex + (descriptor_number * kEntrySize) + kEntryValueIndex;
3302 kDescriptorValue;
3303 } 3302 }
3304 3303
3305 private: 3304 private:
3306 // Transfer a complete descriptor from the src descriptor array to this 3305 // Transfer a complete descriptor from the src descriptor array to this
3307 // descriptor array. 3306 // descriptor array.
3308 void CopyFrom(int index, DescriptorArray* src); 3307 void CopyFrom(int index, DescriptorArray* src);
3309 3308
3310 // Swap first and second descriptor. 3309 // Swap first and second descriptor.
3311 inline void SwapSortedKeys(int first, int second); 3310 inline void SwapSortedKeys(int first, int second);
3312 3311
(...skipping 8318 matching lines...) Expand 10 before | Expand all | Expand 10 after
11631 } 11630 }
11632 }; 11631 };
11633 11632
11634 11633
11635 } // NOLINT, false-positive due to second-order macros. 11634 } // NOLINT, false-positive due to second-order macros.
11636 } // NOLINT, false-positive due to second-order macros. 11635 } // NOLINT, false-positive due to second-order macros.
11637 11636
11638 #include "src/objects/object-macros-undef.h" 11637 #include "src/objects/object-macros-undef.h"
11639 11638
11640 #endif // V8_OBJECTS_H_ 11639 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/ic/keyed-store-generic.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698