| 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 | 
| 158   // Mark the heap roots and all objects reachable from them. | 169   // Mark the heap roots and all objects reachable from them. | 
| 159   static void ProcessRoots(RootMarkingVisitor* visitor); | 170   static void ProcessRoots(RootMarkingVisitor* visitor); | 
| 160 | 171 | 
| 161   // Mark objects in object groups that have at least one object in the | 172   // Mark objects in object groups that have at least one object in the | 
| 162   // group marked. | 173   // group marked. | 
| 163   static void MarkObjectGroups(); | 174   static void MarkObjectGroups(); | 
| 164 | 175 | 
| 165   // Mark all objects in an object group with at least one marked | 176   // Mark all objects in an object group with at least one marked | 
| 166   // object, then all objects reachable from marked objects in object | 177   // object, then all objects reachable from marked objects in object | 
| 167   // groups, and repeat. | 178   // groups, and repeat. | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
| 187 | 198 | 
| 188 #ifdef DEBUG | 199 #ifdef DEBUG | 
| 189   static void UpdateLiveObjectCount(HeapObject* obj); | 200   static void UpdateLiveObjectCount(HeapObject* obj); | 
| 190   static void VerifyHeapAfterMarkingPhase(); | 201   static void VerifyHeapAfterMarkingPhase(); | 
| 191 #endif | 202 #endif | 
| 192 | 203 | 
| 193   // We sweep the large object space in the same way whether we are | 204   // We sweep the large object space in the same way whether we are | 
| 194   // compacting or not, because the large object space is never compacted. | 205   // compacting or not, because the large object space is never compacted. | 
| 195   static void SweepLargeObjectSpace(); | 206   static void SweepLargeObjectSpace(); | 
| 196 | 207 | 
|  | 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 | 
| 197   // -------------------------------------------------------------------------- | 215   // -------------------------------------------------------------------------- | 
| 198   // Phase 2: functions related to computing and encoding forwarding pointers | 216   // Phase 2: functions related to computing and encoding forwarding pointers | 
| 199   //   before: live objects' map pointers are marked as '00' | 217   //   before: live objects' map pointers are marked as '00' | 
| 200   //    after: Map pointers of live old and map objects have encoded | 218   //    after: Map pointers of live old and map objects have encoded | 
| 201   //           forwarding pointers and map pointers | 219   //           forwarding pointers and map pointers | 
| 202   // | 220   // | 
| 203   //           The 3rd word of a page has the page top offset after compaction. | 221   //           The 3rd word of a page has the page top offset after compaction. | 
| 204   // | 222   // | 
| 205   //           The 4th word of a page in the map space has the map index | 223   //           The 4th word of a page in the map space has the map index | 
| 206   //           of this page in the map table. This word is not used in | 224   //           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... | 
| 356 | 374 | 
| 357   friend class UnmarkObjectVisitor; | 375   friend class UnmarkObjectVisitor; | 
| 358   static void UnmarkObject(HeapObject* obj); | 376   static void UnmarkObject(HeapObject* obj); | 
| 359 #endif | 377 #endif | 
| 360 }; | 378 }; | 
| 361 | 379 | 
| 362 | 380 | 
| 363 } }  // namespace v8::internal | 381 } }  // namespace v8::internal | 
| 364 | 382 | 
| 365 #endif  // V8_MARK_COMPACT_H_ | 383 #endif  // V8_MARK_COMPACT_H_ | 
| OLD | NEW | 
|---|