Skip to content

Commit 1eb7d3c

Browse files
omerktzV8 LUCI CQ
authored andcommitted
[heap] Remove CSS build flag
Where needed, the build flag is replaced by the runtime flag. For using CSS with direct handles, `v8_enable_direct_handle = true` should be added to the GN args. Bug: 41480448 Change-Id: If15cf6030e6e66a8dbfb057c95aa42355b4c95f2 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6448975 Commit-Queue: Michael Lippautz <mlippautz@chromium.org> Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Reviewed-by: Nikolaos Papaspyrou <nikolaos@chromium.org> Auto-Submit: Omer Katz <omerkatz@chromium.org> Cr-Commit-Position: refs/heads/main@{#99783}
1 parent 40c194c commit 1eb7d3c

18 files changed

Lines changed: 33 additions & 91 deletions

BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ load(":bazel/v8-non-pointer-compression.bzl", "v8_binary_non_pointer_compression
4141
# v8_enable_trace_feedback_updates
4242
# v8_enable_atomic_object_field_writes
4343
# v8_enable_concurrent_marking
44-
# v8_enable_conservative_stack_scanning
4544
# v8_enable_direct_handle
4645
# v8_enable_local_off_stack_check
4746
# v8_enable_ignition_dispatch_counting

BUILD.gn

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,6 @@ external_v8_defines = [
985985
"V8_USE_PERFETTO",
986986
"V8_MAP_PACKING",
987987
"V8_IS_TSAN",
988-
"V8_ENABLE_CONSERVATIVE_STACK_SCANNING",
989988
"V8_ENABLE_DIRECT_HANDLE",
990989
"V8_MINORMS_STRING_SHORTCUTTING",
991990
"V8_HAVE_TARGET_OS",
@@ -1040,9 +1039,6 @@ if (v8_enable_map_packing) {
10401039
if (is_tsan) {
10411040
enabled_external_v8_defines += [ "V8_IS_TSAN" ]
10421041
}
1043-
if (v8_enable_conservative_stack_scanning) {
1044-
enabled_external_v8_defines += [ "V8_ENABLE_CONSERVATIVE_STACK_SCANNING" ]
1045-
}
10461042
if (v8_enable_direct_handle) {
10471043
enabled_external_v8_defines += [ "V8_ENABLE_DIRECT_HANDLE" ]
10481044
}
@@ -2792,7 +2788,6 @@ action("v8_dump_build_config") {
27922788
"code_comments=$v8_code_comments",
27932789
"component_build=$is_component_build",
27942790
"concurrent_marking=$v8_enable_concurrent_marking",
2795-
"conservative_stack_scanning=$v8_enable_conservative_stack_scanning",
27962791
"current_cpu=\"$current_cpu\"",
27972792
"dcheck_always_on=$v8_dcheck_always_on",
27982793
"debug_code=$v8_enable_debug_code",
@@ -2858,8 +2853,6 @@ generated_file("v8_generate_features_json") {
28582853
contents = {
28592854
v8_deprecation_warnings = v8_deprecation_warnings
28602855
v8_enable_31bit_smis_on_64bit_arch = v8_enable_31bit_smis_on_64bit_arch
2861-
v8_enable_conservative_stack_scanning =
2862-
v8_enable_conservative_stack_scanning
28632856
v8_enable_direct_handle = v8_enable_direct_handle
28642857
v8_enable_extensible_ro_snapshot = v8_enable_extensible_ro_snapshot
28652858
v8_enable_gdbjit = v8_enable_gdbjit

gni/v8.gni

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,8 @@ declare_args() {
123123
!(defined(build_with_node) && build_with_node) &&
124124
!(is_win && is_component_build) && is_clang
125125

126-
# Scan the call stack conservatively during garbage collection.
127-
v8_enable_conservative_stack_scanning = false
128-
129126
# Use direct pointers in handles (v8::internal::Handle and v8::Local).
130-
v8_enable_direct_handle = ""
127+
v8_enable_direct_handle = false
131128

132129
# Check for off-stack allocated local handles.
133130
v8_enable_local_off_stack_check = false
@@ -254,12 +251,6 @@ if (v8_enable_turbofan == "") {
254251
assert(v8_enable_turbofan || !v8_enable_webassembly,
255252
"Webassembly is not available when Turbofan is disabled.")
256253

257-
# Direct internal handles and direct locals are enabled by default if
258-
# conservative stack scanning is enabled.
259-
if (v8_enable_direct_handle == "") {
260-
v8_enable_direct_handle = v8_enable_conservative_stack_scanning
261-
}
262-
263254
if (v8_target_is_simulator == "") {
264255
# We compare target cpu with v8 target cpu to not affect simulator builds for
265256
# making cross-compile snapshots.

infra/mb/mb_config.pyl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@
853853
},
854854

855855
'conservative_stack_scanning': {
856-
'gn_args': 'v8_enable_conservative_stack_scanning=true',
856+
'gn_args': 'v8_enable_direct_handle=true',
857857
},
858858

859859
'dcheck_always_on': {

src/common/ptr-compr-inl.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -213,26 +213,10 @@ constexpr Tagged_t ExternalCodeCompressionScheme::CompressAny(Address tagged) {
213213
return static_cast<Tagged_t>(tagged);
214214
}
215215

216-
// static
217-
Address ExternalCodeCompressionScheme::DecompressTaggedSigned(
218-
Tagged_t raw_value) {
219-
// For runtime code the upper 32-bits of the Smi value do not matter.
220-
return static_cast<Address>(raw_value);
221-
}
222-
223216
// static
224217
template <typename TOnHeapAddress>
225218
Address ExternalCodeCompressionScheme::DecompressTagged(
226219
TOnHeapAddress on_heap_addr, Tagged_t raw_value) {
227-
#ifdef V8_ENABLE_CONSERVATIVE_STACK_SCANNING
228-
// During conservative stack scanning, if we are trying to decompress a value
229-
// that looks like a SMI (i.e., it's not tagged), we always need to add the
230-
// cage base.
231-
#else
232-
// Avoid complex decompression code for Smis.
233-
if (HAS_SMI_TAG(raw_value)) return DecompressTaggedSigned(raw_value);
234-
#endif
235-
236220
#ifdef V8_COMPRESS_POINTERS
237221
Address cage_base = base();
238222
#ifdef V8_COMPRESS_POINTERS_IN_MULTIPLE_CAGES

src/common/ptr-compr.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,6 @@ class ExternalCodeCompressionScheme {
165165
// object, or a marker bit pattern).
166166
V8_INLINE static constexpr Tagged_t CompressAny(Address tagged);
167167

168-
// Decompresses smi value.
169-
V8_INLINE static Address DecompressTaggedSigned(Tagged_t raw_value);
170-
171168
// Decompresses any tagged value, preserving both weak- and smi- tags.
172169
template <typename TOnHeapAddress>
173170
V8_INLINE static Address DecompressTagged(TOnHeapAddress on_heap_addr,

src/flags/flag-definitions.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -460,14 +460,14 @@ DEFINE_BOOL_READONLY(
460460
single_generation, V8_SINGLE_GENERATION_BOOL,
461461
"allocate all objects from young generation to old generation")
462462

463-
#ifdef V8_ENABLE_CONSERVATIVE_STACK_SCANNING
464-
#define V8_ENABLE_CONSERVATIVE_STACK_SCANNING_BOOL true
465-
#else
466-
#define V8_ENABLE_CONSERVATIVE_STACK_SCANNING_BOOL false
467-
#endif
468-
DEFINE_BOOL_READONLY(conservative_stack_scanning,
469-
V8_ENABLE_CONSERVATIVE_STACK_SCANNING_BOOL,
463+
#ifdef V8_ENABLE_DIRECT_HANDLE
464+
// Direct handles require conservative stack scanning.
465+
DEFINE_BOOL_READONLY(conservative_stack_scanning, true,
470466
"use conservative stack scanning")
467+
#else
468+
DEFINE_EXPERIMENTAL_FEATURE(conservative_stack_scanning,
469+
"use conservative stack scanning")
470+
#endif // V8_ENABLE_DIRECT_HANDLE
471471
DEFINE_IMPLICATION(conservative_stack_scanning,
472472
scavenger_conservative_object_pinning)
473473
DEFINE_NEG_IMPLICATION(conservative_stack_scanning, compact_with_stack)

src/handles/handles.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ static constexpr bool is_direct_handle_v = is_direct_handle<T>::value;
394394

395395
// Direct handles should not be used without conservative stack scanning,
396396
// as this would break the correctness of the GC.
397-
static_assert(V8_ENABLE_CONSERVATIVE_STACK_SCANNING_BOOL);
397+
static_assert(v8_flags.conservative_stack_scanning.value());
398398

399399
// ----------------------------------------------------------------------------
400400
// Base class for DirectHandle instantiations. Don't use directly.

src/heap/heap.cc

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
#include "src/heap/collection-barrier.h"
5050
#include "src/heap/combined-heap.h"
5151
#include "src/heap/concurrent-marking.h"
52+
#include "src/heap/conservative-stack-visitor-inl.h"
5253
#include "src/heap/cppgc-js/cpp-heap.h"
5354
#include "src/heap/ephemeron-remembered-set.h"
5455
#include "src/heap/evacuation-verifier-inl.h"
@@ -128,10 +129,6 @@
128129
#include "src/utils/utils-inl.h"
129130
#include "src/utils/utils.h"
130131

131-
#ifdef V8_ENABLE_CONSERVATIVE_STACK_SCANNING
132-
#include "src/heap/conservative-stack-visitor-inl.h"
133-
#endif // V8_ENABLE_CONSERVATIVE_STACK_SCANNING
134-
135132
#if V8_ENABLE_WEBASSEMBLY
136133
#include "src/wasm/wasm-engine.h"
137134
#endif // V8_ENABLE_WEBASSEMBLY
@@ -4846,8 +4843,7 @@ void Heap::IterateStackRoots(RootVisitor* v) { isolate_->Iterate(v); }
48464843

48474844
void Heap::IterateConservativeStackRoots(RootVisitor* root_visitor,
48484845
IterateRootsMode roots_mode) {
4849-
#ifdef V8_ENABLE_CONSERVATIVE_STACK_SCANNING
4850-
if (!IsGCWithStack()) return;
4846+
if (!v8_flags.conservative_stack_scanning || !IsGCWithStack()) return;
48514847

48524848
// In case of a shared GC, we're interested in the main isolate for CSS.
48534849
Isolate* main_isolate = roots_mode == IterateRootsMode::kClientIsolate
@@ -4856,7 +4852,6 @@ void Heap::IterateConservativeStackRoots(RootVisitor* root_visitor,
48564852

48574853
ConservativeStackVisitor stack_visitor(main_isolate, root_visitor);
48584854
IterateConservativeStackRoots(&stack_visitor);
4859-
#endif // V8_ENABLE_CONSERVATIVE_STACK_SCANNING
48604855
}
48614856

48624857
void Heap::IterateConservativeStackRoots(

src/runtime/runtime-strings.cc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -387,10 +387,6 @@ RUNTIME_FUNCTION(Runtime_StringEqual) {
387387
SaveAndClearThreadInWasmFlag non_wasm_scope(isolate);
388388
HandleScope handle_scope(isolate);
389389
DCHECK_EQ(2, args.length());
390-
#ifdef V8_ENABLE_CONSERVATIVE_STACK_SCANNING
391-
DirectHandle<String> x = args.at<String>(0);
392-
DirectHandle<String> y = args.at<String>(1);
393-
#else
394390
// This function can be called from Wasm: optimized Wasm code calls
395391
// straight to the "StringEqual" builtin, which tail-calls here. So on
396392
// the stack, the CEntryStub's EXIT frame will sit right on top of the
@@ -403,9 +399,11 @@ RUNTIME_FUNCTION(Runtime_StringEqual) {
403399
// In the future, Conservative Stack Scanning will trivially solve the
404400
// problem. In the meantime, we can work around it by explicitly creating
405401
// handles here (rather than treating the on-stack arguments as handles).
402+
//
403+
// TODO(42203211): Don't create new handles here once direct handles and CSS
404+
// are enabled by default.
406405
DirectHandle<String> x(*args.at<String>(0), isolate);
407406
DirectHandle<String> y(*args.at<String>(1), isolate);
408-
#endif // V8_ENABLE_CONSERVATIVE_STACK_SCANNING
409407
return isolate->heap()->ToBoolean(String::Equals(isolate, x, y));
410408
}
411409

0 commit comments

Comments
 (0)