• Pierre Langlois's avatar
    [cctest][heap] Do not rely on page limit for full space simulation. · 01dbc9f6
    Pierre Langlois authored
    This reverts https://chromium-review.googlesource.com/c/v8/v8/+/2372545
    in favour of different solution. In order to simulate filling up a page,
    it's not suitable to look at the limit() since there might be observers
    that have lowered it, so the page will not actually be full.
    
    Instead, let's relax the CHECK() in CreatePadding() to not look at the
    limit() but all available space.
    
    For instance, the test-heap/Regress978156 cctest uses FillCurrentPage()
    to fill the current page. However if there's an observer on the current
    page, it will not be filled entirely and the test will fail. This works
    because by default, when the new space is empty, the scavenger observer
    happens to be on the second page of the space. However if one changes
    the V8 page size to 512k, then it fails.
    
    This can be reproduced as such:
    
        # Make sure the scavenge trigger is on the first page.
        ./cctest test-heap/Regress978156  --scavenge-task-trigger=10
    
        # Stress marking adds random observers to trigger incremental
        # marking.
        ./cctest test-heap/Regress978156  --stress-marking=100
    
    This issue also causes crashes when using the %SimulateNewspaceFull()
    runtime test function, as found by fuzzing and you can find more details
    in the bug.
    
    Bug: v8:10808, v8:9906, chromium:1122848
    Change-Id: Ie043ae0a1d3754d2423cb5d97f2b3e1ee860e5c8
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2401427Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
    Commit-Queue: Pierre Langlois <pierre.langlois@arm.com>
    Cr-Commit-Position: refs/heads/master@{#69805}
    01dbc9f6
runtime-test.cc 56 KB