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

Side by Side Diff: src/objects.h

Issue 72333004: Match max property descriptor length to corresponding bit fields (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/objects.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 3352 matching lines...) Expand 10 before | Expand all | Expand 10 after
3363 // Is the descriptor array sorted and without duplicates? 3363 // Is the descriptor array sorted and without duplicates?
3364 bool IsSortedNoDuplicates(int valid_descriptors = -1); 3364 bool IsSortedNoDuplicates(int valid_descriptors = -1);
3365 3365
3366 // Is the descriptor array consistent with the back pointers in targets? 3366 // Is the descriptor array consistent with the back pointers in targets?
3367 bool IsConsistentWithBackPointers(Map* current_map); 3367 bool IsConsistentWithBackPointers(Map* current_map);
3368 3368
3369 // Are two DescriptorArrays equal? 3369 // Are two DescriptorArrays equal?
3370 bool IsEqualTo(DescriptorArray* other); 3370 bool IsEqualTo(DescriptorArray* other);
3371 #endif 3371 #endif
3372 3372
3373 // The maximum number of descriptors we want in a descriptor array (should
3374 // fit in a page).
3375 static const int kMaxNumberOfDescriptors = 1024 + 512;
3376
3377 // Returns the fixed array length required to hold number_of_descriptors 3373 // Returns the fixed array length required to hold number_of_descriptors
3378 // descriptors. 3374 // descriptors.
3379 static int LengthFor(int number_of_descriptors) { 3375 static int LengthFor(int number_of_descriptors) {
3380 return ToKeyIndex(number_of_descriptors); 3376 return ToKeyIndex(number_of_descriptors);
3381 } 3377 }
3382 3378
3383 private: 3379 private:
3384 // An entry in a DescriptorArray, represented as an (array, index) pair. 3380 // An entry in a DescriptorArray, represented as an (array, index) pair.
3385 class Entry { 3381 class Entry {
3386 public: 3382 public:
(...skipping 2315 matching lines...) Expand 10 before | Expand all | Expand 10 after
5702 inline void set_bit_field(byte value); 5698 inline void set_bit_field(byte value);
5703 5699
5704 // Bit field 2. 5700 // Bit field 2.
5705 inline byte bit_field2(); 5701 inline byte bit_field2();
5706 inline void set_bit_field2(byte value); 5702 inline void set_bit_field2(byte value);
5707 5703
5708 // Bit field 3. 5704 // Bit field 3.
5709 inline uint32_t bit_field3(); 5705 inline uint32_t bit_field3();
5710 inline void set_bit_field3(uint32_t bits); 5706 inline void set_bit_field3(uint32_t bits);
5711 5707
5712 class EnumLengthBits: public BitField<int, 0, 11> {}; 5708 class EnumLengthBits: public BitField<int,
5713 class NumberOfOwnDescriptorsBits: public BitField<int, 11, 11> {}; 5709 0, kDescriptorIndexBitCount> {};
5714 class IsShared: public BitField<bool, 22, 1> {}; 5710 class NumberOfOwnDescriptorsBits: public BitField<int,
5715 class FunctionWithPrototype: public BitField<bool, 23, 1> {}; 5711 kDescriptorIndexBitCount, kDescriptorIndexBitCount> {};
5716 class DictionaryMap: public BitField<bool, 24, 1> {}; 5712 STATIC_ASSERT(kDescriptorIndexBitCount + kDescriptorIndexBitCount == 20);
5717 class OwnsDescriptors: public BitField<bool, 25, 1> {}; 5713 class IsShared: public BitField<bool, 20, 1> {};
5718 class HasInstanceCallHandler: public BitField<bool, 26, 1> {}; 5714 class FunctionWithPrototype: public BitField<bool, 21, 1> {};
5719 class Deprecated: public BitField<bool, 27, 1> {}; 5715 class DictionaryMap: public BitField<bool, 22, 1> {};
5720 class IsFrozen: public BitField<bool, 28, 1> {}; 5716 class OwnsDescriptors: public BitField<bool, 23, 1> {};
5721 class IsUnstable: public BitField<bool, 29, 1> {}; 5717 class HasInstanceCallHandler: public BitField<bool, 24, 1> {};
5722 class IsMigrationTarget: public BitField<bool, 30, 1> {}; 5718 class Deprecated: public BitField<bool, 25, 1> {};
5719 class IsFrozen: public BitField<bool, 26, 1> {};
5720 class IsUnstable: public BitField<bool, 27, 1> {};
5721 class IsMigrationTarget: public BitField<bool, 28, 1> {};
5723 5722
5724 // Tells whether the object in the prototype property will be used 5723 // Tells whether the object in the prototype property will be used
5725 // for instances created from this function. If the prototype 5724 // for instances created from this function. If the prototype
5726 // property is set to a value that is not a JSObject, the prototype 5725 // property is set to a value that is not a JSObject, the prototype
5727 // property will not be used to create instances of the function. 5726 // property will not be used to create instances of the function.
5728 // See ECMA-262, 13.2.2. 5727 // See ECMA-262, 13.2.2.
5729 inline void set_non_instance_prototype(bool value); 5728 inline void set_non_instance_prototype(bool value);
5730 inline bool has_non_instance_prototype(); 5729 inline bool has_non_instance_prototype();
5731 5730
5732 // Tells whether function has special prototype property. If not, prototype 5731 // Tells whether function has special prototype property. If not, prototype
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
6027 set_bit_field3(NumberOfOwnDescriptorsBits::update(bit_field3(), number)); 6026 set_bit_field3(NumberOfOwnDescriptorsBits::update(bit_field3(), number));
6028 } 6027 }
6029 6028
6030 inline Cell* RetrieveDescriptorsPointer(); 6029 inline Cell* RetrieveDescriptorsPointer();
6031 6030
6032 int EnumLength() { 6031 int EnumLength() {
6033 return EnumLengthBits::decode(bit_field3()); 6032 return EnumLengthBits::decode(bit_field3());
6034 } 6033 }
6035 6034
6036 void SetEnumLength(int length) { 6035 void SetEnumLength(int length) {
6037 if (length != kInvalidEnumCache) { 6036 if (length != kInvalidEnumCacheSentinel) {
6038 ASSERT(length >= 0); 6037 ASSERT(length >= 0);
6039 ASSERT(length == 0 || instance_descriptors()->HasEnumCache()); 6038 ASSERT(length == 0 || instance_descriptors()->HasEnumCache());
6040 ASSERT(length <= NumberOfOwnDescriptors()); 6039 ASSERT(length <= NumberOfOwnDescriptors());
6041 } 6040 }
6042 set_bit_field3(EnumLengthBits::update(bit_field3(), length)); 6041 set_bit_field3(EnumLengthBits::update(bit_field3(), length));
6043 } 6042 }
6044 6043
6045 inline bool owns_descriptors(); 6044 inline bool owns_descriptors();
6046 inline void set_owns_descriptors(bool is_shared); 6045 inline void set_owns_descriptors(bool is_shared);
6047 inline bool has_instance_call_handler(); 6046 inline bool has_instance_call_handler();
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
6245 // and the values are the maps the are transitioned to. 6244 // and the values are the maps the are transitioned to.
6246 static const int kMaxCachedPrototypeTransitions = 256; 6245 static const int kMaxCachedPrototypeTransitions = 256;
6247 static Handle<Map> GetPrototypeTransition(Handle<Map> map, 6246 static Handle<Map> GetPrototypeTransition(Handle<Map> map,
6248 Handle<Object> prototype); 6247 Handle<Object> prototype);
6249 static Handle<Map> PutPrototypeTransition(Handle<Map> map, 6248 static Handle<Map> PutPrototypeTransition(Handle<Map> map,
6250 Handle<Object> prototype, 6249 Handle<Object> prototype,
6251 Handle<Map> target_map); 6250 Handle<Map> target_map);
6252 6251
6253 static const int kMaxPreAllocatedPropertyFields = 255; 6252 static const int kMaxPreAllocatedPropertyFields = 255;
6254 6253
6255 // Constant for denoting that the enum cache is not yet initialized.
6256 static const int kInvalidEnumCache = EnumLengthBits::kMax;
6257
6258 // Layout description. 6254 // Layout description.
6259 static const int kInstanceSizesOffset = HeapObject::kHeaderSize; 6255 static const int kInstanceSizesOffset = HeapObject::kHeaderSize;
6260 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize; 6256 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize;
6261 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize; 6257 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize;
6262 static const int kConstructorOffset = kPrototypeOffset + kPointerSize; 6258 static const int kConstructorOffset = kPrototypeOffset + kPointerSize;
6263 // Storage for the transition array is overloaded to directly contain a back 6259 // Storage for the transition array is overloaded to directly contain a back
6264 // pointer if unused. When the map has transitions, the back pointer is 6260 // pointer if unused. When the map has transitions, the back pointer is
6265 // transferred to the transition array and accessed through an extra 6261 // transferred to the transition array and accessed through an extra
6266 // indirection. 6262 // indirection.
6267 static const int kTransitionsOrBackPointerOffset = 6263 static const int kTransitionsOrBackPointerOffset =
(...skipping 4299 matching lines...) Expand 10 before | Expand all | Expand 10 after
10567 } else { 10563 } else {
10568 value &= ~(1 << bit_position); 10564 value &= ~(1 << bit_position);
10569 } 10565 }
10570 return value; 10566 return value;
10571 } 10567 }
10572 }; 10568 };
10573 10569
10574 } } // namespace v8::internal 10570 } } // namespace v8::internal
10575 10571
10576 #endif // V8_OBJECTS_H_ 10572 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698