Commit 3b7bc9f0 authored by mlippautz's avatar mlippautz Committed by Commit bot

[heap] Test fixes

Various test fixes for issues that get flushed out with smaller pages.

BUG=chromium:636331
R=ulan@chromium.org

Review-Url: https://codereview.chromium.org/2313273002
Cr-Commit-Position: refs/heads/master@{#39235}
parent 119f3112
......@@ -696,7 +696,8 @@ class MemoryChunk {
DEFINE_OPERATORS_FOR_FLAGS(MemoryChunk::Flags)
STATIC_ASSERT(kMaxRegularHeapObjectSize < MemoryChunk::kAllocatableMemory);
static_assert(kMaxRegularHeapObjectSize <= MemoryChunk::kAllocatableMemory,
"kMaxRegularHeapObjectSize <= MemoryChunk::kAllocatableMemory");
// -----------------------------------------------------------------------------
// A page is a memory chunk of a size 1MB. Large object pages may be larger.
......
......@@ -2369,6 +2369,10 @@ static void FillUpNewSpace(NewSpace* new_space) {
TEST(GrowAndShrinkNewSpace) {
// Avoid shrinking new space in GC epilogue. This can happen if allocation
// throughput samples have been taken while executing the benchmark.
FLAG_predictable = true;
CcTest::InitializeVM();
Heap* heap = CcTest::heap();
NewSpace* new_space = heap->new_space();
......@@ -3614,6 +3618,9 @@ TEST(ReleaseOverReservedPages) {
i::FLAG_page_promotion = false;
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
// If there's snapshot available, we don't know whether 20 small arrays will
// fit on the initial pages.
if (!isolate->snapshot_available()) return;
Factory* factory = isolate->factory();
Heap* heap = isolate->heap();
v8::HandleScope scope(CcTest::isolate());
......
......@@ -140,18 +140,25 @@ TEST(IncrementalMarkingUsingIdleTasks) {
TEST(IncrementalMarkingUsingIdleTasksAfterGC) {
if (!i::FLAG_incremental_marking) return;
const double kLongIdleTimeInSeconds = 1;
const double kShortIdleTimeInSeconds = 0.010;
CcTest::InitializeVM();
v8::Platform* old_platform = i::V8::GetCurrentPlatform();
MockPlatform platform(old_platform);
i::V8::SetPlatformForTesting(&platform);
i::heap::SimulateFullSpace(CcTest::heap()->old_space());
CcTest::heap()->CollectAllGarbage();
// Perform any pending idle tasks.
while (platform.PendingIdleTask()) {
platform.PerformIdleTask(kLongIdleTimeInSeconds);
}
CHECK(!platform.PendingIdleTask());
i::IncrementalMarking* marking = CcTest::heap()->incremental_marking();
marking->Stop();
marking->Start();
CHECK(platform.PendingIdleTask());
const double kLongIdleTimeInSeconds = 1;
const double kShortIdleTimeInSeconds = 0.010;
const int kShortStepCount = 10;
for (int i = 0; i < kShortStepCount && platform.PendingIdleTask(); i++) {
platform.PerformIdleTask(kShortIdleTimeInSeconds);
......
......@@ -96,6 +96,10 @@ TEST(Promotion) {
}
HEAP_TEST(NoPromotion) {
// Page promotion allows pages to be moved to old space even in the case of
// OOM scenarios.
FLAG_page_promotion = false;
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_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