OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 // some heap allocated objects own objects that contain persistent
handles | 375 // some heap allocated objects own objects that contain persistent
handles |
376 // pointing to other heap allocated objects. To break the chain, w
e need multiple GCs. | 376 // pointing to other heap allocated objects. To break the chain, w
e need multiple GCs. |
377 // | 377 // |
378 // Regarding (1), we force a precise GC at the end of the current event
loop. So if you want | 378 // Regarding (1), we force a precise GC at the end of the current event
loop. So if you want |
379 // to collect all garbage, you need to wait until the next event loop. | 379 // to collect all garbage, you need to wait until the next event loop. |
380 // Regarding (2), it would be OK in practice to trigger only one GC per
gcEpilogue, because | 380 // Regarding (2), it would be OK in practice to trigger only one GC per
gcEpilogue, because |
381 // GCController.collectAll() forces 7 V8's GC. | 381 // GCController.collectAll() forces 7 V8's GC. |
382 Heap::collectGarbage(BlinkGC::HeapPointersOnStack, BlinkGC::GCWithSweep,
BlinkGC::ForcedGC); | 382 Heap::collectGarbage(BlinkGC::HeapPointersOnStack, BlinkGC::GCWithSweep,
BlinkGC::ForcedGC); |
383 | 383 |
384 // Forces a precise GC at the end of the current event loop. | 384 // Forces a precise GC at the end of the current event loop. |
385 if (ThreadState::current()) | 385 if (ThreadState::current()) { |
| 386 // Temporary asserts to diagnose crbug.com/571207's failure to trans
ition |
| 387 // to FullGCScheduled. |
| 388 RELEASE_ASSERT(!ThreadState::current()->isSweepingInProgress()); |
| 389 RELEASE_ASSERT(!ThreadState::current()->isInGC()); |
386 ThreadState::current()->setGCState(ThreadState::FullGCScheduled); | 390 ThreadState::current()->setGCState(ThreadState::FullGCScheduled); |
| 391 } |
387 } | 392 } |
388 | 393 |
389 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data(
)); | 394 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data(
)); |
390 } | 395 } |
391 | 396 |
392 void V8GCController::collectGarbage(v8::Isolate* isolate) | 397 void V8GCController::collectGarbage(v8::Isolate* isolate) |
393 { | 398 { |
394 v8::HandleScope handleScope(isolate); | 399 v8::HandleScope handleScope(isolate); |
395 RefPtr<ScriptState> scriptState = ScriptState::create(v8::Context::New(isola
te), DOMWrapperWorld::create(isolate)); | 400 RefPtr<ScriptState> scriptState = ScriptState::create(v8::Context::New(isola
te), DOMWrapperWorld::create(isolate)); |
396 ScriptState::Scope scope(scriptState.get()); | 401 ScriptState::Scope scope(scriptState.get()); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 Visitor* m_visitor; | 450 Visitor* m_visitor; |
446 }; | 451 }; |
447 | 452 |
448 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) | 453 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) |
449 { | 454 { |
450 DOMWrapperTracer tracer(visitor); | 455 DOMWrapperTracer tracer(visitor); |
451 isolate->VisitHandlesWithClassIds(&tracer); | 456 isolate->VisitHandlesWithClassIds(&tracer); |
452 } | 457 } |
453 | 458 |
454 } // namespace blink | 459 } // namespace blink |
OLD | NEW |