| 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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 // This single GC is not enough for two reasons: | 404 // This single GC is not enough for two reasons: |
| 405 // (1) The GC is not precise because the GC scans on-stack pointers co
nservatively. | 405 // (1) The GC is not precise because the GC scans on-stack pointers co
nservatively. |
| 406 // (2) One GC is not enough to break a chain of persistent handles. It
's possible that | 406 // (2) One GC is not enough to break a chain of persistent handles. It
's possible that |
| 407 // some heap allocated objects own objects that contain persistent
handles | 407 // some heap allocated objects own objects that contain persistent
handles |
| 408 // pointing to other heap allocated objects. To break the chain, w
e need multiple GCs. | 408 // pointing to other heap allocated objects. To break the chain, w
e need multiple GCs. |
| 409 // | 409 // |
| 410 // Regarding (1), we force a precise GC at the end of the current event
loop. So if you want | 410 // Regarding (1), we force a precise GC at the end of the current event
loop. So if you want |
| 411 // to collect all garbage, you need to wait until the next event loop. | 411 // to collect all garbage, you need to wait until the next event loop. |
| 412 // Regarding (2), it would be OK in practice to trigger only one GC per
gcEpilogue, because | 412 // Regarding (2), it would be OK in practice to trigger only one GC per
gcEpilogue, because |
| 413 // GCController.collectAll() forces 7 V8's GC. | 413 // GCController.collectAll() forces 7 V8's GC. |
| 414 Heap::collectGarbage(ThreadState::HeapPointersOnStack, ThreadState::GCWi
thSweep, Heap::ForcedGCForTesting); | 414 Heap::collectGarbage(ThreadState::HeapPointersOnStack, ThreadState::GCWi
thSweep, Heap::ForcedGC); |
| 415 | 415 |
| 416 // Forces a precise GC at the end of the current event loop. | 416 // Forces a precise GC at the end of the current event loop. |
| 417 ThreadState::current()->setGCState(ThreadState::GCScheduledForTesting); | 417 ThreadState::current()->setGCState(ThreadState::FullGCScheduled); |
| 418 } | 418 } |
| 419 | 419 |
| 420 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "GCEvent",
"usedHeapSizeAfter", usedHeapSize(isolate)); | 420 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "GCEvent",
"usedHeapSizeAfter", usedHeapSize(isolate)); |
| 421 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data(
)); | 421 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data(
)); |
| 422 } | 422 } |
| 423 | 423 |
| 424 void V8GCController::minorGCEpilogue(v8::Isolate* isolate) | 424 void V8GCController::minorGCEpilogue(v8::Isolate* isolate) |
| 425 { | 425 { |
| 426 TRACE_EVENT_END0("v8", "minorGC"); | 426 TRACE_EVENT_END0("v8", "minorGC"); |
| 427 if (isMainThread()) { | 427 if (isMainThread()) { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 Visitor* m_visitor; | 507 Visitor* m_visitor; |
| 508 }; | 508 }; |
| 509 | 509 |
| 510 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) | 510 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) |
| 511 { | 511 { |
| 512 DOMWrapperTracer tracer(visitor); | 512 DOMWrapperTracer tracer(visitor); |
| 513 v8::V8::VisitHandlesWithClassIds(isolate, &tracer); | 513 v8::V8::VisitHandlesWithClassIds(isolate, &tracer); |
| 514 } | 514 } |
| 515 | 515 |
| 516 } // namespace blink | 516 } // namespace blink |
| OLD | NEW |