OLD | NEW |
---|---|
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 4789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4800 DECL_ACCESSORS(code_cache, Object) | 4800 DECL_ACCESSORS(code_cache, Object) |
4801 | 4801 |
4802 // [back pointer]: points back to the parent map from which a transition | 4802 // [back pointer]: points back to the parent map from which a transition |
4803 // leads to this map. The field overlaps with prototype transitions and the | 4803 // leads to this map. The field overlaps with prototype transitions and the |
4804 // back pointer will be moved into the prototype transitions array if | 4804 // back pointer will be moved into the prototype transitions array if |
4805 // required. | 4805 // required. |
4806 inline Object* GetBackPointer(); | 4806 inline Object* GetBackPointer(); |
4807 inline void SetBackPointer(Object* value, | 4807 inline void SetBackPointer(Object* value, |
4808 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 4808 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
4809 | 4809 |
4810 inline void init_back_pointer(Object* undefined); | |
Michael Starzinger
2012/07/06 13:53:18
Lets make that a camel-case method (i.e. Initializ
Toon Verwaest
2012/07/09 12:45:27
As discussed offline, will leave as is. Not comple
| |
4811 | |
4810 // [prototype transitions]: cache of prototype transitions. | 4812 // [prototype transitions]: cache of prototype transitions. |
4811 // Prototype transition is a transition that happens | 4813 // Prototype transition is a transition that happens |
4812 // when we change object's prototype to a new one. | 4814 // when we change object's prototype to a new one. |
4813 // Cache format: | 4815 // Cache format: |
4814 // 0: finger - index of the first free cell in the cache | 4816 // 0: finger - index of the first free cell in the cache |
4815 // 1: back pointer that overlaps with prototype transitions field. | 4817 // 1: back pointer that overlaps with prototype transitions field. |
4816 // 2 + 2 * i: prototype | 4818 // 2 + 2 * i: prototype |
4817 // 3 + 2 * i: target map | 4819 // 3 + 2 * i: target map |
4818 DECL_ACCESSORS(prototype_transitions, FixedArray) | 4820 inline FixedArray* prototype_transitions(); |
4821 MUST_USE_RESULT inline MaybeObject* set_prototype_transitions( | |
4822 FixedArray* prototype_transitions); | |
4823 inline bool HasPrototypeTransitions(); | |
4819 | 4824 |
4820 inline void init_prototype_transitions(Object* undefined); | |
4821 inline HeapObject* unchecked_prototype_transitions(); | 4825 inline HeapObject* unchecked_prototype_transitions(); |
4826 inline TransitionArray* unchecked_transition_array(); | |
4822 | 4827 |
4823 static const int kProtoTransitionHeaderSize = 2; | 4828 static const int kProtoTransitionHeaderSize = 1; |
4824 static const int kProtoTransitionNumberOfEntriesOffset = 0; | 4829 static const int kProtoTransitionNumberOfEntriesOffset = 0; |
4825 static const int kProtoTransitionBackPointerOffset = 1; | |
4826 static const int kProtoTransitionElementsPerEntry = 2; | 4830 static const int kProtoTransitionElementsPerEntry = 2; |
4827 static const int kProtoTransitionPrototypeOffset = 0; | 4831 static const int kProtoTransitionPrototypeOffset = 0; |
4828 static const int kProtoTransitionMapOffset = 1; | 4832 static const int kProtoTransitionMapOffset = 1; |
4829 | 4833 |
4830 inline int NumberOfProtoTransitions() { | 4834 inline int NumberOfProtoTransitions() { |
4831 FixedArray* cache = prototype_transitions(); | 4835 FixedArray* cache = prototype_transitions(); |
4832 if (cache->length() == 0) return 0; | 4836 if (cache->length() == 0) return 0; |
4833 return | 4837 return |
4834 Smi::cast(cache->get(kProtoTransitionNumberOfEntriesOffset))->value(); | 4838 Smi::cast(cache->get(kProtoTransitionNumberOfEntriesOffset))->value(); |
4835 } | 4839 } |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4988 // through an extra indirection. | 4992 // through an extra indirection. |
4989 // TODO(1399): It should be possible to make room for bit_field3 in the map | 4993 // TODO(1399): It should be possible to make room for bit_field3 in the map |
4990 // without overloading the instance descriptors field, but the map is | 4994 // without overloading the instance descriptors field, but the map is |
4991 // currently perfectly aligned to 32 bytes and extending it at all would | 4995 // currently perfectly aligned to 32 bytes and extending it at all would |
4992 // double its size. After the increment GC work lands, this size restriction | 4996 // double its size. After the increment GC work lands, this size restriction |
4993 // could be loosened and bit_field3 moved directly back in the map. | 4997 // could be loosened and bit_field3 moved directly back in the map. |
4994 static const int kInstanceDescriptorsOrBitField3Offset = | 4998 static const int kInstanceDescriptorsOrBitField3Offset = |
4995 kConstructorOffset + kPointerSize; | 4999 kConstructorOffset + kPointerSize; |
4996 static const int kCodeCacheOffset = | 5000 static const int kCodeCacheOffset = |
4997 kInstanceDescriptorsOrBitField3Offset + kPointerSize; | 5001 kInstanceDescriptorsOrBitField3Offset + kPointerSize; |
4998 static const int kPrototypeTransitionsOrBackPointerOffset = | 5002 static const int kBackPointerOffset = |
Michael Starzinger
2012/07/06 13:53:18
This should fit in one line now?
Toon Verwaest
2012/07/09 12:45:27
Done.
| |
4999 kCodeCacheOffset + kPointerSize; | 5003 kCodeCacheOffset + kPointerSize; |
5000 static const int kPadStart = | 5004 static const int kPadStart = |
Michael Starzinger
2012/07/06 13:53:18
Likewise.
Toon Verwaest
2012/07/09 12:45:27
Done.
| |
5001 kPrototypeTransitionsOrBackPointerOffset + kPointerSize; | 5005 kBackPointerOffset + kPointerSize; |
5002 static const int kSize = MAP_POINTER_ALIGN(kPadStart); | 5006 static const int kSize = MAP_POINTER_ALIGN(kPadStart); |
5003 | 5007 |
5004 // Layout of pointer fields. Heap iteration code relies on them | 5008 // Layout of pointer fields. Heap iteration code relies on them |
5005 // being continuously allocated. | 5009 // being continuously allocated. |
5006 static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset; | 5010 static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset; |
5007 static const int kPointerFieldsEndOffset = | 5011 static const int kPointerFieldsEndOffset = kBackPointerOffset + kPointerSize; |
5008 kPrototypeTransitionsOrBackPointerOffset + kPointerSize; | |
5009 | 5012 |
5010 // Byte offsets within kInstanceSizesOffset. | 5013 // Byte offsets within kInstanceSizesOffset. |
5011 static const int kInstanceSizeOffset = kInstanceSizesOffset + 0; | 5014 static const int kInstanceSizeOffset = kInstanceSizesOffset + 0; |
5012 static const int kInObjectPropertiesByte = 1; | 5015 static const int kInObjectPropertiesByte = 1; |
5013 static const int kInObjectPropertiesOffset = | 5016 static const int kInObjectPropertiesOffset = |
5014 kInstanceSizesOffset + kInObjectPropertiesByte; | 5017 kInstanceSizesOffset + kInObjectPropertiesByte; |
5015 static const int kPreAllocatedPropertyFieldsByte = 2; | 5018 static const int kPreAllocatedPropertyFieldsByte = 2; |
5016 static const int kPreAllocatedPropertyFieldsOffset = | 5019 static const int kPreAllocatedPropertyFieldsOffset = |
5017 kInstanceSizesOffset + kPreAllocatedPropertyFieldsByte; | 5020 kInstanceSizesOffset + kPreAllocatedPropertyFieldsByte; |
5018 static const int kVisitorIdByte = 3; | 5021 static const int kVisitorIdByte = 3; |
(...skipping 3805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8824 } else { | 8827 } else { |
8825 value &= ~(1 << bit_position); | 8828 value &= ~(1 << bit_position); |
8826 } | 8829 } |
8827 return value; | 8830 return value; |
8828 } | 8831 } |
8829 }; | 8832 }; |
8830 | 8833 |
8831 } } // namespace v8::internal | 8834 } } // namespace v8::internal |
8832 | 8835 |
8833 #endif // V8_OBJECTS_H_ | 8836 #endif // V8_OBJECTS_H_ |
OLD | NEW |