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

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

Issue 2063013005: Revert of [heap] Add page evacuation mode for new->new (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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 | « test/cctest/cctest.gyp ('k') | test/cctest/heap/test-page-promotion.cc » ('j') | 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 6542 matching lines...) Expand 10 before | Expand all | Expand 10 after
6553 heap::SimulateIncrementalMarking(heap); 6553 heap::SimulateIncrementalMarking(heap);
6554 for (size_t j = 0; j < arrays.size(); j++) { 6554 for (size_t j = 0; j < arrays.size(); j++) {
6555 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(arrays[j], N - 1); 6555 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(arrays[j], N - 1);
6556 } 6556 }
6557 } 6557 }
6558 // Force allocation from the free list. 6558 // Force allocation from the free list.
6559 heap->set_force_oom(true); 6559 heap->set_force_oom(true);
6560 heap->CollectGarbage(OLD_SPACE); 6560 heap->CollectGarbage(OLD_SPACE);
6561 } 6561 }
6562 6562
6563 UNINITIALIZED_TEST(PagePromotion) {
6564 FLAG_page_promotion = true;
6565 FLAG_page_promotion_threshold = 0; // %
6566 i::FLAG_min_semi_space_size = 8 * (Page::kPageSize / MB);
6567 // We cannot optimize for size as we require a new space with more than one
6568 // page.
6569 i::FLAG_optimize_for_size = false;
6570 // Set max_semi_space_size because it could've been initialized by an
6571 // implication of optimize_for_size.
6572 i::FLAG_max_semi_space_size = i::FLAG_min_semi_space_size;
6573 v8::Isolate::CreateParams create_params;
6574 create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
6575 v8::Isolate* isolate = v8::Isolate::New(create_params);
6576 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
6577 {
6578 v8::Isolate::Scope isolate_scope(isolate);
6579 v8::HandleScope handle_scope(isolate);
6580 v8::Context::New(isolate)->Enter();
6581 Heap* heap = i_isolate->heap();
6582
6583 // Clean up any left over objects from cctest initialization.
6584 heap->CollectAllGarbage();
6585 heap->CollectAllGarbage();
6586
6587 std::vector<Handle<FixedArray>> handles;
6588 heap::SimulateFullSpace(heap->new_space(), &handles);
6589 heap->CollectGarbage(NEW_SPACE);
6590 CHECK_GT(handles.size(), 0u);
6591 // First object in handle should be on the first page.
6592 Handle<FixedArray> first_object = handles.front();
6593 Page* first_page = Page::FromAddress(first_object->address());
6594 // The age mark should not be on the first page.
6595 CHECK(!first_page->ContainsLimit(heap->new_space()->age_mark()));
6596 // To perform a sanity check on live bytes we need to mark the heap.
6597 heap::SimulateIncrementalMarking(heap, true);
6598 // Sanity check that the page meets the requirements for promotion.
6599 const int threshold_bytes =
6600 FLAG_page_promotion_threshold * Page::kAllocatableMemory / 100;
6601 CHECK_GE(first_page->LiveBytes(), threshold_bytes);
6602
6603 // Actual checks: The page is in new space first, but is moved to old space
6604 // during a full GC.
6605 CHECK(heap->new_space()->ContainsSlow(first_page->address()));
6606 CHECK(!heap->old_space()->ContainsSlow(first_page->address()));
6607 heap->CollectGarbage(OLD_SPACE);
6608 CHECK(!heap->new_space()->ContainsSlow(first_page->address()));
6609 CHECK(heap->old_space()->ContainsSlow(first_page->address()));
6610 }
6611 }
6612
6563 TEST(Regress598319) { 6613 TEST(Regress598319) {
6564 // This test ensures that no white objects can cross the progress bar of large 6614 // This test ensures that no white objects can cross the progress bar of large
6565 // objects during incremental marking. It checks this by using Shift() during 6615 // objects during incremental marking. It checks this by using Shift() during
6566 // incremental marking. 6616 // incremental marking.
6567 CcTest::InitializeVM(); 6617 CcTest::InitializeVM();
6568 v8::HandleScope scope(CcTest::isolate()); 6618 v8::HandleScope scope(CcTest::isolate());
6569 Heap* heap = CcTest::heap(); 6619 Heap* heap = CcTest::heap();
6570 Isolate* isolate = heap->isolate(); 6620 Isolate* isolate = heap->isolate();
6571 6621
6572 const int kNumberOfObjects = Page::kMaxRegularHeapObjectSize / kPointerSize; 6622 const int kNumberOfObjects = Page::kMaxRegularHeapObjectSize / kPointerSize;
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
6724 int mark_sweeps_performed = mark_sweep_count_after - mark_sweep_count_before; 6774 int mark_sweeps_performed = mark_sweep_count_after - mark_sweep_count_before;
6725 // The memory pressuer handler either performed two GCs or performed one and 6775 // The memory pressuer handler either performed two GCs or performed one and
6726 // started incremental marking. 6776 // started incremental marking.
6727 CHECK(mark_sweeps_performed == 2 || 6777 CHECK(mark_sweeps_performed == 2 ||
6728 (mark_sweeps_performed == 1 && 6778 (mark_sweeps_performed == 1 &&
6729 !heap->incremental_marking()->IsStopped())); 6779 !heap->incremental_marking()->IsStopped()));
6730 } 6780 }
6731 6781
6732 } // namespace internal 6782 } // namespace internal
6733 } // namespace v8 6783 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/cctest.gyp ('k') | test/cctest/heap/test-page-promotion.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698