• Yang Guo's avatar
    [compiler] finalize compile jobs asap when compiling on main thread · 0a7e08ef
    Yang Guo authored
    Previously, we finalize all compile jobs at once. This keeps the zone memory
    in every compile job alive until the end. This contributes to a high peak
    memory when many functions are compiled eagerly, for example when producing
    cache data for the ServiceWorker cache.
    
    Memory tracked by the AccountingAllocator in bytes, prior to this change in
    the test case:
    peak memory after init:              8192
    peak memory after lazy compile:     41200
    peak memory after lazy compile:     41200
    peak memory after eager compile:   164256
    
    With this change, if we are compiling on the main thread, we finalize every
    compile job as soon as it is done and dispose the compile job and its zone
    memory.
    
    After this change:
    peak memory after init:              8192
    peak memory after lazy compile:     41200
    peak memory after lazy compile:     41200
    peak memory after eager compile:    41376
    
    R=leszeks@chromium.org, rmcilroy@chromium.org
    
    Bug: chromium:901329
    Change-Id: Iae0c89396c89692c4ecdeec3970d3c62031d2bce
    Reviewed-on: https://chromium-review.googlesource.com/c/1322949
    Commit-Queue: Yang Guo <yangguo@chromium.org>
    Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
    Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#57340}
    0a7e08ef
compiler.cc 81.8 KB