Commit 5ef26f3a authored by mlippautz's avatar mlippautz Committed by Commit bot

[heap] Properly reset flags for partially aborted evacuation candidates.

See bug description.

R=hpayer@chromium.org
BUG=chromium:538257
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#31070}
parent ecf23276
...@@ -3783,6 +3783,14 @@ void MarkCompactCollector::EvacuateNewSpaceAndCandidates() { ...@@ -3783,6 +3783,14 @@ void MarkCompactCollector::EvacuateNewSpaceAndCandidates() {
SkipList* list = p->skip_list(); SkipList* list = p->skip_list();
if (list != NULL) list->Clear(); if (list != NULL) list->Clear();
} }
if (p->IsEvacuationCandidate() &&
p->IsFlagSet(Page::RESCAN_ON_EVACUATION)) {
// Case where we've aborted compacting a page. Clear the flag here to
// avoid release the page later on.
p->ClearEvacuationCandidate();
}
if (p->IsFlagSet(Page::RESCAN_ON_EVACUATION)) { if (p->IsFlagSet(Page::RESCAN_ON_EVACUATION)) {
if (FLAG_gc_verbose) { if (FLAG_gc_verbose) {
PrintF("Sweeping 0x%" V8PRIxPTR " during evacuation.\n", PrintF("Sweeping 0x%" V8PRIxPTR " during evacuation.\n",
...@@ -3813,12 +3821,6 @@ void MarkCompactCollector::EvacuateNewSpaceAndCandidates() { ...@@ -3813,12 +3821,6 @@ void MarkCompactCollector::EvacuateNewSpaceAndCandidates() {
break; break;
} }
} }
if (p->IsEvacuationCandidate() &&
p->IsFlagSet(Page::RESCAN_ON_EVACUATION)) {
// Case where we've aborted compacting a page. Clear the flag here to
// avoid release the page later on.
p->ClearEvacuationCandidate();
}
} }
} }
......
...@@ -5479,6 +5479,38 @@ static void RequestInterrupt(const v8::FunctionCallbackInfo<v8::Value>& args) { ...@@ -5479,6 +5479,38 @@ static void RequestInterrupt(const v8::FunctionCallbackInfo<v8::Value>& args) {
} }
UNINITIALIZED_TEST(Regress538257) {
i::FLAG_manual_evacuation_candidates_selection = true;
v8::Isolate::CreateParams create_params;
// Set heap limits.
create_params.constraints.set_max_semi_space_size(1 * Page::kPageSize / MB);
create_params.constraints.set_max_old_space_size(6 * Page::kPageSize / MB);
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
v8::Isolate* isolate = v8::Isolate::New(create_params);
isolate->Enter();
{
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
HandleScope handle_scope(i_isolate);
PagedSpace* old_space = i_isolate->heap()->old_space();
const int kMaxObjects = 10000;
const int kFixedArrayLen = 512;
Handle<FixedArray> objects[kMaxObjects];
for (int i = 0; (i < kMaxObjects) && old_space->CanExpand(Page::kPageSize);
i++) {
objects[i] = i_isolate->factory()->NewFixedArray(kFixedArrayLen, TENURED);
Page::FromAddress(objects[i]->address())
->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING);
}
SimulateFullSpace(old_space);
i_isolate->heap()->CollectGarbage(OLD_SPACE);
// If we get this far, we've successfully aborted compaction. Any further
// allocations might trigger OOM.
}
isolate->Exit();
isolate->Dispose();
}
TEST(Regress357137) { TEST(Regress357137) {
CcTest::InitializeVM(); CcTest::InitializeVM();
v8::Isolate* isolate = CcTest::isolate(); v8::Isolate* isolate = CcTest::isolate();
......
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