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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
149 | 149 |
150 static void MarkUnmarkedObject(HeapObject* obj); | 150 static void MarkUnmarkedObject(HeapObject* obj); |
151 | 151 |
152 static inline void MarkObject(HeapObject* obj) { | 152 static inline void MarkObject(HeapObject* obj) { |
153 if (!obj->IsMarked()) MarkUnmarkedObject(obj); | 153 if (!obj->IsMarked()) MarkUnmarkedObject(obj); |
154 } | 154 } |
155 | 155 |
156 static inline void SetMark(HeapObject* obj) { | 156 static inline void SetMark(HeapObject* obj) { |
157 tracer_->increment_marked_count(); | 157 tracer_->increment_marked_count(); |
158 #ifdef DEBUG | 158 #ifdef DEBUG |
159 UpdateLiveObjectCount(obj, 1); | 159 UpdateLiveObjectCount(obj, 1); |
Kasper Lund
2009/05/05 05:22:34
Do you need the scale argument to UpdateLiveObject
Kevin Millikin (Chromium)
2009/05/05 05:34:07
No, you're right. I'll revert it when we clean th
| |
160 #endif | 160 #endif |
161 obj->SetMark(); | 161 obj->SetMark(); |
162 } | 162 } |
163 | 163 |
164 // Used to clear mark bits during marking for objects that are not | |
165 // actually live. Since it updates bookkeeping state, it is not | |
166 // used when clearing mark bits on live objects (eg, during | |
167 // sweeping). | |
168 static inline void ClearMark(HeapObject* obj) { | |
169 obj->ClearMark(); | |
170 tracer_->decrement_marked_count(); | |
171 #ifdef DEBUG | |
172 UpdateLiveObjectCount(obj, -1); | |
173 #endif | |
174 } | |
175 | |
176 // Creates back pointers for all map transitions, stores them in | 164 // Creates back pointers for all map transitions, stores them in |
177 // the prototype field. The original prototype pointers are restored | 165 // the prototype field. The original prototype pointers are restored |
178 // in ClearNonLiveTransitions(). All JSObject maps | 166 // in ClearNonLiveTransitions(). All JSObject maps |
179 // connected by map transitions have the same prototype object, which | 167 // connected by map transitions have the same prototype object, which |
180 // is why we can use this field temporarily for back pointers. | 168 // is why we can use this field temporarily for back pointers. |
181 static void CreateBackPointers(); | 169 static void CreateBackPointers(); |
182 | 170 |
183 // Mark a Map and its DescriptorArray together, skipping transitions. | 171 // Mark a Map and its DescriptorArray together, skipping transitions. |
184 static void MarkMapContents(Map* map); | 172 static void MarkMapContents(Map* map); |
185 static void MarkDescriptorArray(DescriptorArray* descriptors); | 173 static void MarkDescriptorArray(DescriptorArray* descriptors); |
186 | 174 |
187 // Mark the heap roots and all objects reachable from them. | 175 // Mark the heap roots and all objects reachable from them. |
188 static void ProcessRoots(RootMarkingVisitor* visitor); | 176 static void MarkRoots(RootMarkingVisitor* visitor); |
177 | |
178 // Mark the symbol table specially. References to symbols are weak. | |
iposva
2009/05/05 05:05:19
Please clarify: References to symbols from the sym
| |
179 static void MarkSymbolTable(); | |
189 | 180 |
190 // Mark objects in object groups that have at least one object in the | 181 // Mark objects in object groups that have at least one object in the |
191 // group marked. | 182 // group marked. |
192 static void MarkObjectGroups(); | 183 static void MarkObjectGroups(); |
193 | 184 |
194 // Mark all objects in an object group with at least one marked | 185 // Mark all objects in an object group with at least one marked |
195 // object, then all objects reachable from marked objects in object | 186 // object, then all objects reachable from marked objects in object |
196 // groups, and repeat. | 187 // groups, and repeat. |
197 static void ProcessObjectGroups(MarkingVisitor* visitor); | 188 static void ProcessObjectGroups(MarkingVisitor* visitor); |
198 | 189 |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
414 | 405 |
415 friend class UnmarkObjectVisitor; | 406 friend class UnmarkObjectVisitor; |
416 static void UnmarkObject(HeapObject* obj); | 407 static void UnmarkObject(HeapObject* obj); |
417 #endif | 408 #endif |
418 }; | 409 }; |
419 | 410 |
420 | 411 |
421 } } // namespace v8::internal | 412 } } // namespace v8::internal |
422 | 413 |
423 #endif // V8_MARK_COMPACT_H_ | 414 #endif // V8_MARK_COMPACT_H_ |
OLD | NEW |