• Eric Holk's avatar
    [wasm] clear and set thread-in-wasm flag on runtime calls · b7e94287
    Eric Holk authored
    This was causing GC stress failures. Garbage collections can happen during
    runtime calls, such was WasmStackGuard. If the collection cleans up Wasm
    objects, then they will have to modify the trap handler data structures, which
    requires taking a lock. This lock can only be taken if the thread-in-wasm flag
    is clear. We were getting crashes because this flag was not clear.
    
    This change fixes the issue by making sure any runtime calls from Wasm clear the
    thread-in-wasm flag and then restore it upon return. In addition, it cleans up
    the code by adding a helper function that generates the code to modify the flag.
    
    BUG= v8:6132
    
    Change-Id: I95d43388dff60ba792c57fe13448a40a02ed4802
    Reviewed-on: https://chromium-review.googlesource.com/458698
    Commit-Queue: Eric Holk <eholk@chromium.org>
    Reviewed-by: 's avatarMircea Trofin <mtrofin@chromium.org>
    Reviewed-by: 's avatarBrad Nelson <bradnelson@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#44165}
    b7e94287
trap-handler.h 2.49 KB