Commit d2bd9517 authored by mlippautz's avatar mlippautz Committed by Commit bot

[GC] Check for incremental marking when a GC is triggered on reaching the external allocation limit

We missed a check whether we can actually do incremental marking when starting
it on reaching the external allocation limit.

BUG=chromium:517195
LOG=N

Review URL: https://codereview.chromium.org/1274983002

Cr-Commit-Position: refs/heads/master@{#30043}
parent 2e0d55a5
......@@ -6887,18 +6887,26 @@ Local<Integer> v8::Integer::NewFromUnsigned(Isolate* isolate, uint32_t value) {
void Isolate::CollectAllGarbage(const char* gc_reason) {
i::Heap* heap = reinterpret_cast<i::Isolate*>(this)->heap();
if (heap->incremental_marking()->IsStopped()) {
if (heap->incremental_marking()->CanBeActivated()) {
heap->StartIncrementalMarking(i::Heap::kNoGCFlags, kGCCallbackFlagForced,
gc_reason);
} else {
heap->CollectAllGarbage(i::Heap::kNoGCFlags, gc_reason,
kGCCallbackFlagForced);
}
} else {
// Incremental marking is turned on an has already been started.
// TODO(mlippautz): Compute the time slice for incremental marking based on
// memory pressure.
double deadline = heap->MonotonicallyIncreasingTimeInMs() +
i::FLAG_external_allocation_limit_incremental_time;
heap->AdvanceIncrementalMarking(0, deadline,
i::IncrementalMarking::StepActions(
heap->AdvanceIncrementalMarking(
0, deadline, i::IncrementalMarking::StepActions(
i::IncrementalMarking::GC_VIA_STACK_GUARD,
i::IncrementalMarking::FORCE_MARKING,
i::IncrementalMarking::FORCE_COMPLETION));
}
}
......
......@@ -12574,6 +12574,17 @@ THREADED_TEST(ExternalAllocatedMemory) {
}
TEST(Regress51719) {
i::FLAG_incremental_marking = false;
CcTest::InitializeVM();
const int64_t kTriggerGCSize =
v8::internal::Internals::kExternalAllocationLimit + 1;
v8::Isolate* isolate = CcTest::isolate();
isolate->AdjustAmountOfExternalAllocatedMemory(kTriggerGCSize);
}
// Regression test for issue 54, object templates with internal fields
// but no accessors or interceptors did not get their internal field
// count set on instances.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment