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

Unified Diff: test/cctest/heap/test-heap.cc

Issue 1701963003: Filter invalid slots after array trimming. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix compile Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/heap/heap-tester.h ('k') | test/unittests/heap/slot-set-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/heap/test-heap.cc
diff --git a/test/cctest/heap/test-heap.cc b/test/cctest/heap/test-heap.cc
index e6616897d505f471b03b262e28e760fd2a795bcd..691f0b0cd73774bb7dc3ea9a7e1049d290255472 100644
--- a/test/cctest/heap/test-heap.cc
+++ b/test/cctest/heap/test-heap.cc
@@ -6492,6 +6492,43 @@ HEAP_TEST(TestMemoryReducerSampleJsCalls) {
CheckDoubleEquals(2, calls_per_ms);
}
+HEAP_TEST(Regress587004) {
+ FLAG_concurrent_sweeping = false;
+#ifdef VERIFY_HEAP
+ FLAG_verify_heap = false;
+#endif
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+ Heap* heap = CcTest::heap();
+ Isolate* isolate = CcTest::i_isolate();
+ Factory* factory = isolate->factory();
+ const int N = (Page::kMaxRegularHeapObjectSize - FixedArray::kHeaderSize) /
+ kPointerSize;
+ Handle<FixedArray> array = factory->NewFixedArray(N, TENURED);
+ CHECK(heap->old_space()->Contains(*array));
+ Handle<Object> number = factory->NewHeapNumber(1.0);
+ CHECK(heap->InNewSpace(*number));
+ for (int i = 0; i < N; i++) {
+ array->set(i, *number);
+ }
+ heap->CollectGarbage(OLD_SPACE);
+ SimulateFullSpace(heap->old_space());
+ heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(*array, N - 1);
+ heap->mark_compact_collector()->EnsureSweepingCompleted();
+ ByteArray* byte_array;
+ const int M = 256;
+ // Don't allow old space expansion. The test works without this flag too,
+ // but becomes very slow.
+ heap->set_force_oom(true);
+ while (heap->AllocateByteArray(M, TENURED).To(&byte_array)) {
+ for (int j = 0; j < M; j++) {
+ byte_array->set(j, 0x31);
+ }
+ }
+ // Re-enable old space expansion to avoid OOM crash.
+ heap->set_force_oom(false);
+ heap->CollectGarbage(NEW_SPACE);
+}
} // namespace internal
} // namespace v8
« no previous file with comments | « test/cctest/heap/heap-tester.h ('k') | test/unittests/heap/slot-set-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698