[heap] Add basic infrastructure for incremental wrapper tracing.

BUG=chromium:468240

Review-Url: https://codereview.chromium.org/2245133004
Cr-Commit-Position: refs/heads/master@{#38702}
This commit is contained in:
hpayer 2016-08-18 01:45:25 -07:00 committed by Commit bot
parent 074aa90ca5
commit 03d5f87597
5 changed files with 24 additions and 11 deletions

View File

@ -740,6 +740,8 @@ DEFINE_BOOL(age_code, true,
"track un-executed functions to age code and flush only "
"old code (required for code flushing)")
DEFINE_BOOL(incremental_marking, true, "use incremental marking")
DEFINE_BOOL(incremental_marking_wrappers, true,
"use incremental marking for marking wrappers")
DEFINE_INT(min_progress_during_incremental_marking_finalization, 32,
"keep finalizing incremental marking as long as we discover at "
"least this many unmarked objects")

View File

@ -5454,7 +5454,15 @@ void Heap::TracePossibleWrapper(JSObject* js_object) {
}
void Heap::RegisterExternallyReferencedObject(Object** object) {
mark_compact_collector()->RegisterExternallyReferencedObject(object);
HeapObject* heap_object = HeapObject::cast(*object);
DCHECK(Contains(heap_object));
if (FLAG_incremental_marking_wrappers && incremental_marking()->IsMarking()) {
IncrementalMarking::MarkGrey(this, heap_object);
} else {
DCHECK(mark_compact_collector()->in_use());
MarkBit mark_bit = ObjectMarking::MarkBitFrom(heap_object);
mark_compact_collector()->MarkObject(heap_object, mark_bit);
}
}
void Heap::TearDown() {

View File

@ -1201,6 +1201,19 @@ intptr_t IncrementalMarking::Step(intptr_t allocated_bytes,
if (state_ == MARKING) {
bytes_processed = ProcessMarkingDeque(bytes_to_process);
if (FLAG_incremental_marking_wrappers &&
heap_->UsingEmbedderHeapTracer()) {
// This currently marks through all registered wrappers and does not
// respect bytes_to_process.
// TODO(hpayer): Integrate incremental marking of wrappers into
// bytes_to_process logic.
heap_->mark_compact_collector()
->RegisterWrappersWithEmbedderHeapTracer();
heap_->mark_compact_collector()->embedder_heap_tracer()->AdvanceTracing(
0,
EmbedderHeapTracer::AdvanceTracingActions(
EmbedderHeapTracer::ForceCompletionAction::FORCE_COMPLETION));
}
if (heap_->mark_compact_collector()->marking_deque()->IsEmpty()) {
if (completion == FORCE_COMPLETION ||
IsIdleMarkingDelayCounterLimitReached()) {

View File

@ -2223,14 +2223,6 @@ void MarkCompactCollector::TracePossibleWrapper(JSObject* js_object) {
}
}
void MarkCompactCollector::RegisterExternallyReferencedObject(Object** object) {
DCHECK(in_use());
HeapObject* heap_object = HeapObject::cast(*object);
DCHECK(heap_->Contains(heap_object));
MarkBit mark_bit = ObjectMarking::MarkBitFrom(heap_object);
MarkObject(heap_object, mark_bit);
}
class MarkCompactCollector::ObjectStatsVisitor
: public MarkCompactCollector::HeapObjectVisitor {
public:

View File

@ -500,8 +500,6 @@ class MarkCompactCollector {
void TracePossibleWrapper(JSObject* js_object);
void RegisterExternallyReferencedObject(Object** object);
private:
class EvacuateNewSpacePageVisitor;
class EvacuateNewSpaceVisitor;