Reland "Generate unwind info on Win/x64 by default"
The original CL title was updated to reflect CL contents. The
--win64-unwinding-info flag still exists but it is set by default.
This is a reland of efd8c2d975
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}
Bug: v8:3598, chromium:958035
Change-Id: Ie53b39f3bb31567797a61e5110685284c266c1f9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1599596
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61368}
This commit is contained in:
parent
dea40e1a24
commit
0b300d4b3d
6
BUILD.gn
6
BUILD.gn
@ -89,7 +89,7 @@ declare_args() {
|
|||||||
v8_enable_embedded_builtins = true
|
v8_enable_embedded_builtins = true
|
||||||
|
|
||||||
# Enable the registration of unwinding info for Windows/x64.
|
# Enable the registration of unwinding info for Windows/x64.
|
||||||
v8_win64_unwinding_info = false
|
v8_win64_unwinding_info = true
|
||||||
|
|
||||||
# Enable code comments for builtins in the snapshot (impacts performance).
|
# Enable code comments for builtins in the snapshot (impacts performance).
|
||||||
v8_enable_snapshot_code_comments = false
|
v8_enable_snapshot_code_comments = false
|
||||||
@ -1183,10 +1183,6 @@ template("run_mksnapshot") {
|
|||||||
|
|
||||||
args += invoker.args
|
args += invoker.args
|
||||||
|
|
||||||
if (v8_win64_unwinding_info) {
|
|
||||||
args += [ "--win64-unwinding-info" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (v8_enable_embedded_builtins) {
|
if (v8_enable_embedded_builtins) {
|
||||||
outputs += [ "$target_gen_dir/embedded${suffix}.S" ]
|
outputs += [ "$target_gen_dir/embedded${suffix}.S" ]
|
||||||
args += [
|
args += [
|
||||||
|
@ -1403,8 +1403,7 @@ DEFINE_STRING(redirect_code_traces_to, nullptr,
|
|||||||
DEFINE_BOOL(print_opt_source, false,
|
DEFINE_BOOL(print_opt_source, false,
|
||||||
"print source code of optimized and inlined functions")
|
"print source code of optimized and inlined functions")
|
||||||
|
|
||||||
DEFINE_BOOL(win64_unwinding_info, false,
|
DEFINE_BOOL(win64_unwinding_info, true, "Enable unwinding info for Windows/x64")
|
||||||
"Enable unwinding info for Windows/x64 (experimental).")
|
|
||||||
|
|
||||||
#ifdef V8_TARGET_ARCH_ARM
|
#ifdef V8_TARGET_ARCH_ARM
|
||||||
// Unsupported on arm. See https://crbug.com/v8/8713.
|
// Unsupported on arm. See https://crbug.com/v8/8713.
|
||||||
|
@ -431,8 +431,8 @@ NativeModule::NativeModule(WasmEngine* engine, const WasmFeatures& enabled,
|
|||||||
// See src/heap/spaces.cc, MemoryAllocator::InitializeCodePageAllocator() and
|
// 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
|
// https://cs.chromium.org/chromium/src/components/crash/content/app/crashpad_win.cc?rcl=fd680447881449fba2edcf0589320e7253719212&l=204
|
||||||
// for details.
|
// for details.
|
||||||
if (win64_unwindinfo::CanRegisterUnwindInfoForNonABICompliantCodeRange() &&
|
if (engine_->code_manager()
|
||||||
FLAG_win64_unwinding_info) {
|
->CanRegisterUnwindInfoForNonABICompliantCodeRange()) {
|
||||||
AllocateForCode(Heap::GetCodeRangeReservedAreaSize());
|
AllocateForCode(Heap::GetCodeRangeReservedAreaSize());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1040,11 +1040,22 @@ WasmCodeManager::WasmCodeManager(WasmMemoryTracker* memory_tracker,
|
|||||||
size_t max_committed)
|
size_t max_committed)
|
||||||
: memory_tracker_(memory_tracker),
|
: memory_tracker_(memory_tracker),
|
||||||
max_committed_code_space_(max_committed),
|
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),
|
total_committed_code_space_(0),
|
||||||
critical_committed_code_space_(max_committed / 2) {
|
critical_committed_code_space_(max_committed / 2) {
|
||||||
DCHECK_LE(max_committed, kMaxWasmCodeMemory);
|
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) {
|
bool WasmCodeManager::Commit(Address start, size_t size) {
|
||||||
// TODO(v8:8462) Remove eager commit once perf supports remapping.
|
// TODO(v8:8462) Remove eager commit once perf supports remapping.
|
||||||
if (FLAG_perf_prof) return true;
|
if (FLAG_perf_prof) return true;
|
||||||
@ -1198,8 +1209,7 @@ std::shared_ptr<NativeModule> WasmCodeManager::NewNativeModule(
|
|||||||
size);
|
size);
|
||||||
|
|
||||||
#if defined(V8_OS_WIN_X64)
|
#if defined(V8_OS_WIN_X64)
|
||||||
if (win64_unwindinfo::CanRegisterUnwindInfoForNonABICompliantCodeRange() &&
|
if (CanRegisterUnwindInfoForNonABICompliantCodeRange()) {
|
||||||
FLAG_win64_unwinding_info) {
|
|
||||||
win64_unwindinfo::RegisterNonABICompliantCodeRange(
|
win64_unwindinfo::RegisterNonABICompliantCodeRange(
|
||||||
reinterpret_cast<void*>(start), size);
|
reinterpret_cast<void*>(start), size);
|
||||||
}
|
}
|
||||||
@ -1386,8 +1396,7 @@ void WasmCodeManager::FreeNativeModule(NativeModule* native_module) {
|
|||||||
code_space.address(), code_space.end(), code_space.size());
|
code_space.address(), code_space.end(), code_space.size());
|
||||||
|
|
||||||
#if defined(V8_OS_WIN_X64)
|
#if defined(V8_OS_WIN_X64)
|
||||||
if (win64_unwindinfo::CanRegisterUnwindInfoForNonABICompliantCodeRange() &&
|
if (CanRegisterUnwindInfoForNonABICompliantCodeRange()) {
|
||||||
FLAG_win64_unwinding_info) {
|
|
||||||
win64_unwindinfo::UnregisterNonABICompliantCodeRange(
|
win64_unwindinfo::UnregisterNonABICompliantCodeRange(
|
||||||
reinterpret_cast<void*>(code_space.address()));
|
reinterpret_cast<void*>(code_space.address()));
|
||||||
}
|
}
|
||||||
|
@ -555,6 +555,10 @@ class V8_EXPORT_PRIVATE WasmCodeManager final {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(V8_OS_WIN_X64)
|
||||||
|
bool CanRegisterUnwindInfoForNonABICompliantCodeRange() const;
|
||||||
|
#endif
|
||||||
|
|
||||||
NativeModule* LookupNativeModule(Address pc) const;
|
NativeModule* LookupNativeModule(Address pc) const;
|
||||||
WasmCode* LookupCode(Address pc) const;
|
WasmCode* LookupCode(Address pc) const;
|
||||||
size_t committed_code_space() const {
|
size_t committed_code_space() const {
|
||||||
@ -563,6 +567,12 @@ class V8_EXPORT_PRIVATE WasmCodeManager final {
|
|||||||
|
|
||||||
void SetMaxCommittedMemoryForTesting(size_t limit);
|
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 EstimateNativeModuleCodeSize(const WasmModule* module);
|
||||||
static size_t EstimateNativeModuleNonCodeSize(const WasmModule* module);
|
static size_t EstimateNativeModuleNonCodeSize(const WasmModule* module);
|
||||||
|
|
||||||
@ -590,6 +600,10 @@ class V8_EXPORT_PRIVATE WasmCodeManager final {
|
|||||||
|
|
||||||
size_t max_committed_code_space_;
|
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_;
|
std::atomic<size_t> total_committed_code_space_;
|
||||||
// If the committed code space exceeds {critical_committed_code_space_}, then
|
// 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
|
// we trigger a GC before creating the next module. This value is set to the
|
||||||
|
@ -193,6 +193,12 @@ class WasmCodeManagerTest : public TestWithContext,
|
|||||||
void SetMaxCommittedMemory(size_t limit) {
|
void SetMaxCommittedMemory(size_t limit) {
|
||||||
manager()->SetMaxCommittedMemoryForTesting(limit);
|
manager()->SetMaxCommittedMemoryForTesting(limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DisableWin64UnwindInfoForTesting() {
|
||||||
|
#if defined(V8_OS_WIN_X64)
|
||||||
|
manager()->DisableWin64UnwindInfoForTesting();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// static
|
// static
|
||||||
@ -212,6 +218,8 @@ TEST_P(WasmCodeManagerTest, EmptyCase) {
|
|||||||
|
|
||||||
TEST_P(WasmCodeManagerTest, AllocateAndGoOverLimit) {
|
TEST_P(WasmCodeManagerTest, AllocateAndGoOverLimit) {
|
||||||
SetMaxCommittedMemory(page_size);
|
SetMaxCommittedMemory(page_size);
|
||||||
|
DisableWin64UnwindInfoForTesting();
|
||||||
|
|
||||||
CHECK_EQ(0, manager()->committed_code_space());
|
CHECK_EQ(0, manager()->committed_code_space());
|
||||||
NativeModulePtr native_module = AllocModule(page_size, GetParam());
|
NativeModulePtr native_module = AllocModule(page_size, GetParam());
|
||||||
CHECK(native_module);
|
CHECK(native_module);
|
||||||
@ -241,6 +249,8 @@ TEST_P(WasmCodeManagerTest, AllocateAndGoOverLimit) {
|
|||||||
|
|
||||||
TEST_P(WasmCodeManagerTest, TotalLimitIrrespectiveOfModuleCount) {
|
TEST_P(WasmCodeManagerTest, TotalLimitIrrespectiveOfModuleCount) {
|
||||||
SetMaxCommittedMemory(3 * page_size);
|
SetMaxCommittedMemory(3 * page_size);
|
||||||
|
DisableWin64UnwindInfoForTesting();
|
||||||
|
|
||||||
NativeModulePtr nm1 = AllocModule(2 * page_size, GetParam());
|
NativeModulePtr nm1 = AllocModule(2 * page_size, GetParam());
|
||||||
NativeModulePtr nm2 = AllocModule(2 * page_size, GetParam());
|
NativeModulePtr nm2 = AllocModule(2 * page_size, GetParam());
|
||||||
CHECK(nm1);
|
CHECK(nm1);
|
||||||
@ -255,6 +265,8 @@ TEST_P(WasmCodeManagerTest, TotalLimitIrrespectiveOfModuleCount) {
|
|||||||
|
|
||||||
TEST_P(WasmCodeManagerTest, GrowingVsFixedModule) {
|
TEST_P(WasmCodeManagerTest, GrowingVsFixedModule) {
|
||||||
SetMaxCommittedMemory(3 * page_size);
|
SetMaxCommittedMemory(3 * page_size);
|
||||||
|
DisableWin64UnwindInfoForTesting();
|
||||||
|
|
||||||
NativeModulePtr nm = AllocModule(page_size, GetParam());
|
NativeModulePtr nm = AllocModule(page_size, GetParam());
|
||||||
size_t module_size = GetParam() == Fixed ? kMaxWasmCodeMemory : page_size;
|
size_t module_size = GetParam() == Fixed ? kMaxWasmCodeMemory : page_size;
|
||||||
size_t remaining_space_in_module = module_size - kJumpTableSize;
|
size_t remaining_space_in_module = module_size - kJumpTableSize;
|
||||||
@ -275,6 +287,8 @@ TEST_P(WasmCodeManagerTest, GrowingVsFixedModule) {
|
|||||||
|
|
||||||
TEST_P(WasmCodeManagerTest, CommitIncrements) {
|
TEST_P(WasmCodeManagerTest, CommitIncrements) {
|
||||||
SetMaxCommittedMemory(10 * page_size);
|
SetMaxCommittedMemory(10 * page_size);
|
||||||
|
DisableWin64UnwindInfoForTesting();
|
||||||
|
|
||||||
NativeModulePtr nm = AllocModule(3 * page_size, GetParam());
|
NativeModulePtr nm = AllocModule(3 * page_size, GetParam());
|
||||||
WasmCodeRefScope code_ref_scope;
|
WasmCodeRefScope code_ref_scope;
|
||||||
WasmCode* code = AddCode(nm.get(), 0, kCodeAlignment);
|
WasmCode* code = AddCode(nm.get(), 0, kCodeAlignment);
|
||||||
@ -290,6 +304,7 @@ TEST_P(WasmCodeManagerTest, CommitIncrements) {
|
|||||||
|
|
||||||
TEST_P(WasmCodeManagerTest, Lookup) {
|
TEST_P(WasmCodeManagerTest, Lookup) {
|
||||||
SetMaxCommittedMemory(2 * page_size);
|
SetMaxCommittedMemory(2 * page_size);
|
||||||
|
DisableWin64UnwindInfoForTesting();
|
||||||
|
|
||||||
NativeModulePtr nm1 = AllocModule(page_size, GetParam());
|
NativeModulePtr nm1 = AllocModule(page_size, GetParam());
|
||||||
NativeModulePtr nm2 = AllocModule(page_size, GetParam());
|
NativeModulePtr nm2 = AllocModule(page_size, GetParam());
|
||||||
@ -335,6 +350,7 @@ TEST_P(WasmCodeManagerTest, Lookup) {
|
|||||||
|
|
||||||
TEST_P(WasmCodeManagerTest, LookupWorksAfterRewrite) {
|
TEST_P(WasmCodeManagerTest, LookupWorksAfterRewrite) {
|
||||||
SetMaxCommittedMemory(2 * page_size);
|
SetMaxCommittedMemory(2 * page_size);
|
||||||
|
DisableWin64UnwindInfoForTesting();
|
||||||
|
|
||||||
NativeModulePtr nm1 = AllocModule(page_size, GetParam());
|
NativeModulePtr nm1 = AllocModule(page_size, GetParam());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user