• Sigurd Schneider's avatar
    [testing] Prevent heuristics from triggering optimization in tests · 6d9b7988
    Sigurd Schneider authored
    This CL adds a mechanism that prevents the RuntimeProfiler from
    triggering optimization of a function after
    %PrepareFunctionForOptimization has been called. This is useful to
    prevent flakiness in tests, as sometimes a function that already
    got deoptimized would receive a new code object from a concurrent
    compile that was triggered by a heuristic just in the right moment
    for the assertUnoptimized test to fail. For example, the following
    was happening:
    
    PrepareFunctionForOptimization
    [marking `testAdd` for optimized recompilation, reason: small function]
    [concurrently compiling method `testAdd` using TurboFan]
    [manually marking `testAdd` for non-concurrent optimization]
    [synchonously compiling method `testAdd` using TurboFan]
    [synchonously optimizing `testAdd` produced code object 0xAAAA - took 1.638 ms]
    Runtime_GetOptimizationStatus OPTIMIZED `testAdd` (code object 0xAAAA)
    DeoptimizeFunction `testAdd` with Code Object 0xAAAA
    [concurrently optimizing `testAdd` produced code object 0xBBBB - took 3.377 ms]
    Runtime_GetOptimizationStatus OPTIMIZED `testAdd` (code object 0xBBBB)
    
    Bug: v8:9563
    Change-Id: Ia4c846aba95281589317d43b82383e70fe0a35f5
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1763546Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
    Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
    Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#63343}
    6d9b7988
pending-optimization-table.cc 4.82 KB