• Pierre Langlois's avatar
    [cctest][heap] Fix remaining memory calculation to simulate full pages. · 243b7f63
    Pierre Langlois authored
    The cctests need to simulate full pages, however the calculation of the
    remainging available space is wrong causing an assertion when we change
    the V8 page size to 512K:
    
        $ cctest test-array-buffer-tracker/ArrayBuffer_PagePromotion
    
        #
        # Fatal error in ../../test/cctest/heap/heap-utils.cc, line 94
        # Check failed: padding_size <= overall_free_memory || overall_free_memory == 0.
    
    The reason is:
    
      - On startup, we register a scavenger observer on the new space. The
        observer is set to trigger when the new space capacity is at 80% by
        default.
    
      - On linux, the initial capacity of the new space is 512K, so the
        scavenger observer will be placed at 80% of 512K, which will either
        be in the second page of the space if the page size is 256K, or in
        the first page if the page size is 512K.
    
      - When placing the observer, if the observer hits the first page, we
        lower the allocation limit (see `ComputeLimit()`). This makes sure
        the observer isn't skipped by allocations inlined in generated code.
    
    However, when we simulate filling the current page, we compute the space
    left in the current page by comparing the top with the `page_high()`
    rather than `limit()`. This was done so the tests would also work when
    inlined allocations are disabled. If we don't look at the `limit()`, we
    don't take the observer into account and fill more space than is
    available, triggering the assertion.
    
    This can also be reproduced by reducing the % at which the scavenger is
    triggered so that it hits the first page instead of the second when the
    page size is 256K, for example passing --scavenge-task-trigger=10.
    
    Bug v8:10808, v8:9906
    
    Change-Id: Iad50bb68995de5ee017dcbe069d1fb229c9f5985
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2372545
    Commit-Queue: Pierre Langlois <pierre.langlois@arm.com>
    Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#69550}
    243b7f63
Name
Last commit
Last update
..
heap-tester.h Loading commit data...
heap-utils.cc Loading commit data...
heap-utils.h Loading commit data...
test-alloc.cc Loading commit data...
test-array-buffer-tracker.cc Loading commit data...
test-compaction.cc Loading commit data...
test-concurrent-allocation.cc Loading commit data...
test-concurrent-marking.cc Loading commit data...
test-embedder-tracing.cc Loading commit data...
test-external-string-tracker.cc Loading commit data...
test-heap.cc Loading commit data...
test-incremental-marking.cc Loading commit data...
test-invalidated-slots.cc Loading commit data...
test-iterators.cc Loading commit data...
test-lab.cc Loading commit data...
test-mark-compact.cc Loading commit data...
test-memory-measurement.cc Loading commit data...
test-page-promotion.cc Loading commit data...
test-spaces.cc Loading commit data...
test-unmapper.cc Loading commit data...
test-weak-references.cc Loading commit data...
test-write-barrier.cc Loading commit data...