• Paolo Severini's avatar
    Reland "V8 x64 backend doesn't emit ABI compliant stack frames" · 969cb0c7
    Paolo Severini authored
    This is a reland of 3cda21de
    
    Original change's description:
    > V8 x64 backend doesn't emit ABI compliant stack frames
    > 
    > On 64 bit Windows, the OS stack walking does not work because the V8 x64
    > backend doesn't emit unwinding info and also because it doesn't emit ABI
    > compliant stack frames. See
    > https://docs.google.com/document/d/1-wf50jFlii0c_Pr52lm2ZU-49m220nhYMrHDi3vXnh0/edit
    > for more details.
    > 
    > This problem can be fixed by observing that V8 frames usually all have the same
    > prolog and epilog:
    > 
    > push rbp,
    > mov rbp, rsp
    > ...
    > pop rbp
    > ret N
    > 
    > and that it is possible to define XDATA (UNWIND_CODEs) that specify how Windows
    > should walk through V8 frames. Furthermore, since V8 Code objects are all
    > allocated in the same code-range for an Isolate, it is possible to register a
    > single PDATA/XDATA entry to cover stack walking for all the code generated
    > inside that code-range.
    > 
    > This PR contains changes required to enable stack walking on Win64:
    > 
    > EmbeddedFileWriter now adds assembler directives to the builtins
    > snapshot source file (embedded.cc) to emit additional entries in the .pdata and
    > in the .xdata section of the V8 executable. This takes care of stack walking
    > for embedded builtins. (The case of non-embedded builtins is not supported).
    > The x64 Assembler has been modified to collect the information required to emit
    > this unwind info for builtins.
    > 
    > Stack walking for jitted code is handled is Isolate.cpp, by registering
    > dynamically PDATA/XDATA for the whole code-range address space every time a new
    > Isolate is initialized, and by unregistering them when the Isolate is
    > destroyed.
    > 
    > Stack walking for WASM jitted code is handled is the same way in
    > wasm::NativeModule (wasm/wasm-code-manager.cpp).
    > 
    > It is important to note that Crashpad and Breakpad are already registering
    > PDATA/XDATA to manage and report unhandled exceptions (but not for embedded
    > builtins). Since it is not possible to register multiple PDATA entries for the
    > same address range, a new function is added to the V8 API:
    > SetUnhandledExceptionCallback() can be used by an embedder to register its own
    > unhandled exception handler for exceptions that arise in v8-generated code.
    > V8 embedders should be modified accordingly (code for this is in a separate PR
    > in the Chromium repository:
    > https://chromium-review.googlesource.com/c/chromium/src/+/1474703).
    > 
    > All these changes are experimental, behind:
    > 
    > the 'v8_win64_unwinding_info' build flag, and
    > the '--win64-unwinding-info' runtime flag.
    > 
    > Bug: v8:3598
    > Change-Id: Iea455ab6d0e2bf1c556aa1cf870841d44ab6e4b1
    > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1469329
    > 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@{#60330}
    
    Bug: v8:3598
    Change-Id: If988baf7d3e4af165b919d6e54c1ad985f8e25e3
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1534618Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
    Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
    Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
    Commit-Queue: Paolo Severini <paolosev@microsoft.com>
    Cr-Commit-Position: refs/heads/master@{#60581}
    969cb0c7
Name
Last commit
Last update
..
arm Loading commit data...
arm64 Loading commit data...
ia32 Loading commit data...
mips Loading commit data...
mips64 Loading commit data...
ppc Loading commit data...
s390 Loading commit data...
x64 Loading commit data...
arguments.tq Loading commit data...
array-copywithin.tq Loading commit data...
array-every.tq Loading commit data...
array-filter.tq Loading commit data...
array-find.tq Loading commit data...
array-findindex.tq Loading commit data...
array-foreach.tq Loading commit data...
array-join.tq Loading commit data...
array-lastindexof.tq Loading commit data...
array-map.tq Loading commit data...
array-of.tq Loading commit data...
array-reduce-right.tq Loading commit data...
array-reduce.tq Loading commit data...
array-reverse.tq Loading commit data...
array-shift.tq Loading commit data...
array-slice.tq Loading commit data...
array-some.tq Loading commit data...
array-splice.tq Loading commit data...
array-unshift.tq Loading commit data...
array.tq Loading commit data...
base.tq Loading commit data...
builtins-api.cc Loading commit data...
builtins-arguments-gen.cc Loading commit data...
builtins-arguments-gen.h Loading commit data...
builtins-array-gen.cc Loading commit data...
builtins-array-gen.h Loading commit data...
builtins-array.cc Loading commit data...
builtins-arraybuffer.cc Loading commit data...
builtins-async-function-gen.cc Loading commit data...
builtins-async-gen.cc Loading commit data...
builtins-async-gen.h Loading commit data...
builtins-async-generator-gen.cc Loading commit data...
builtins-async-iterator-gen.cc Loading commit data...
builtins-bigint-gen.cc Loading commit data...
builtins-bigint.cc Loading commit data...
builtins-boolean-gen.cc Loading commit data...
builtins-boolean.cc Loading commit data...
builtins-call-gen.cc Loading commit data...
builtins-call-gen.h Loading commit data...
builtins-call.cc Loading commit data...
builtins-callsite.cc Loading commit data...
builtins-collections-gen.cc Loading commit data...
builtins-collections-gen.h Loading commit data...
builtins-collections.cc Loading commit data...
builtins-console-gen.cc Loading commit data...
builtins-console.cc Loading commit data...
builtins-constructor-gen.cc Loading commit data...
builtins-constructor-gen.h Loading commit data...
builtins-constructor.h Loading commit data...
builtins-conversion-gen.cc Loading commit data...
builtins-data-view-gen.h Loading commit data...
builtins-dataview.cc Loading commit data...
builtins-date-gen.cc Loading commit data...
builtins-date.cc Loading commit data...
builtins-debug-gen.cc Loading commit data...
builtins-definitions.h Loading commit data...
builtins-descriptors.h Loading commit data...
builtins-error.cc Loading commit data...
builtins-extras-utils.cc Loading commit data...
builtins-function-gen.cc Loading commit data...
builtins-function.cc Loading commit data...
builtins-generator-gen.cc Loading commit data...
builtins-global-gen.cc Loading commit data...
builtins-global.cc Loading commit data...
builtins-handler-gen.cc Loading commit data...
builtins-ic-gen.cc Loading commit data...
builtins-internal-gen.cc Loading commit data...
builtins-internal.cc Loading commit data...
builtins-interpreter-gen.cc Loading commit data...
builtins-intl-gen.cc Loading commit data...
builtins-intl.cc Loading commit data...
builtins-iterator-gen.cc Loading commit data...
builtins-iterator-gen.h Loading commit data...
builtins-json.cc Loading commit data...
builtins-lazy-gen.cc Loading commit data...
builtins-lazy-gen.h Loading commit data...
builtins-math-gen.cc Loading commit data...
builtins-math-gen.h Loading commit data...
builtins-math.cc Loading commit data...
builtins-microtask-queue-gen.cc Loading commit data...
builtins-number-gen.cc Loading commit data...
builtins-number.cc Loading commit data...
builtins-object-gen.cc Loading commit data...
builtins-object-gen.h Loading commit data...
builtins-object.cc Loading commit data...
builtins-promise-gen.cc Loading commit data...
builtins-promise-gen.h Loading commit data...
builtins-promise.cc Loading commit data...
builtins-promise.h Loading commit data...
builtins-proxy-gen.cc Loading commit data...
builtins-proxy-gen.h Loading commit data...
builtins-reflect-gen.cc Loading commit data...
builtins-reflect.cc Loading commit data...
builtins-regexp-gen.cc Loading commit data...
builtins-regexp-gen.h Loading commit data...
builtins-regexp.cc Loading commit data...
builtins-sharedarraybuffer-gen.cc Loading commit data...
builtins-sharedarraybuffer.cc Loading commit data...
builtins-string-gen.cc Loading commit data...
builtins-string-gen.h Loading commit data...
builtins-string.cc Loading commit data...
builtins-symbol-gen.cc Loading commit data...
builtins-symbol.cc Loading commit data...
builtins-trace.cc Loading commit data...
builtins-typed-array-gen.cc Loading commit data...
builtins-typed-array-gen.h Loading commit data...
builtins-typed-array.cc Loading commit data...
builtins-utils-gen.h Loading commit data...
builtins-utils-inl.h Loading commit data...
builtins-utils.h Loading commit data...
builtins-wasm-gen.cc Loading commit data...
builtins-weak-refs.cc Loading commit data...
builtins.cc Loading commit data...
builtins.h Loading commit data...
collections.tq Loading commit data...
constants-table-builder.cc Loading commit data...
constants-table-builder.h Loading commit data...
data-view.tq Loading commit data...
extras-utils.tq Loading commit data...
frames.tq Loading commit data...
generate-bytecodes-builtins-list.cc Loading commit data...
growable-fixed-array-gen.cc Loading commit data...
growable-fixed-array-gen.h Loading commit data...
growable-fixed-array.tq Loading commit data...
iterator.tq Loading commit data...
object-fromentries.tq Loading commit data...
proxy-revoke.tq Loading commit data...
regexp-replace.tq Loading commit data...
regexp.tq Loading commit data...
setup-builtins-internal.cc Loading commit data...
string-endswith.tq Loading commit data...
string-html.tq Loading commit data...
string-repeat.tq Loading commit data...
string-startswith.tq Loading commit data...
typed-array-createtypedarray.tq Loading commit data...
typed-array-every.tq Loading commit data...
typed-array-filter.tq Loading commit data...
typed-array-find.tq Loading commit data...
typed-array-findindex.tq Loading commit data...
typed-array-foreach.tq Loading commit data...
typed-array-reduce.tq Loading commit data...
typed-array-reduceright.tq Loading commit data...
typed-array-slice.tq Loading commit data...
typed-array-some.tq Loading commit data...
typed-array-subarray.tq Loading commit data...
typed-array.tq Loading commit data...