Commit 7bc1af3d authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

Revert "Remove --win64-unwinding-info flag and always generate unwind info on Win/x64"

This reverts commit efd8c2d9.

Reason for revert: Performance regressions (chromium:958035)

Original change's description:
> Remove --win64-unwinding-info flag and always generate unwind info on Win/x64
>
> The generation of unwind info to enable stack walking on Windows/x64
> (https://chromium-review.googlesource.com/c/v8/v8/+/1469329) was implemented
> behind a temporary flag, in order to coordinate these changes with the
> corresponding changes in Chromium.
>
> The required changes to Chromium
> (https://chromium-review.googlesource.com/c/chromium/src/+/1474703) have also
> been merged, so we can now remove the flag and enable the generation of stack
> unwinding info by default on Windows/x64.
>
> Bug: v8:3598
> Change-Id: I88814aaeabecc007f5262227aa0681a1d16156d5
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1573138
> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
> Reviewed-by: Jakob Gruber <jgruber@chromium.org>
> Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> Commit-Queue: Paolo Severini <paolosev@microsoft.com>
> Cr-Commit-Position: refs/heads/master@{#61020}

TBR=ulan@chromium.org,mstarzinger@chromium.org,jgruber@chromium.org,paolosev@microsoft.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Tbr: ulan@chromium.org,mstarzinger@chromium.org,paolosev@microsoft.com
Bug: v8:3598, chromium:958035
Change-Id: Ia86a230ee83080ed8ace43e4641c8c1013043df4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1598748
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61259}
parent 5d3e9d58
......@@ -89,7 +89,7 @@ declare_args() {
v8_enable_embedded_builtins = true
# Enable the registration of unwinding info for Windows/x64.
v8_win64_unwinding_info = true
v8_win64_unwinding_info = false
# Enable code comments for builtins in the snapshot (impacts performance).
v8_enable_snapshot_code_comments = false
......@@ -1180,6 +1180,10 @@ template("run_mksnapshot") {
args += invoker.args
if (v8_win64_unwinding_info) {
args += [ "--win64-unwinding-info" ]
}
if (v8_enable_embedded_builtins) {
outputs += [ "$target_gen_dir/embedded${suffix}.S" ]
args += [
......
......@@ -1400,7 +1400,8 @@ DEFINE_STRING(redirect_code_traces_to, nullptr,
DEFINE_BOOL(print_opt_source, false,
"print source code of optimized and inlined functions")
DEFINE_BOOL(win64_unwinding_info, true, "Enable unwinding info for Windows/x64")
DEFINE_BOOL(win64_unwinding_info, false,
"Enable unwinding info for Windows/x64 (experimental).")
#ifdef V8_TARGET_ARCH_ARM
// Unsupported on arm. See https://crbug.com/v8/8713.
......
......@@ -429,8 +429,8 @@ NativeModule::NativeModule(WasmEngine* engine, const WasmFeatures& enabled,
// See src/heap/spaces.cc, MemoryAllocator::InitializeCodePageAllocator() and
// https://cs.chromium.org/chromium/src/components/crash/content/app/crashpad_win.cc?rcl=fd680447881449fba2edcf0589320e7253719212&l=204
// for details.
if (engine_->code_manager()
->CanRegisterUnwindInfoForNonABICompliantCodeRange()) {
if (win64_unwindinfo::CanRegisterUnwindInfoForNonABICompliantCodeRange() &&
FLAG_win64_unwinding_info) {
AllocateForCode(Heap::GetCodeRangeReservedAreaSize());
}
#endif
......@@ -1038,22 +1038,11 @@ WasmCodeManager::WasmCodeManager(WasmMemoryTracker* memory_tracker,
size_t max_committed)
: memory_tracker_(memory_tracker),
max_committed_code_space_(max_committed),
#if defined(V8_OS_WIN_X64)
is_win64_unwind_info_disabled_for_testing_(false),
#endif
total_committed_code_space_(0),
critical_committed_code_space_(max_committed / 2) {
DCHECK_LE(max_committed, kMaxWasmCodeMemory);
}
#if defined(V8_OS_WIN_X64)
bool WasmCodeManager::CanRegisterUnwindInfoForNonABICompliantCodeRange() const {
return win64_unwindinfo::CanRegisterUnwindInfoForNonABICompliantCodeRange() &&
FLAG_win64_unwinding_info &&
!is_win64_unwind_info_disabled_for_testing_;
}
#endif
bool WasmCodeManager::Commit(Address start, size_t size) {
// TODO(v8:8462) Remove eager commit once perf supports remapping.
if (FLAG_perf_prof) return true;
......@@ -1207,7 +1196,8 @@ std::shared_ptr<NativeModule> WasmCodeManager::NewNativeModule(
size);
#if defined(V8_OS_WIN_X64)
if (CanRegisterUnwindInfoForNonABICompliantCodeRange()) {
if (win64_unwindinfo::CanRegisterUnwindInfoForNonABICompliantCodeRange() &&
FLAG_win64_unwinding_info) {
win64_unwindinfo::RegisterNonABICompliantCodeRange(
reinterpret_cast<void*>(start), size);
}
......@@ -1393,7 +1383,8 @@ void WasmCodeManager::FreeNativeModule(NativeModule* native_module) {
code_space.address(), code_space.end(), code_space.size());
#if defined(V8_OS_WIN_X64)
if (CanRegisterUnwindInfoForNonABICompliantCodeRange()) {
if (win64_unwindinfo::CanRegisterUnwindInfoForNonABICompliantCodeRange() &&
FLAG_win64_unwinding_info) {
win64_unwindinfo::UnregisterNonABICompliantCodeRange(
reinterpret_cast<void*>(code_space.address()));
}
......
......@@ -561,10 +561,6 @@ class V8_EXPORT_PRIVATE WasmCodeManager final {
}
#endif
#if defined(V8_OS_WIN_X64)
bool CanRegisterUnwindInfoForNonABICompliantCodeRange() const;
#endif
NativeModule* LookupNativeModule(Address pc) const;
WasmCode* LookupCode(Address pc) const;
size_t committed_code_space() const {
......@@ -573,12 +569,6 @@ class V8_EXPORT_PRIVATE WasmCodeManager final {
void SetMaxCommittedMemoryForTesting(size_t limit);
#if defined(V8_OS_WIN_X64)
void DisableWin64UnwindInfoForTesting() {
is_win64_unwind_info_disabled_for_testing_ = true;
}
#endif
static size_t EstimateNativeModuleCodeSize(const WasmModule* module);
static size_t EstimateNativeModuleNonCodeSize(const WasmModule* module);
......@@ -606,10 +596,6 @@ class V8_EXPORT_PRIVATE WasmCodeManager final {
size_t max_committed_code_space_;
#if defined(V8_OS_WIN_X64)
bool is_win64_unwind_info_disabled_for_testing_;
#endif
std::atomic<size_t> total_committed_code_space_;
// If the committed code space exceeds {critical_committed_code_space_}, then
// we trigger a GC before creating the next module. This value is set to the
......
......@@ -193,12 +193,6 @@ class WasmCodeManagerTest : public TestWithContext,
void SetMaxCommittedMemory(size_t limit) {
manager()->SetMaxCommittedMemoryForTesting(limit);
}
void DisableWin64UnwindInfoForTesting() {
#if defined(V8_OS_WIN_X64)
manager()->DisableWin64UnwindInfoForTesting();
#endif
}
};
// static
......@@ -218,8 +212,6 @@ TEST_P(WasmCodeManagerTest, EmptyCase) {
TEST_P(WasmCodeManagerTest, AllocateAndGoOverLimit) {
SetMaxCommittedMemory(page_size);
DisableWin64UnwindInfoForTesting();
CHECK_EQ(0, manager()->committed_code_space());
NativeModulePtr native_module = AllocModule(page_size, GetParam());
CHECK(native_module);
......@@ -249,8 +241,6 @@ TEST_P(WasmCodeManagerTest, AllocateAndGoOverLimit) {
TEST_P(WasmCodeManagerTest, TotalLimitIrrespectiveOfModuleCount) {
SetMaxCommittedMemory(3 * page_size);
DisableWin64UnwindInfoForTesting();
NativeModulePtr nm1 = AllocModule(2 * page_size, GetParam());
NativeModulePtr nm2 = AllocModule(2 * page_size, GetParam());
CHECK(nm1);
......@@ -265,8 +255,6 @@ TEST_P(WasmCodeManagerTest, TotalLimitIrrespectiveOfModuleCount) {
TEST_P(WasmCodeManagerTest, GrowingVsFixedModule) {
SetMaxCommittedMemory(3 * page_size);
DisableWin64UnwindInfoForTesting();
NativeModulePtr nm = AllocModule(page_size, GetParam());
size_t module_size = GetParam() == Fixed ? kMaxWasmCodeMemory : page_size;
size_t remaining_space_in_module = module_size - kJumpTableSize;
......@@ -287,8 +275,6 @@ TEST_P(WasmCodeManagerTest, GrowingVsFixedModule) {
TEST_P(WasmCodeManagerTest, CommitIncrements) {
SetMaxCommittedMemory(10 * page_size);
DisableWin64UnwindInfoForTesting();
NativeModulePtr nm = AllocModule(3 * page_size, GetParam());
WasmCodeRefScope code_ref_scope;
WasmCode* code = AddCode(nm.get(), 0, kCodeAlignment);
......@@ -304,7 +290,6 @@ TEST_P(WasmCodeManagerTest, CommitIncrements) {
TEST_P(WasmCodeManagerTest, Lookup) {
SetMaxCommittedMemory(2 * page_size);
DisableWin64UnwindInfoForTesting();
NativeModulePtr nm1 = AllocModule(page_size, GetParam());
NativeModulePtr nm2 = AllocModule(page_size, GetParam());
......@@ -350,7 +335,6 @@ TEST_P(WasmCodeManagerTest, Lookup) {
TEST_P(WasmCodeManagerTest, LookupWorksAfterRewrite) {
SetMaxCommittedMemory(2 * page_size);
DisableWin64UnwindInfoForTesting();
NativeModulePtr nm1 = AllocModule(page_size, GetParam());
......
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