| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 148 |
| 149 // Marking operations for objects reachable from roots. | 149 // Marking operations for objects reachable from roots. |
| 150 static void MarkLiveObjects(); | 150 static void MarkLiveObjects(); |
| 151 | 151 |
| 152 static void MarkUnmarkedObject(HeapObject* obj); | 152 static void MarkUnmarkedObject(HeapObject* obj); |
| 153 | 153 |
| 154 static inline void MarkObject(HeapObject* obj) { | 154 static inline void MarkObject(HeapObject* obj) { |
| 155 if (!obj->IsMarked()) MarkUnmarkedObject(obj); | 155 if (!obj->IsMarked()) MarkUnmarkedObject(obj); |
| 156 } | 156 } |
| 157 | 157 |
| 158 // Creates back pointers for all map transitions, stores them in | |
| 159 // the prototype field. The original prototype pointers are restored | |
| 160 // in ClearNonLiveTransitions(). All JSObject maps | |
| 161 // connected by map transitions have the same prototype object, which | |
| 162 // is why we can use this field temporarily for back pointers. | |
| 163 static void CreateBackPointers(); | |
| 164 | |
| 165 // Mark a Map and its DescriptorArray together, skipping transitions. | |
| 166 static void MarkMapContents(Map* map); | |
| 167 static void MarkDescriptorArray(DescriptorArray* descriptors); | |
| 168 | |
| 169 // Mark the heap roots and all objects reachable from them. | 158 // Mark the heap roots and all objects reachable from them. |
| 170 static void ProcessRoots(RootMarkingVisitor* visitor); | 159 static void ProcessRoots(RootMarkingVisitor* visitor); |
| 171 | 160 |
| 172 // Mark objects in object groups that have at least one object in the | 161 // Mark objects in object groups that have at least one object in the |
| 173 // group marked. | 162 // group marked. |
| 174 static void MarkObjectGroups(); | 163 static void MarkObjectGroups(); |
| 175 | 164 |
| 176 // Mark all objects in an object group with at least one marked | 165 // Mark all objects in an object group with at least one marked |
| 177 // object, then all objects reachable from marked objects in object | 166 // object, then all objects reachable from marked objects in object |
| 178 // groups, and repeat. | 167 // groups, and repeat. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 198 | 187 |
| 199 #ifdef DEBUG | 188 #ifdef DEBUG |
| 200 static void UpdateLiveObjectCount(HeapObject* obj); | 189 static void UpdateLiveObjectCount(HeapObject* obj); |
| 201 static void VerifyHeapAfterMarkingPhase(); | 190 static void VerifyHeapAfterMarkingPhase(); |
| 202 #endif | 191 #endif |
| 203 | 192 |
| 204 // We sweep the large object space in the same way whether we are | 193 // We sweep the large object space in the same way whether we are |
| 205 // compacting or not, because the large object space is never compacted. | 194 // compacting or not, because the large object space is never compacted. |
| 206 static void SweepLargeObjectSpace(); | 195 static void SweepLargeObjectSpace(); |
| 207 | 196 |
| 208 // Test whether a (possibly marked) object is a Map. | |
| 209 static inline bool SafeIsMap(HeapObject* object); | |
| 210 | |
| 211 // Map transitions from a live map to a dead map must be killed. | |
| 212 // We replace them with a null descriptor, with the same key. | |
| 213 static void ClearNonLiveTransitions(); | |
| 214 | |
| 215 // -------------------------------------------------------------------------- | 197 // -------------------------------------------------------------------------- |
| 216 // Phase 2: functions related to computing and encoding forwarding pointers | 198 // Phase 2: functions related to computing and encoding forwarding pointers |
| 217 // before: live objects' map pointers are marked as '00' | 199 // before: live objects' map pointers are marked as '00' |
| 218 // after: Map pointers of live old and map objects have encoded | 200 // after: Map pointers of live old and map objects have encoded |
| 219 // forwarding pointers and map pointers | 201 // forwarding pointers and map pointers |
| 220 // | 202 // |
| 221 // The 3rd word of a page has the page top offset after compaction. | 203 // The 3rd word of a page has the page top offset after compaction. |
| 222 // | 204 // |
| 223 // The 4th word of a page in the map space has the map index | 205 // The 4th word of a page in the map space has the map index |
| 224 // of this page in the map table. This word is not used in | 206 // of this page in the map table. This word is not used in |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 | 356 |
| 375 friend class UnmarkObjectVisitor; | 357 friend class UnmarkObjectVisitor; |
| 376 static void UnmarkObject(HeapObject* obj); | 358 static void UnmarkObject(HeapObject* obj); |
| 377 #endif | 359 #endif |
| 378 }; | 360 }; |
| 379 | 361 |
| 380 | 362 |
| 381 } } // namespace v8::internal | 363 } } // namespace v8::internal |
| 382 | 364 |
| 383 #endif // V8_MARK_COMPACT_H_ | 365 #endif // V8_MARK_COMPACT_H_ |
| OLD | NEW |