Move EmbedderHeapTracer::TracePrologue call to the beginning of full gc

With cl https://codereview.chromium.org/2043033002 blink will add new wrappers
to its marking deque (and maintain this deque) so black allocated wrappers are
not a problem anymore. To limit the scope of when blink has to detect wrappers,
we need to tell blink when we start and when we end full gcs. For that we can
nicely use TracePrologue and TraceEpilogue.

LOG=no
BUG=468240

Review-Url: https://codereview.chromium.org/2051103002
Cr-Commit-Position: refs/heads/master@{#36937}
This commit is contained in:
hlopko 2016-06-13 10:13:03 -07:00 committed by Commit bot
parent deb67d7d05
commit ac1587bb86
3 changed files with 18 additions and 4 deletions

View File

@ -5469,6 +5469,11 @@ class V8_EXPORT EmbedderHeapTracer {
*/
virtual void TraceEpilogue() = 0;
/**
* Throw away all intermediate data and reset to the initial state.
*/
virtual void AbortTracing() {}
protected:
virtual ~EmbedderHeapTracer() = default;
};

View File

@ -542,6 +542,10 @@ void IncrementalMarking::StartMarking() {
state_ = MARKING;
if (heap_->UsingEmbedderHeapTracer()) {
heap_->mark_compact_collector()->embedder_heap_tracer()->TracePrologue();
}
RecordWriteStub::Mode mode = is_compacting_
? RecordWriteStub::INCREMENTAL_COMPACTION
: RecordWriteStub::INCREMENTAL;

View File

@ -857,9 +857,18 @@ void MarkCompactCollector::Prepare() {
AbortWeakCells();
AbortTransitionArrays();
AbortCompaction();
if (heap_->UsingEmbedderHeapTracer()) {
heap_->mark_compact_collector()->embedder_heap_tracer()->AbortTracing();
}
was_marked_incrementally_ = false;
}
if (!was_marked_incrementally_) {
if (heap_->UsingEmbedderHeapTracer()) {
heap_->mark_compact_collector()->embedder_heap_tracer()->TracePrologue();
}
}
// Don't start compaction if we are in the middle of incremental
// marking cycle. We did not collect any slots.
if (!FLAG_never_compact && !was_marked_incrementally_) {
@ -2320,10 +2329,6 @@ void MarkCompactCollector::MarkLiveObjects() {
{
TRACE_GC(heap()->tracer(),
GCTracer::Scope::MC_MARK_WEAK_CLOSURE_EPHEMERAL);
if (UsingEmbedderHeapTracer()) {
embedder_heap_tracer()->TracePrologue();
ProcessMarkingDeque();
}
ProcessEphemeralMarking(&root_visitor, false);
}