• 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
..
OWNERS Loading commit data...
runtime-array.cc Loading commit data...
runtime-atomics.cc Loading commit data...
runtime-bigint.cc Loading commit data...
runtime-classes.cc Loading commit data...
runtime-collections.cc Loading commit data...
runtime-compiler.cc Loading commit data...
runtime-date.cc Loading commit data...
runtime-debug.cc Loading commit data...
runtime-forin.cc Loading commit data...
runtime-function.cc Loading commit data...
runtime-futex.cc Loading commit data...
runtime-generator.cc Loading commit data...
runtime-internal.cc Loading commit data...
runtime-interpreter.cc Loading commit data...
runtime-intl.cc Loading commit data...
runtime-literals.cc Loading commit data...
runtime-module.cc Loading commit data...
runtime-numbers.cc Loading commit data...
runtime-object.cc Loading commit data...
runtime-operators.cc Loading commit data...
runtime-promise.cc Loading commit data...
runtime-proxy.cc Loading commit data...
runtime-regexp.cc Loading commit data...
runtime-scopes.cc Loading commit data...
runtime-strings.cc Loading commit data...
runtime-symbol.cc Loading commit data...
runtime-test.cc Loading commit data...
runtime-typedarray.cc Loading commit data...
runtime-utils.h Loading commit data...
runtime-wasm.cc Loading commit data...
runtime-weak-refs.cc Loading commit data...
runtime.cc Loading commit data...
runtime.h Loading commit data...