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