• Benedikt Meurer's avatar
    [async] Introduce dedicated JSAsyncFunctionObject. · a63987a4
    Benedikt Meurer authored
    This JSAsyncFunctionObject represents the implicit generator object
    inside of async functions, and also holds the outer promise for the
    async functions. This in turn allows us to get rid of the .promise
    in the Parser / BytecodeGenerator completely, and will make it
    possible to build zero-cost async stack traces independent of the
    concrete synchronous part of the stack frame (which currently breaks
    in Node.js).
    
    In the bytecode all the async function operations now take this new
    JSAsyncFunctionObject instead of passing both the .generator_object
    and the .promise, which further simplifies and shrinks the bytecode.
    It also reduces the size of async function frames, potentially making
    the suspend/resume cheaper.
    
    This also changes `await` to use intrinsics instead of calling to
    special JSFunctions on the native context, and thus reduces the size of
    the native contexts.
    
    Drive-by-fix: Introduce a dedicated JSCreateAsyncFunctionObject operator
    to TurboFan.
    
    Bug: v8:7253, v8:7522
    Change-Id: I2305302285156aa1f71328ecac70377abdd92c80
    Ref: nodejs/node#11865
    Design-Document: http://bit.ly/v8-zero-cost-async-stack-traces
    Reviewed-on: https://chromium-review.googlesource.com/c/1273049
    Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
    Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
    Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
    Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
    Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#56554}
    a63987a4
js-operator.h 30.3 KB