v8/src/snapshot
Paolo Severini 969cb0c7a5 Reland "V8 x64 backend doesn't emit ABI compliant stack frames"
This is a reland of 3cda21de77

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/+/1534618
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Paolo Severini <paolosev@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#60581}
2019-04-03 02:00:43 +00:00
..
code-serializer.cc [cleanup] #include heap-inl.h less often 2019-02-15 06:22:53 +00:00
code-serializer.h [cctest] Add V8_EXPORT_PRIVATE for cctest (snapshot part) 2019-03-27 12:58:26 +00:00
DEPS
deserializer-allocator.cc [cleanup] Switch DeserializerAllocator to use Heap more directly. 2019-03-01 17:44:21 +00:00
deserializer-allocator.h [cctest] Add V8_EXPORT_PRIVATE for cctest (snapshot part) 2019-03-27 12:58:26 +00:00
deserializer.cc [tracing] Improve tracing signals for compilation/optimization. 2019-03-25 14:49:08 +00:00
deserializer.h [cctest] Add V8_EXPORT_PRIVATE for cctest (snapshot part) 2019-03-27 12:58:26 +00:00
embedded-data.cc Reland "Reland "[builtins] Verify Isolate compatibility with the embedded blob"" 2019-01-31 16:06:28 +00:00
embedded-data.h Reland "Reland "[builtins] Verify Isolate compatibility with the embedded blob"" 2019-01-31 16:06:28 +00:00
embedded-empty.cc Reland "[snapshot] Emit the embedded blob as assembly instead of inline assembly" 2018-11-15 14:53:51 +00:00
embedded-file-writer.cc Reland "V8 x64 backend doesn't emit ABI compliant stack frames" 2019-04-03 02:00:43 +00:00
embedded-file-writer.h Reland "V8 x64 backend doesn't emit ABI compliant stack frames" 2019-04-03 02:00:43 +00:00
mksnapshot.cc Reland "[snapshot] Add support for native counters." 2019-03-28 14:15:22 +00:00
natives-common.cc [js] Remove Experimental Extras JS Natives 2019-01-07 14:43:41 +00:00
natives-external.cc [js] Remove Experimental Extras JS Natives 2019-01-07 14:43:41 +00:00
natives.h [cleanup] Fix kPointerSize usages in the rest of runtime 2019-01-18 13:22:02 +00:00
object-deserializer.cc [cleanup] #include heap-inl.h less often 2019-02-15 06:22:53 +00:00
object-deserializer.h [log] Improve --trace-maps logging 2018-11-27 14:02:25 +00:00
OWNERS [snapshot] Add delphick to OWNERS 2019-02-27 14:26:49 +00:00
partial-deserializer.cc [cleanup] #include heap-inl.h less often 2019-02-15 06:22:53 +00:00
partial-deserializer.h [cctest] Add V8_EXPORT_PRIVATE for cctest (snapshot part) 2019-03-27 12:58:26 +00:00
partial-serializer.cc [serializer] Serialize empty embedder fields by default 2019-03-07 14:20:55 +00:00
partial-serializer.h [cctest] Add V8_EXPORT_PRIVATE for cctest (snapshot part) 2019-03-27 12:58:26 +00:00
read-only-deserializer.cc [heap] Isolate read-only space creation 2019-02-28 16:56:07 +00:00
read-only-deserializer.h [heap] Isolate read-only space creation 2019-02-28 16:56:07 +00:00
read-only-serializer.cc Make Heap::InReadOnlySpace static 2019-03-13 16:55:02 +00:00
read-only-serializer.h [cctest] Add V8_EXPORT_PRIVATE for cctest (snapshot part) 2019-03-27 12:58:26 +00:00
references.h v8: Fix -Wextra-semi warnings, enable warning. 2019-02-13 14:11:28 +00:00
roots-serializer.cc [cleanup] #include heap-inl.h less often 2019-02-15 06:22:53 +00:00
roots-serializer.h [ubsan] Port HeapObject to the new design 2018-12-20 16:43:49 +00:00
serializer-allocator.cc [iwyu] Include heap-inl.h less. 2018-11-26 09:25:05 +00:00
serializer-allocator.h Fix semicolons after DISALLOW_* macros 2018-12-11 17:13:38 +00:00
serializer-common.cc [ubsan] Port Object to the new design 2018-12-26 20:54:07 +00:00
serializer-common.h [snapshot][cleanup] Reassign bytecode values 2019-02-08 18:18:28 +00:00
serializer.cc [ptr-compr][ubsan] Use [Read/Write]UnalignedValue for unaligned fields 2019-03-19 11:34:31 +00:00
serializer.h [snapshot][cleanup] Remove HowToCode flag from bytecodes 2019-02-08 14:40:49 +00:00
snapshot-common.cc [heap] Isolate read-only space creation 2019-02-28 16:56:07 +00:00
snapshot-empty.cc
snapshot-external.cc [base] Introduce MutexGuard as typedef for LockGuard<Mutex> 2018-10-12 15:44:51 +00:00
snapshot-source-sink.cc [snapshot] clear internal fields that are serialized by callback 2018-11-06 11:48:19 +00:00
snapshot-source-sink.h [snapshot][ptr-compr] Stop using UnalignedSlot 2019-02-08 18:24:58 +00:00
snapshot.h [cctest] Add V8_EXPORT_PRIVATE for cctest (snapshot part) 2019-03-27 12:58:26 +00:00
startup-deserializer.cc [heap] Isolate read-only space creation 2019-02-28 16:56:07 +00:00
startup-deserializer.h [heap] Isolate read-only space creation 2019-02-28 16:56:07 +00:00
startup-serializer.cc Make Heap::InReadOnlySpace static 2019-03-13 16:55:02 +00:00
startup-serializer.h [cctest] Add V8_EXPORT_PRIVATE for cctest (snapshot part) 2019-03-27 12:58:26 +00:00