Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(521)

Side by Side Diff: test/cctest/test-heap.cc

Issue 1381633005: [heap] Properly reset flags for partially aborted evacuation candidates. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add test case for symptom Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/mark-compact.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 5461 matching lines...) Expand 10 before | Expand all | Expand 10 after
5472 5472
5473 5473
5474 static void InterruptCallback357137(v8::Isolate* isolate, void* data) { } 5474 static void InterruptCallback357137(v8::Isolate* isolate, void* data) { }
5475 5475
5476 5476
5477 static void RequestInterrupt(const v8::FunctionCallbackInfo<v8::Value>& args) { 5477 static void RequestInterrupt(const v8::FunctionCallbackInfo<v8::Value>& args) {
5478 CcTest::isolate()->RequestInterrupt(&InterruptCallback357137, NULL); 5478 CcTest::isolate()->RequestInterrupt(&InterruptCallback357137, NULL);
5479 } 5479 }
5480 5480
5481 5481
5482 UNINITIALIZED_TEST(Regress538257) {
5483 i::FLAG_manual_evacuation_candidates_selection = true;
5484 v8::Isolate::CreateParams create_params;
5485 // Set heap limits.
5486 create_params.constraints.set_max_semi_space_size(1 * Page::kPageSize / MB);
5487 create_params.constraints.set_max_old_space_size(6 * Page::kPageSize / MB);
5488 create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
5489 v8::Isolate* isolate = v8::Isolate::New(create_params);
5490 isolate->Enter();
5491 {
5492 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
5493 HandleScope handle_scope(i_isolate);
5494 PagedSpace* old_space = i_isolate->heap()->old_space();
5495 const int kMaxObjects = 10000;
5496 const int kFixedArrayLen = 512;
5497 Handle<FixedArray> objects[kMaxObjects];
5498 for (int i = 0; (i < kMaxObjects) && old_space->CanExpand(Page::kPageSize);
5499 i++) {
5500 objects[i] = i_isolate->factory()->NewFixedArray(kFixedArrayLen, TENURED);
5501 Page::FromAddress(objects[i]->address())
5502 ->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING);
5503 }
5504 SimulateFullSpace(old_space);
5505 i_isolate->heap()->CollectGarbage(OLD_SPACE);
5506 // If we get this far, we've successfully aborted compaction. Any further
5507 // allocations might trigger OOM.
5508 }
5509 isolate->Exit();
5510 isolate->Dispose();
5511 }
5512
5513
5482 TEST(Regress357137) { 5514 TEST(Regress357137) {
5483 CcTest::InitializeVM(); 5515 CcTest::InitializeVM();
5484 v8::Isolate* isolate = CcTest::isolate(); 5516 v8::Isolate* isolate = CcTest::isolate();
5485 v8::HandleScope hscope(isolate); 5517 v8::HandleScope hscope(isolate);
5486 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate); 5518 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate);
5487 global->Set(v8::String::NewFromUtf8(isolate, "interrupt"), 5519 global->Set(v8::String::NewFromUtf8(isolate, "interrupt"),
5488 v8::FunctionTemplate::New(isolate, RequestInterrupt)); 5520 v8::FunctionTemplate::New(isolate, RequestInterrupt));
5489 v8::Local<v8::Context> context = v8::Context::New(isolate, NULL, global); 5521 v8::Local<v8::Context> context = v8::Context::New(isolate, NULL, global);
5490 DCHECK(!context.IsEmpty()); 5522 DCHECK(!context.IsEmpty());
5491 v8::Context::Scope cscope(context); 5523 v8::Context::Scope cscope(context);
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after
6416 // The CollectGarbage call above starts sweeper threads. 6448 // The CollectGarbage call above starts sweeper threads.
6417 // The crash will happen if the following two functions 6449 // The crash will happen if the following two functions
6418 // are called before sweeping finishes. 6450 // are called before sweeping finishes.
6419 heap->StartIncrementalMarking(); 6451 heap->StartIncrementalMarking();
6420 heap->FinalizeIncrementalMarkingIfComplete("test"); 6452 heap->FinalizeIncrementalMarkingIfComplete("test");
6421 } 6453 }
6422 6454
6423 6455
6424 } // namespace internal 6456 } // namespace internal
6425 } // namespace v8 6457 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/mark-compact.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698