Commit b2140c59 authored by Rong Wang's avatar Rong Wang Committed by Commit Bot

Add a flag for enabling the single generation mode in V8

This flag ensures that all allocations are performed in the old generation. This only works when inline allocation and allocation folding are both disabled.

Bug: v8:9533

Change-Id: I9ad5e8bf492c43603ab2a4a1292198e1b9882dfe
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1710335Reviewed-by: 's avatarHannes Payer <hpayer@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62893}
parent e8571c6a
......@@ -163,6 +163,7 @@ Rob Wu <rob@robwu.nl>
Robert Meijer <robert.s.meijer@gmail.com>
Robert Mustacchi <rm@fingolfin.org>
Robert Nagy <robert.nagy@gmail.com>
Rong Wang <wangrong089@gmail.com>
Ross Kirsling <rkirsling@gmail.com>
Ruben Bridgewater <ruben@bridgewater.de>
Ryan Dahl <ry@tinyclouds.org>
......
......@@ -187,6 +187,9 @@ declare_args() {
# Enable sharing read-only space across isolates.
# Sets -DV8_SHARED_RO_HEAP.
v8_enable_shared_ro_heap = ""
# Redirect allocation in young generation so that there will be only one single generation.
v8_enable_single_generation = false
}
# Derived defaults.
......@@ -415,6 +418,9 @@ config("features") {
defines += [ "V8_SNAPSHOT_NATIVE_CODE_COUNTERS" ]
}
}
if (v8_enable_single_generation) {
defines += [ "V8_ENABLE_SINGLE_GENERATION" ]
}
if (v8_use_external_startup_data) {
defines += [ "V8_USE_EXTERNAL_STARTUP_DATA" ]
}
......
......@@ -4341,6 +4341,7 @@ TNode<FixedArray> CodeStubAssembler::ExtractToFixedArray(
var_target_map.value());
var_result.Bind(to_elements);
#ifndef V8_ENABLE_SINGLE_GENERATION
#ifdef DEBUG
TNode<IntPtrT> object_word = BitcastTaggedToWord(to_elements);
TNode<IntPtrT> object_page = PageFromAddress(object_word);
......@@ -4353,6 +4354,7 @@ TNode<FixedArray> CodeStubAssembler::ExtractToFixedArray(
WordAnd(page_flags,
IntPtrConstant(MemoryChunk::kIsInYoungGenerationMask)),
IntPtrConstant(0)));
#endif
#endif
if (convert_holes == HoleConversionMode::kDontConvert &&
......
......@@ -307,6 +307,20 @@ DEFINE_IMPLICATION(lite_mode, lazy_feedback_allocation)
DEFINE_IMPLICATION(lite_mode, enable_lazy_source_positions)
DEFINE_IMPLICATION(lite_mode, optimize_for_size)
#ifdef V8_ENABLE_SINGLE_GENERATION
#define V8_GENERATION_BOOL true
#else
#define V8_GENERATION_BOOL false
#endif
DEFINE_BOOL_READONLY(
single_generation, V8_GENERATION_BOOL,
"allocate all objects from young generation to old generation")
// Prevent inline allocation into new space
DEFINE_NEG_IMPLICATION(single_generation, inline_new)
DEFINE_NEG_IMPLICATION(single_generation, turbo_allocation_folding)
#ifdef V8_ENABLE_FUTURE
#define FUTURE_BOOL true
#else
......
......@@ -2010,7 +2010,8 @@ Handle<JSObject> Factory::CopyJSObjectWithAllocationSite(
HeapObject raw_clone = isolate()->heap()->AllocateRawWithRetryOrFail(
adjusted_object_size, AllocationType::kYoung);
DCHECK(Heap::InYoungGeneration(raw_clone));
DCHECK(Heap::InYoungGeneration(raw_clone) || FLAG_single_generation);
// Since we know the clone is allocated in new space, we can copy
// the contents without worrying about updating the write barrier.
Heap::CopyBlock(raw_clone.address(), source->address(), object_size);
......
......@@ -179,6 +179,9 @@ AllocationResult Heap::AllocateRaw(int size_in_bytes, AllocationType type,
HeapObject object;
AllocationResult allocation;
if (FLAG_single_generation && type == AllocationType::kYoung)
type = AllocationType::kOld;
if (AllocationType::kYoung == type) {
if (large_object) {
if (FLAG_young_generation_large_objects) {
......
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