• Tom Tan's avatar
    Unwind V8 frames correctly on Windows ARM64 · 3f1f001a
    Tom Tan authored
    On Windows ARM64, OS stack walking does not work because the V8 ARM64 backend
    doesn't emit unwinding info and also because it doesn't emit ABI compliant
    stack frames. This was fixed for Windows X64 (https://crrev.com/c/1469329) and
    documented below:
    
    https://docs.google.com/document/d/1-wf50jFlii0c_Pr52lm2ZU-49m220nhYMrHDi3vXnh0
    
    This problem can be fixed similarly for Windows ARM64 by observing that V8
    frames usually all have the same prolog which maintains a chain via frame
    pointer (fp or x29 register).
    
    stp fp, lr, [sp, ...]
    
    One exception is JSEntry which stops fp pointer chain and needs to be handled
    specially.
    
    So it is possible to define XDATA with UNWIND_CODE which specify how Windows
    should walk through V8 dynamic frames. The same as X64, since V8 Code objects
    are all allocated in the same code-range for an Isolate, it is possible to
    register at most 2 XDATA and a group of PDATA entries to cover stack walking
    for all the code generated inside that code-range. This is more than 1
    PDATA/XDATA because according to the Windows ARM64 exeption handling document,
    1 PDATA can cover less than 1MB code range (see below doc).
    
    https://docs.microsoft.com/en-us/cpp/build/arm64-exception-handling
    
    This PR implements stackwalk for Windows ARM64 to be on par with X64, including
    embedded builtins, jitted code and wasm jitted code, but not including register
    handler for handling exception only, because there is no backward compatibility
    to maintain for Windows ARM64 which was released since 1709 windows build.
    
    Bug: chromium:893460
    Change-Id: Ic74cbdad8af5cf342185030a4c53796f12ea5429
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1701133Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
    Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
    Commit-Queue: Jakob Gruber <jgruber@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#63002}
    3f1f001a
code-generator.cc 48.3 KB