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 10824079: Use a special EnumLength field to indicate number of valid enum cache values. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: u Created 8 years, 4 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 | Annotate | Revision Log
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 4626 matching lines...) Expand 10 before | Expand all | Expand 10 after
4637 inline byte bit_field2(); 4637 inline byte bit_field2();
4638 inline void set_bit_field2(byte value); 4638 inline void set_bit_field2(byte value);
4639 4639
4640 // Bit field 3. 4640 // Bit field 3.
4641 inline int bit_field3(); 4641 inline int bit_field3();
4642 inline void set_bit_field3(int value); 4642 inline void set_bit_field3(int value);
4643 4643
4644 class IsShared: public BitField<bool, 0, 1> {}; 4644 class IsShared: public BitField<bool, 0, 1> {};
4645 class FunctionWithPrototype: public BitField<bool, 1, 1> {}; 4645 class FunctionWithPrototype: public BitField<bool, 1, 1> {};
4646 class LastAddedBits: public BitField<int, 2, 11> {}; 4646 class LastAddedBits: public BitField<int, 2, 11> {};
4647 class EnumLengthBits: public BitField<int, 13, 11> {};
4647 4648
4648 // Tells whether the object in the prototype property will be used 4649 // Tells whether the object in the prototype property will be used
4649 // for instances created from this function. If the prototype 4650 // for instances created from this function. If the prototype
4650 // property is set to a value that is not a JSObject, the prototype 4651 // property is set to a value that is not a JSObject, the prototype
4651 // property will not be used to create instances of the function. 4652 // property will not be used to create instances of the function.
4652 // See ECMA-262, 13.2.2. 4653 // See ECMA-262, 13.2.2.
4653 inline void set_non_instance_prototype(bool value); 4654 inline void set_non_instance_prototype(bool value);
4654 inline bool has_non_instance_prototype(); 4655 inline bool has_non_instance_prototype();
4655 4656
4656 // Tells whether function has special prototype property. If not, prototype 4657 // Tells whether function has special prototype property. If not, prototype
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
4869 4870
4870 // The size of transition arrays are limited so they do not end up in large 4871 // The size of transition arrays are limited so they do not end up in large
4871 // object space. Otherwise ClearNonLiveTransitions would leak memory while 4872 // object space. Otherwise ClearNonLiveTransitions would leak memory while
4872 // applying in-place right trimming. 4873 // applying in-place right trimming.
4873 inline bool CanHaveMoreTransitions(); 4874 inline bool CanHaveMoreTransitions();
4874 4875
4875 void SetLastAdded(int index) { 4876 void SetLastAdded(int index) {
4876 set_bit_field3(LastAddedBits::update(bit_field3(), index)); 4877 set_bit_field3(LastAddedBits::update(bit_field3(), index));
4877 } 4878 }
4878 4879
4880 int EnumLength() {
4881 return EnumLengthBits::decode(bit_field3());
4882 }
4883
4884 void SetEnumLength(int index) {
4885 set_bit_field3(EnumLengthBits::update(bit_field3(), index));
4886 }
4887
4879 int LastAdded() { 4888 int LastAdded() {
Michael Starzinger 2012/08/06 15:06:22 Can we move LastAdded() up just above SetLastAdded
Toon Verwaest 2012/08/07 10:49:47 Done.
4880 return LastAddedBits::decode(bit_field3()); 4889 return LastAddedBits::decode(bit_field3());
4881 } 4890 }
4882 4891
4883 int NumberOfSetDescriptors() { 4892 int NumberOfSetDescriptors() {
4884 ASSERT(!instance_descriptors()->IsEmpty()); 4893 ASSERT(!instance_descriptors()->IsEmpty());
4885 if (LastAdded() == kNoneAdded) return 0; 4894 if (LastAdded() == kNoneAdded) return 0;
4886 return instance_descriptors()->GetDetails(LastAdded()).index(); 4895 return instance_descriptors()->GetDetails(LastAdded()).index();
4887 } 4896 }
4888 4897
4889 MUST_USE_RESULT MaybeObject* RawCopy(int instance_size); 4898 MUST_USE_RESULT MaybeObject* RawCopy(int instance_size);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
5021 5030
5022 Map* GetPrototypeTransition(Object* prototype); 5031 Map* GetPrototypeTransition(Object* prototype);
5023 5032
5024 MUST_USE_RESULT MaybeObject* PutPrototypeTransition(Object* prototype, 5033 MUST_USE_RESULT MaybeObject* PutPrototypeTransition(Object* prototype,
5025 Map* map); 5034 Map* map);
5026 5035
5027 static const int kMaxPreAllocatedPropertyFields = 255; 5036 static const int kMaxPreAllocatedPropertyFields = 255;
5028 5037
5029 // Constant for denoting that the LastAdded field was not yet set. 5038 // Constant for denoting that the LastAdded field was not yet set.
5030 static const int kNoneAdded = LastAddedBits::kMax; 5039 static const int kNoneAdded = LastAddedBits::kMax;
5040 static const int kInvalidEnumCache = EnumLengthBits::kMax;
5031 5041
5032 // Layout description. 5042 // Layout description.
5033 static const int kInstanceSizesOffset = HeapObject::kHeaderSize; 5043 static const int kInstanceSizesOffset = HeapObject::kHeaderSize;
5034 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize; 5044 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize;
5035 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize; 5045 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize;
5036 static const int kConstructorOffset = kPrototypeOffset + kPointerSize; 5046 static const int kConstructorOffset = kPrototypeOffset + kPointerSize;
5037 // Storage for instance descriptors is overloaded to also contain additional 5047 // Storage for instance descriptors is overloaded to also contain additional
5038 // map flags when unused (bit_field3). When the map has instance descriptors, 5048 // map flags when unused (bit_field3). When the map has instance descriptors,
5039 // the flags are transferred to the instance descriptor array and accessed 5049 // the flags are transferred to the instance descriptor array and accessed
5040 // through an extra indirection. 5050 // through an extra indirection.
(...skipping 3838 matching lines...) Expand 10 before | Expand all | Expand 10 after
8879 } else { 8889 } else {
8880 value &= ~(1 << bit_position); 8890 value &= ~(1 << bit_position);
8881 } 8891 }
8882 return value; 8892 return value;
8883 } 8893 }
8884 }; 8894 };
8885 8895
8886 } } // namespace v8::internal 8896 } } // namespace v8::internal
8887 8897
8888 #endif // V8_OBJECTS_H_ 8898 #endif // V8_OBJECTS_H_
OLDNEW
« src/ia32/lithium-ia32.h ('K') | « 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