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

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: Addressed comments Created 8 years, 3 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
« 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 4645 matching lines...) Expand 10 before | Expand all | Expand 10 after
4656 inline void set_bit_field(byte value); 4656 inline void set_bit_field(byte value);
4657 4657
4658 // Bit field 2. 4658 // Bit field 2.
4659 inline byte bit_field2(); 4659 inline byte bit_field2();
4660 inline void set_bit_field2(byte value); 4660 inline void set_bit_field2(byte value);
4661 4661
4662 // Bit field 3. 4662 // Bit field 3.
4663 inline int bit_field3(); 4663 inline int bit_field3();
4664 inline void set_bit_field3(int value); 4664 inline void set_bit_field3(int value);
4665 4665
4666 class NumberOfOwnDescriptorsBits: public BitField<int, 0, 11> {}; 4666 class EnumLengthBits: public BitField<int, 0, 11> {};
4667 class IsShared: public BitField<bool, 11, 1> {}; 4667 class NumberOfOwnDescriptorsBits: public BitField<int, 11, 11> {};
4668 class FunctionWithPrototype: public BitField<bool, 12, 1> {}; 4668 class IsShared: public BitField<bool, 22, 1> {};
4669 class DictionaryMap: public BitField<bool, 13, 1> {}; 4669 class FunctionWithPrototype: public BitField<bool, 23, 1> {};
4670 class DictionaryMap: public BitField<bool, 24, 1> {};
4670 4671
4671 // Tells whether the object in the prototype property will be used 4672 // Tells whether the object in the prototype property will be used
4672 // for instances created from this function. If the prototype 4673 // for instances created from this function. If the prototype
4673 // property is set to a value that is not a JSObject, the prototype 4674 // property is set to a value that is not a JSObject, the prototype
4674 // property will not be used to create instances of the function. 4675 // property will not be used to create instances of the function.
4675 // See ECMA-262, 13.2.2. 4676 // See ECMA-262, 13.2.2.
4676 inline void set_non_instance_prototype(bool value); 4677 inline void set_non_instance_prototype(bool value);
4677 inline bool has_non_instance_prototype(); 4678 inline bool has_non_instance_prototype();
4678 4679
4679 // Tells whether function has special prototype property. If not, prototype 4680 // Tells whether function has special prototype property. If not, prototype
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
4911 } 4912 }
4912 4913
4913 int NumberOfOwnDescriptors() { 4914 int NumberOfOwnDescriptors() {
4914 return NumberOfOwnDescriptorsBits::decode(bit_field3()); 4915 return NumberOfOwnDescriptorsBits::decode(bit_field3());
4915 } 4916 }
4916 4917
4917 void SetNumberOfOwnDescriptors(int number) { 4918 void SetNumberOfOwnDescriptors(int number) {
4918 set_bit_field3(NumberOfOwnDescriptorsBits::update(bit_field3(), number)); 4919 set_bit_field3(NumberOfOwnDescriptorsBits::update(bit_field3(), number));
4919 } 4920 }
4920 4921
4922 int EnumLength() {
4923 return EnumLengthBits::decode(bit_field3());
4924 }
4925
4926 void SetEnumLength(int index) {
4927 set_bit_field3(EnumLengthBits::update(bit_field3(), index));
4928 }
4929
4921 MUST_USE_RESULT MaybeObject* RawCopy(int instance_size); 4930 MUST_USE_RESULT MaybeObject* RawCopy(int instance_size);
4922 MUST_USE_RESULT MaybeObject* CopyWithPreallocatedFieldDescriptors(); 4931 MUST_USE_RESULT MaybeObject* CopyWithPreallocatedFieldDescriptors();
4923 MUST_USE_RESULT MaybeObject* CopyDropDescriptors(); 4932 MUST_USE_RESULT MaybeObject* CopyDropDescriptors();
4924 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptors( 4933 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptors(
4925 DescriptorArray* descriptors, 4934 DescriptorArray* descriptors,
4926 String* name, 4935 String* name,
4927 TransitionFlag flag); 4936 TransitionFlag flag);
4928 MUST_USE_RESULT MaybeObject* CopyAddDescriptor(Descriptor* descriptor, 4937 MUST_USE_RESULT MaybeObject* CopyAddDescriptor(Descriptor* descriptor,
4929 TransitionFlag flag); 4938 TransitionFlag flag);
4930 MUST_USE_RESULT MaybeObject* CopyInsertDescriptor(Descriptor* descriptor, 4939 MUST_USE_RESULT MaybeObject* CopyInsertDescriptor(Descriptor* descriptor,
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
5050 // and the values are the maps the are transitioned to. 5059 // and the values are the maps the are transitioned to.
5051 static const int kMaxCachedPrototypeTransitions = 256; 5060 static const int kMaxCachedPrototypeTransitions = 256;
5052 5061
5053 Map* GetPrototypeTransition(Object* prototype); 5062 Map* GetPrototypeTransition(Object* prototype);
5054 5063
5055 MUST_USE_RESULT MaybeObject* PutPrototypeTransition(Object* prototype, 5064 MUST_USE_RESULT MaybeObject* PutPrototypeTransition(Object* prototype,
5056 Map* map); 5065 Map* map);
5057 5066
5058 static const int kMaxPreAllocatedPropertyFields = 255; 5067 static const int kMaxPreAllocatedPropertyFields = 255;
5059 5068
5069 // Constant for denoting that the Enum Cache field was not yet used.
5070 static const int kInvalidEnumCache = EnumLengthBits::kMax;
5071
5060 // Layout description. 5072 // Layout description.
5061 static const int kInstanceSizesOffset = HeapObject::kHeaderSize; 5073 static const int kInstanceSizesOffset = HeapObject::kHeaderSize;
5062 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize; 5074 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize;
5063 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize; 5075 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize;
5064 static const int kConstructorOffset = kPrototypeOffset + kPointerSize; 5076 static const int kConstructorOffset = kPrototypeOffset + kPointerSize;
5065 // Storage for the transition array is overloaded to directly contain a back 5077 // Storage for the transition array is overloaded to directly contain a back
5066 // pointer if unused. When the map has transitions, the back pointer is 5078 // pointer if unused. When the map has transitions, the back pointer is
5067 // transferred to the transition array and accessed through an extra 5079 // transferred to the transition array and accessed through an extra
5068 // indirection. 5080 // indirection.
5069 static const int kTransitionsOrBackPointerOffset = 5081 static const int kTransitionsOrBackPointerOffset =
(...skipping 3860 matching lines...) Expand 10 before | Expand all | Expand 10 after
8930 } else { 8942 } else {
8931 value &= ~(1 << bit_position); 8943 value &= ~(1 << bit_position);
8932 } 8944 }
8933 return value; 8945 return value;
8934 } 8946 }
8935 }; 8947 };
8936 8948
8937 } } // namespace v8::internal 8949 } } // namespace v8::internal
8938 8950
8939 #endif // V8_OBJECTS_H_ 8951 #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