diff --git a/BUILD.gn b/BUILD.gn index 381dd1e769..4551e1eb9e 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -76,6 +76,9 @@ declare_args() { # Sets -dV8_TRACE_IGNITION. v8_enable_trace_ignition = false + # Sets -dV8_CONCURRENT_MARKING + v8_enable_concurrent_marking = false + # With post mortem support enabled, metadata is embedded into libv8 that # describes various parameters of the VM for use by debuggers. See # tools/gen-postmortem-metadata.py for details. @@ -257,6 +260,9 @@ config("features") { if (v8_use_external_startup_data) { defines += [ "V8_USE_EXTERNAL_STARTUP_DATA" ] } + if (v8_enable_concurrent_marking) { + defines += [ "V8_CONCURRENT_MARKING" ] + } } config("toolchain") { diff --git a/src/flag-definitions.h b/src/flag-definitions.h index 30a294ad12..887b89eab7 100644 --- a/src/flag-definitions.h +++ b/src/flag-definitions.h @@ -668,7 +668,13 @@ DEFINE_BOOL(age_code, true, DEFINE_BOOL(incremental_marking, true, "use incremental marking") DEFINE_BOOL(incremental_marking_wrappers, true, "use incremental marking for marking wrappers") -DEFINE_BOOL(concurrent_marking, V8_CONCURRENT_MARKING, "use concurrent marking") +#ifdef V8_CONCURRENT_MARKING +#define V8_CONCURRENT_MARKING_BOOL true +#else +#define V8_CONCURRENT_MARKING_BOOL false +#endif +DEFINE_BOOL(concurrent_marking, V8_CONCURRENT_MARKING_BOOL, + "use concurrent marking") DEFINE_BOOL(trace_concurrent_marking, false, "trace concurrent marking") DEFINE_BOOL(minor_mc_parallel_marking, true, "use parallel marking for the young generation") diff --git a/src/globals.h b/src/globals.h index 6d34ab9f0a..1194472d29 100644 --- a/src/globals.h +++ b/src/globals.h @@ -118,8 +118,6 @@ namespace internal { #define V8_DOUBLE_FIELDS_UNBOXING 0 #endif -#define V8_CONCURRENT_MARKING 0 - // Some types of tracing require the SFI to store a unique ID. #if defined(V8_TRACE_MAPS) || defined(V8_TRACE_IGNITION) #define V8_SFI_HAS_UNIQUE_ID 1 diff --git a/src/heap/concurrent-marking.cc b/src/heap/concurrent-marking.cc index 32afac63f3..1c1bf1b2df 100644 --- a/src/heap/concurrent-marking.cc +++ b/src/heap/concurrent-marking.cc @@ -236,10 +236,10 @@ ConcurrentMarking::ConcurrentMarking(Heap* heap, ConcurrentMarkingDeque* deque) deque_(deque), visitor_(new ConcurrentMarkingVisitor(deque_)), is_task_pending_(false) { - // Concurrent marking does not work with double unboxing. - STATIC_ASSERT(!(V8_CONCURRENT_MARKING && V8_DOUBLE_FIELDS_UNBOXING)); // The runtime flag should be set only if the compile time flag was set. - CHECK(!FLAG_concurrent_marking || V8_CONCURRENT_MARKING); +#ifndef V8_CONCURRENT_MARKING + CHECK(!FLAG_concurrent_marking); +#endif } ConcurrentMarking::~ConcurrentMarking() { delete visitor_; } diff --git a/src/heap/heap.cc b/src/heap/heap.cc index 209373ac14..df1df79af3 100644 --- a/src/heap/heap.cc +++ b/src/heap/heap.cc @@ -5651,7 +5651,7 @@ bool Heap::SetUp() { mark_compact_collector_ = new MarkCompactCollector(this); incremental_marking_->set_marking_deque( mark_compact_collector_->marking_deque()); -#if V8_CONCURRENT_MARKING +#ifdef V8_CONCURRENT_MARKING concurrent_marking_ = new ConcurrentMarking(this, mark_compact_collector_->marking_deque()); #else diff --git a/src/heap/incremental-marking.cc b/src/heap/incremental-marking.cc index cb9f46782d..eb97176e95 100644 --- a/src/heap/incremental-marking.cc +++ b/src/heap/incremental-marking.cc @@ -141,7 +141,7 @@ void IncrementalMarking::MarkBlackAndPush(HeapObject* obj) { // Color the object black and push it into the bailout deque. ObjectMarking::WhiteToGrey(obj, marking_state(obj)); if (ObjectMarking::GreyToBlack(obj, marking_state(obj))) { -#if V8_CONCURRENT_MARKING +#ifdef V8_CONCURRENT_MARKING marking_deque()->Push(obj, MarkingThread::kMain, TargetDeque::kBailout); #else if (!marking_deque()->Push(obj)) { diff --git a/src/heap/incremental-marking.h b/src/heap/incremental-marking.h index 998d0b279e..4a88ab3fae 100644 --- a/src/heap/incremental-marking.h +++ b/src/heap/incremental-marking.h @@ -182,7 +182,7 @@ class V8_EXPORT_PRIVATE IncrementalMarking { static const intptr_t kActivationThreshold = 0; #endif -#if V8_CONCURRENT_MARKING +#ifdef V8_CONCURRENT_MARKING static const MarkBit::AccessMode kAtomicity = MarkBit::AccessMode::ATOMIC; #else static const MarkBit::AccessMode kAtomicity = MarkBit::AccessMode::NON_ATOMIC; diff --git a/src/heap/mark-compact.h b/src/heap/mark-compact.h index fa57bfb872..29c871d406 100644 --- a/src/heap/mark-compact.h +++ b/src/heap/mark-compact.h @@ -33,7 +33,7 @@ class RecordMigratedSlotVisitor; class ThreadLocalTop; class YoungGenerationMarkingVisitor; -#if V8_CONCURRENT_MARKING +#ifdef V8_CONCURRENT_MARKING using MarkingDeque = ConcurrentMarkingDeque; #else using MarkingDeque = SequentialMarkingDeque; diff --git a/src/objects-inl.h b/src/objects-inl.h index 11162bf7b0..00441babef 100644 --- a/src/objects-inl.h +++ b/src/objects-inl.h @@ -1284,7 +1284,7 @@ bool JSObject::PrototypeHasNoElements(Isolate* isolate, JSObject* object) { reinterpret_cast(base::NoBarrier_Load( \ reinterpret_cast(FIELD_ADDR_CONST(p, offset)))) -#if V8_CONCURRENT_MARKING +#ifdef V8_CONCURRENT_MARKING #define WRITE_FIELD(p, offset, value) \ base::NoBarrier_Store( \ reinterpret_cast(FIELD_ADDR(p, offset)), \