OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2192 isolate()->global_handles()->IterateObjectGroups( | 2192 isolate()->global_handles()->IterateObjectGroups( |
2193 visitor, &IsUnmarkedHeapObjectWithHeap); | 2193 visitor, &IsUnmarkedHeapObjectWithHeap); |
2194 MarkImplicitRefGroups(); | 2194 MarkImplicitRefGroups(); |
2195 ProcessWeakMaps(); | 2195 ProcessWeakMaps(); |
2196 work_to_do = !marking_deque_.IsEmpty(); | 2196 work_to_do = !marking_deque_.IsEmpty(); |
2197 ProcessMarkingDeque(); | 2197 ProcessMarkingDeque(); |
2198 } | 2198 } |
2199 } | 2199 } |
2200 | 2200 |
2201 | 2201 |
2202 static StackFrame* TopOptimizedFrame(Isolate* isolate) { | |
2203 for (StackFrameIterator it(isolate, isolate->thread_local_top()); | |
2204 !it.done(); it.Advance()) { | |
2205 if (it.frame()->type() == StackFrame::JAVA_SCRIPT) { | |
2206 return NULL; | |
2207 } | |
2208 if (it.frame()->type() == StackFrame::OPTIMIZED) { | |
2209 return it.frame(); | |
2210 } | |
2211 } | |
2212 return NULL; | |
2213 } | |
2214 | |
2215 | |
2216 void MarkCompactCollector::ProcessTopOptimizedFrame(ObjectVisitor* visitor) { | |
2217 StackFrame* frame = TopOptimizedFrame(isolate()); | |
2218 if (frame) { | |
Michael Starzinger
2013/07/02 15:03:44
nit: s/frame/frame != NULL/
ulan
2013/07/02 15:06:36
Done.
| |
2219 Code* code = frame->LookupCode(); | |
2220 if (!code->CanDeoptAt(frame->pc())) { | |
2221 code->CodeIterateBody(visitor); | |
2222 } | |
2223 } | |
2224 ProcessMarkingDeque(); | |
Michael Starzinger
2013/07/02 15:03:44
nit: Move the processing of the marking deque into
ulan
2013/07/02 15:06:36
Done.
| |
2225 } | |
2226 | |
2227 | |
2202 void MarkCompactCollector::MarkLiveObjects() { | 2228 void MarkCompactCollector::MarkLiveObjects() { |
2203 GCTracer::Scope gc_scope(tracer_, GCTracer::Scope::MC_MARK); | 2229 GCTracer::Scope gc_scope(tracer_, GCTracer::Scope::MC_MARK); |
2204 // The recursive GC marker detects when it is nearing stack overflow, | 2230 // The recursive GC marker detects when it is nearing stack overflow, |
2205 // and switches to a different marking system. JS interrupts interfere | 2231 // and switches to a different marking system. JS interrupts interfere |
2206 // with the C stack limit check. | 2232 // with the C stack limit check. |
2207 PostponeInterruptsScope postpone(isolate()); | 2233 PostponeInterruptsScope postpone(isolate()); |
2208 | 2234 |
2209 bool incremental_marking_overflowed = false; | 2235 bool incremental_marking_overflowed = false; |
2210 IncrementalMarking* incremental_marking = heap_->incremental_marking(); | 2236 IncrementalMarking* incremental_marking = heap_->incremental_marking(); |
2211 if (was_marked_incrementally_) { | 2237 if (was_marked_incrementally_) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2278 heap(), | 2304 heap(), |
2279 reinterpret_cast<Object**>(cell->address() + offset)); | 2305 reinterpret_cast<Object**>(cell->address() + offset)); |
2280 } | 2306 } |
2281 } | 2307 } |
2282 } | 2308 } |
2283 } | 2309 } |
2284 | 2310 |
2285 RootMarkingVisitor root_visitor(heap()); | 2311 RootMarkingVisitor root_visitor(heap()); |
2286 MarkRoots(&root_visitor); | 2312 MarkRoots(&root_visitor); |
2287 | 2313 |
2314 ProcessTopOptimizedFrame(&root_visitor); | |
2315 | |
2288 // The objects reachable from the roots are marked, yet unreachable | 2316 // The objects reachable from the roots are marked, yet unreachable |
2289 // objects are unmarked. Mark objects reachable due to host | 2317 // objects are unmarked. Mark objects reachable due to host |
2290 // application specific logic or through Harmony weak maps. | 2318 // application specific logic or through Harmony weak maps. |
2291 ProcessEphemeralMarking(&root_visitor); | 2319 ProcessEphemeralMarking(&root_visitor); |
2292 | 2320 |
2293 // The objects reachable from the roots, weak maps or object groups | 2321 // The objects reachable from the roots, weak maps or object groups |
2294 // are marked, yet unreachable objects are unmarked. Mark objects | 2322 // are marked, yet unreachable objects are unmarked. Mark objects |
2295 // reachable only from weak global handles. | 2323 // reachable only from weak global handles. |
2296 // | 2324 // |
2297 // First we identify nonlive weak handles and mark them as pending | 2325 // First we identify nonlive weak handles and mark them as pending |
(...skipping 2019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4317 while (buffer != NULL) { | 4345 while (buffer != NULL) { |
4318 SlotsBuffer* next_buffer = buffer->next(); | 4346 SlotsBuffer* next_buffer = buffer->next(); |
4319 DeallocateBuffer(buffer); | 4347 DeallocateBuffer(buffer); |
4320 buffer = next_buffer; | 4348 buffer = next_buffer; |
4321 } | 4349 } |
4322 *buffer_address = NULL; | 4350 *buffer_address = NULL; |
4323 } | 4351 } |
4324 | 4352 |
4325 | 4353 |
4326 } } // namespace v8::internal | 4354 } } // namespace v8::internal |
OLD | NEW |