Commit 75e67911 authored by ulan's avatar ulan Committed by Commit bot

[heap] Add --stress-incremental-marking flag.

BUG=

Review-Url: https://codereview.chromium.org/2900603004
Cr-Commit-Position: refs/heads/master@{#45553}
parent 0a1cad37
...@@ -739,6 +739,8 @@ DEFINE_BOOL(force_marking_deque_overflows, false, ...@@ -739,6 +739,8 @@ DEFINE_BOOL(force_marking_deque_overflows, false,
DEFINE_BOOL(stress_compaction, false, DEFINE_BOOL(stress_compaction, false,
"stress the GC compactor to flush out bugs (implies " "stress the GC compactor to flush out bugs (implies "
"--force_marking_deque_overflows)") "--force_marking_deque_overflows)")
DEFINE_BOOL(stress_incremental_marking, V8_CONCURRENT_MARKING_BOOL,
"force incremental marking for small heaps and run it more often")
DEFINE_BOOL(manual_evacuation_candidates_selection, false, DEFINE_BOOL(manual_evacuation_candidates_selection, false,
"Test mode only flag. It allows an unit test to select evacuation " "Test mode only flag. It allows an unit test to select evacuation "
"candidates pages (requires --stress_compaction).") "candidates pages (requires --stress_compaction).")
......
...@@ -5564,8 +5564,14 @@ bool Heap::ShouldExpandOldGenerationOnSlowAllocation() { ...@@ -5564,8 +5564,14 @@ bool Heap::ShouldExpandOldGenerationOnSlowAllocation() {
Heap::IncrementalMarkingLimit Heap::IncrementalMarkingLimitReached() { Heap::IncrementalMarkingLimit Heap::IncrementalMarkingLimitReached() {
// Code using an AlwaysAllocateScope assumes that the GC state does not // Code using an AlwaysAllocateScope assumes that the GC state does not
// change; that implies that no marking steps must be performed. // change; that implies that no marking steps must be performed.
if (!incremental_marking()->CanBeActivated() || always_allocate() || if (!incremental_marking()->CanBeActivated() || always_allocate()) {
PromotedSpaceSizeOfObjects() <= // Incremental marking is disabled or it is too early to start.
return IncrementalMarkingLimit::kNoLimit;
}
if (FLAG_stress_incremental_marking) {
return IncrementalMarkingLimit::kHardLimit;
}
if (PromotedSpaceSizeOfObjects() <=
IncrementalMarking::kActivationThreshold) { IncrementalMarking::kActivationThreshold) {
// Incremental marking is disabled or it is too early to start. // Incremental marking is disabled or it is too early to start.
return IncrementalMarkingLimit::kNoLimit; return IncrementalMarkingLimit::kNoLimit;
......
...@@ -114,6 +114,7 @@ TEST(ArrayBuffer_ScavengeAndMC) { ...@@ -114,6 +114,7 @@ TEST(ArrayBuffer_ScavengeAndMC) {
} }
TEST(ArrayBuffer_Compaction) { TEST(ArrayBuffer_Compaction) {
FLAG_stress_incremental_marking = false;
FLAG_manual_evacuation_candidates_selection = true; FLAG_manual_evacuation_candidates_selection = true;
CcTest::InitializeVM(); CcTest::InitializeVM();
LocalContext env; LocalContext env;
......
...@@ -47,6 +47,7 @@ HEAP_TEST(CompactionFullAbortedPage) { ...@@ -47,6 +47,7 @@ HEAP_TEST(CompactionFullAbortedPage) {
// Disable concurrent sweeping to ensure memory is in an expected state, i.e., // Disable concurrent sweeping to ensure memory is in an expected state, i.e.,
// we can reach the state of a half aborted page. // we can reach the state of a half aborted page.
FLAG_concurrent_sweeping = false; FLAG_concurrent_sweeping = false;
FLAG_stress_incremental_marking = false;
FLAG_manual_evacuation_candidates_selection = true; FLAG_manual_evacuation_candidates_selection = true;
CcTest::InitializeVM(); CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
...@@ -89,6 +90,7 @@ HEAP_TEST(CompactionPartiallyAbortedPage) { ...@@ -89,6 +90,7 @@ HEAP_TEST(CompactionPartiallyAbortedPage) {
// Disable concurrent sweeping to ensure memory is in an expected state, i.e., // Disable concurrent sweeping to ensure memory is in an expected state, i.e.,
// we can reach the state of a half aborted page. // we can reach the state of a half aborted page.
FLAG_concurrent_sweeping = false; FLAG_concurrent_sweeping = false;
FLAG_stress_incremental_marking = false;
FLAG_manual_evacuation_candidates_selection = true; FLAG_manual_evacuation_candidates_selection = true;
const int objects_per_page = 10; const int objects_per_page = 10;
...@@ -163,6 +165,7 @@ HEAP_TEST(CompactionPartiallyAbortedPageIntraAbortedPointers) { ...@@ -163,6 +165,7 @@ HEAP_TEST(CompactionPartiallyAbortedPageIntraAbortedPointers) {
// Disable concurrent sweeping to ensure memory is in an expected state, i.e., // Disable concurrent sweeping to ensure memory is in an expected state, i.e.,
// we can reach the state of a half aborted page. // we can reach the state of a half aborted page.
FLAG_concurrent_sweeping = false; FLAG_concurrent_sweeping = false;
FLAG_stress_incremental_marking = false;
FLAG_manual_evacuation_candidates_selection = true; FLAG_manual_evacuation_candidates_selection = true;
const int objects_per_page = 10; const int objects_per_page = 10;
...@@ -250,6 +253,7 @@ HEAP_TEST(CompactionPartiallyAbortedPageWithStoreBufferEntries) { ...@@ -250,6 +253,7 @@ HEAP_TEST(CompactionPartiallyAbortedPageWithStoreBufferEntries) {
// Disable concurrent sweeping to ensure memory is in an expected state, i.e., // Disable concurrent sweeping to ensure memory is in an expected state, i.e.,
// we can reach the state of a half aborted page. // we can reach the state of a half aborted page.
FLAG_concurrent_sweeping = false; FLAG_concurrent_sweeping = false;
FLAG_stress_incremental_marking = false;
FLAG_manual_evacuation_candidates_selection = true; FLAG_manual_evacuation_candidates_selection = true;
const int objects_per_page = 10; const int objects_per_page = 10;
......
This diff is collapsed.
...@@ -101,6 +101,7 @@ class MockPlatform : public v8::Platform { ...@@ -101,6 +101,7 @@ class MockPlatform : public v8::Platform {
TEST(IncrementalMarkingUsingTasks) { TEST(IncrementalMarkingUsingTasks) {
if (!i::FLAG_incremental_marking) return; if (!i::FLAG_incremental_marking) return;
FLAG_stress_incremental_marking = false;
CcTest::InitializeVM(); CcTest::InitializeVM();
v8::Platform* old_platform = i::V8::GetCurrentPlatform(); v8::Platform* old_platform = i::V8::GetCurrentPlatform();
MockPlatform platform(old_platform); MockPlatform platform(old_platform);
......
...@@ -659,6 +659,7 @@ UNINITIALIZED_TEST(InlineAllocationObserverCadence) { ...@@ -659,6 +659,7 @@ UNINITIALIZED_TEST(InlineAllocationObserverCadence) {
} }
TEST(ShrinkPageToHighWaterMarkFreeSpaceEnd) { TEST(ShrinkPageToHighWaterMarkFreeSpaceEnd) {
FLAG_stress_incremental_marking = false;
CcTest::InitializeVM(); CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
......
...@@ -7533,6 +7533,7 @@ static void SetFlag(const v8::WeakCallbackInfo<FlagAndPersistent>& data) { ...@@ -7533,6 +7533,7 @@ static void SetFlag(const v8::WeakCallbackInfo<FlagAndPersistent>& data) {
static void IndependentWeakHandle(bool global_gc, bool interlinked) { static void IndependentWeakHandle(bool global_gc, bool interlinked) {
i::FLAG_stress_incremental_marking = false;
v8::Isolate* iso = CcTest::isolate(); v8::Isolate* iso = CcTest::isolate();
v8::HandleScope scope(iso); v8::HandleScope scope(iso);
v8::Local<Context> context = Context::New(iso); v8::Local<Context> context = Context::New(iso);
...@@ -14558,6 +14559,7 @@ static void event_handler(const v8::JitCodeEvent* event) { ...@@ -14558,6 +14559,7 @@ static void event_handler(const v8::JitCodeEvent* event) {
UNINITIALIZED_TEST(SetJitCodeEventHandler) { UNINITIALIZED_TEST(SetJitCodeEventHandler) {
i::FLAG_stress_compaction = true; i::FLAG_stress_compaction = true;
// FLAG_stress_incremental_marking = false;
i::FLAG_incremental_marking = false; i::FLAG_incremental_marking = false;
if (i::FLAG_never_compact) return; if (i::FLAG_never_compact) return;
const char* script = const char* script =
......
...@@ -2030,12 +2030,15 @@ TEST(WeakGlobalHandle) { ...@@ -2030,12 +2030,15 @@ TEST(WeakGlobalHandle) {
CHECK(!HasWeakGlobalHandle()); CHECK(!HasWeakGlobalHandle());
v8::Persistent<v8::Object> handle(env->GetIsolate(), v8::Persistent<v8::Object> handle;
v8::Object::New(env->GetIsolate()));
handle.Reset(env->GetIsolate(), v8::Object::New(env->GetIsolate()));
handle.SetWeak(&handle, PersistentHandleCallback, handle.SetWeak(&handle, PersistentHandleCallback,
v8::WeakCallbackType::kParameter); v8::WeakCallbackType::kParameter);
CHECK(HasWeakGlobalHandle()); CHECK(HasWeakGlobalHandle());
CcTest::CollectAllGarbage();
EmptyMessageQueues(env->GetIsolate());
} }
......
...@@ -1127,6 +1127,7 @@ TEST(CodeSerializerLargeCodeObject) { ...@@ -1127,6 +1127,7 @@ TEST(CodeSerializerLargeCodeObject) {
} }
TEST(CodeSerializerLargeCodeObjectWithIncrementalMarking) { TEST(CodeSerializerLargeCodeObjectWithIncrementalMarking) {
FLAG_stress_incremental_marking = false;
FLAG_serialize_toplevel = true; FLAG_serialize_toplevel = true;
FLAG_always_opt = false; FLAG_always_opt = false;
// This test relies on (full-codegen) code objects going to large object // This test relies on (full-codegen) code objects going to large object
......
...@@ -1192,6 +1192,7 @@ TEST(InternalizeExternal) { ...@@ -1192,6 +1192,7 @@ TEST(InternalizeExternal) {
// TODO(mlippautz): Remove once we add support for forwarding ThinStrings in // TODO(mlippautz): Remove once we add support for forwarding ThinStrings in
// minor MC. // minor MC.
if (FLAG_minor_mc) return; if (FLAG_minor_mc) return;
FLAG_stress_incremental_marking = false;
FLAG_thin_strings = true; FLAG_thin_strings = true;
CcTest::InitializeVM(); CcTest::InitializeVM();
i::Isolate* isolate = CcTest::i_isolate(); i::Isolate* isolate = CcTest::i_isolate();
......
...@@ -1109,6 +1109,7 @@ TEST(DoScavenge) { ...@@ -1109,6 +1109,7 @@ TEST(DoScavenge) {
TEST(DoScavengeWithIncrementalWriteBarrier) { TEST(DoScavengeWithIncrementalWriteBarrier) {
if (FLAG_never_compact || !FLAG_incremental_marking) return; if (FLAG_never_compact || !FLAG_incremental_marking) return;
FLAG_stress_incremental_marking = false;
CcTest::InitializeVM(); CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate()); v8::HandleScope scope(CcTest::isolate());
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
...@@ -1457,6 +1458,7 @@ static void TestIncrementalWriteBarrier(Handle<Map> map, Handle<Map> new_map, ...@@ -1457,6 +1458,7 @@ static void TestIncrementalWriteBarrier(Handle<Map> map, Handle<Map> new_map,
int double_descriptor, int double_descriptor,
bool check_tagged_value = true) { bool check_tagged_value = true) {
if (FLAG_never_compact || !FLAG_incremental_marking) return; if (FLAG_never_compact || !FLAG_incremental_marking) return;
FLAG_stress_incremental_marking = false;
FLAG_manual_evacuation_candidates_selection = true; FLAG_manual_evacuation_candidates_selection = true;
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory(); Factory* factory = isolate->factory();
...@@ -1539,6 +1541,7 @@ enum OldToWriteBarrierKind { ...@@ -1539,6 +1541,7 @@ enum OldToWriteBarrierKind {
}; };
static void TestWriteBarrierObjectShiftFieldsRight( static void TestWriteBarrierObjectShiftFieldsRight(
OldToWriteBarrierKind write_barrier_kind) { OldToWriteBarrierKind write_barrier_kind) {
FLAG_stress_incremental_marking = false;
CcTest::InitializeVM(); CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
v8::HandleScope scope(CcTest::isolate()); v8::HandleScope scope(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