OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 2881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2892 static const int kFlagsCacheInPrototypeMapMask = 0x00000800; | 2892 static const int kFlagsCacheInPrototypeMapMask = 0x00000800; |
2893 static const int kFlagsArgumentsCountMask = 0xFFFFF000; | 2893 static const int kFlagsArgumentsCountMask = 0xFFFFF000; |
2894 | 2894 |
2895 static const int kFlagsNotUsedInLookup = | 2895 static const int kFlagsNotUsedInLookup = |
2896 (kFlagsICInLoopMask | kFlagsTypeMask | kFlagsCacheInPrototypeMapMask); | 2896 (kFlagsICInLoopMask | kFlagsTypeMask | kFlagsCacheInPrototypeMapMask); |
2897 | 2897 |
2898 private: | 2898 private: |
2899 DISALLOW_IMPLICIT_CONSTRUCTORS(Code); | 2899 DISALLOW_IMPLICIT_CONSTRUCTORS(Code); |
2900 }; | 2900 }; |
2901 | 2901 |
| 2902 typedef void (*Scavenger)(Map* map, HeapObject** slot, HeapObject* object); |
2902 | 2903 |
2903 // All heap objects have a Map that describes their structure. | 2904 // All heap objects have a Map that describes their structure. |
2904 // A Map contains information about: | 2905 // A Map contains information about: |
2905 // - Size information about the object | 2906 // - Size information about the object |
2906 // - How to iterate over an object (for garbage collection) | 2907 // - How to iterate over an object (for garbage collection) |
2907 class Map: public HeapObject { | 2908 class Map: public HeapObject { |
2908 public: | 2909 public: |
2909 // Instance size. | 2910 // Instance size. |
2910 inline int instance_size(); | 2911 inline int instance_size(); |
2911 inline void set_instance_size(int value); | 2912 inline void set_instance_size(int value); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3093 // following back pointers. | 3094 // following back pointers. |
3094 void ClearNonLiveTransitions(Object* real_prototype); | 3095 void ClearNonLiveTransitions(Object* real_prototype); |
3095 | 3096 |
3096 // Dispatched behavior. | 3097 // Dispatched behavior. |
3097 void MapIterateBody(ObjectVisitor* v); | 3098 void MapIterateBody(ObjectVisitor* v); |
3098 #ifdef DEBUG | 3099 #ifdef DEBUG |
3099 void MapPrint(); | 3100 void MapPrint(); |
3100 void MapVerify(); | 3101 void MapVerify(); |
3101 #endif | 3102 #endif |
3102 | 3103 |
| 3104 inline Scavenger scavenger(); |
| 3105 inline void set_scavenger(Scavenger callback); |
| 3106 |
| 3107 inline void Scavenge(HeapObject** slot, HeapObject* obj) { |
| 3108 scavenger()(this, slot, obj); |
| 3109 } |
| 3110 |
3103 static const int kMaxPreAllocatedPropertyFields = 255; | 3111 static const int kMaxPreAllocatedPropertyFields = 255; |
3104 | 3112 |
3105 // Layout description. | 3113 // Layout description. |
3106 static const int kInstanceSizesOffset = HeapObject::kHeaderSize; | 3114 static const int kInstanceSizesOffset = HeapObject::kHeaderSize; |
3107 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize; | 3115 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize; |
3108 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize; | 3116 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize; |
3109 static const int kConstructorOffset = kPrototypeOffset + kPointerSize; | 3117 static const int kConstructorOffset = kPrototypeOffset + kPointerSize; |
3110 static const int kInstanceDescriptorsOffset = | 3118 static const int kInstanceDescriptorsOffset = |
3111 kConstructorOffset + kPointerSize; | 3119 kConstructorOffset + kPointerSize; |
3112 static const int kCodeCacheOffset = kInstanceDescriptorsOffset + kPointerSize; | 3120 static const int kCodeCacheOffset = kInstanceDescriptorsOffset + kPointerSize; |
3113 static const int kPadStart = kCodeCacheOffset + kPointerSize; | 3121 static const int kIterateBodyCallbackOffset = kCodeCacheOffset + kPointerSize; |
| 3122 static const int kPadStart = kIterateBodyCallbackOffset + kPointerSize; |
3114 static const int kSize = MAP_POINTER_ALIGN(kPadStart); | 3123 static const int kSize = MAP_POINTER_ALIGN(kPadStart); |
3115 | 3124 |
3116 // Layout of pointer fields. Heap iteration code relies on them | 3125 // Layout of pointer fields. Heap iteration code relies on them |
3117 // being continiously allocated. | 3126 // being continiously allocated. |
3118 static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset; | 3127 static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset; |
3119 static const int kPointerFieldsEndOffset = | 3128 static const int kPointerFieldsEndOffset = |
3120 Map::kCodeCacheOffset + kPointerSize; | 3129 Map::kCodeCacheOffset + kPointerSize; |
3121 | 3130 |
3122 // Byte offsets within kInstanceSizesOffset. | 3131 // Byte offsets within kInstanceSizesOffset. |
3123 static const int kInstanceSizeOffset = kInstanceSizesOffset + 0; | 3132 static const int kInstanceSizeOffset = kInstanceSizesOffset + 0; |
(...skipping 2233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5357 } else { | 5366 } else { |
5358 value &= ~(1 << bit_position); | 5367 value &= ~(1 << bit_position); |
5359 } | 5368 } |
5360 return value; | 5369 return value; |
5361 } | 5370 } |
5362 }; | 5371 }; |
5363 | 5372 |
5364 } } // namespace v8::internal | 5373 } } // namespace v8::internal |
5365 | 5374 |
5366 #endif // V8_OBJECTS_H_ | 5375 #endif // V8_OBJECTS_H_ |
OLD | NEW |