1. 31 Jul, 2020 1 commit
    • Dan Elphick's avatar
      [heap] Share RO_SPACE pages with pointer compression · c7d22c49
      Dan Elphick authored
      This allows the configuration v8_enable_shared_ro_heap and
      v8_enable_pointer_compression on Linux and Android, although it still
      defaults to off.
      
      When pointer compression and read-only heap sharing are enabled, sharing
      is achieved by allocating ReadOnlyPages in shared memory that are
      retained in the shared ReadOnlyArtifacts object. These ReadOnlyPages are
      then remapped into the address space of the Isolate ultimately using
      mremap.
      
      To simplify the creation process the ReadOnlySpace memory for the first
      Isolate is created as before without any sharing. It is only when the
      ReadOnlySpace memory has been finalized that the shared memory is
      allocated and has its contents copied into it. The original memory is
      then released (with PC this means it's just released back to the
      BoundedPageAllocator) and immediately re-allocated as a shared mapping.
      
      Because we would like to make v8_enable_shared_ro_heap default to true
      at some point but can't make this conditional on the value returned by
      a method in the code we are yet to compile, the code required for
      sharing has been mostly changed to use ifs with
      ReadOnlyHeap::IsReadOnlySpaceShared() instead of #ifdefs except where
      a compile error would result due to the absence of a class members
      without sharing. IsReadOnlySpaceShared() will evaluate
      CanAllocateSharedPages in the platform PageAllocator (with pointer
      compression and sharing enabled) once and cache that value so sharing
      cannot be toggled during the lifetime of the process.
      
      Bug: v8:10454
      Change-Id: I0236d752047ecce71bd64c159430517a712bc1e2
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2267300
      Commit-Queue: Dan Elphick <delphick@chromium.org>
      Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
      Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#69174}
      c7d22c49
  2. 10 Jul, 2020 1 commit
  3. 22 Jun, 2020 1 commit
  4. 18 Jun, 2020 1 commit
    • Dan Elphick's avatar
      Reland "[heap] Make ReadOnlySpace use bump pointer allocation" · 32b911f9
      Dan Elphick authored
      This reverts commit f78d69fa.
      
      With https://chromium-review.googlesource.com/c/v8/v8/+/2243216,
      incorrect MemoryChunk::FromHeapObject uses are now fixed.
      
      Original change's description:
      > Revert "[heap] Make ReadOnlySpace use bump pointer allocation"
      > 
      > This reverts commit 81c34968 and also
      > 490f3580 which depends on the former.
      > 
      > Reason for revert: Break CFI tests in chromium https://ci.chromium.org/p/chromium/builders/ci/Linux%20CFI/17438
      > Original change's description:
      > > [heap] Make ReadOnlySpace use bump pointer allocation
      > >
      > > This changes ReadOnlySpace to no longer be a PagedSpace but instead it
      > > is now a BaseSpace. BasicSpace is a new base class that Space inherits
      > > from and which has no allocation methods and does not dictate how the
      > > pages should be held.
      > >
      > > ReadOnlySpace unlike Space holds its pages as a
      > > std::vector<ReadOnlyPage>, where ReadOnlyPage directly subclasses
      > > BasicMemoryChunk, meaning they do not have prev_ and next_ pointers and
      > > cannot be held in a heap::List. This is desirable since with pointer
      > > compression we would like to remap these pages to different memory
      > > addresses which would be impossible with a heap::List.
      > >
      > > Since ReadOnlySpace no longer uses most of the code from the other
      > > Spaces it makes sense to simplify its memory allocation to use a simple
      > > bump pointer and always allocate a new page whenever an allocation
      > > exceeds the remaining space on the final page.
      > >
      > > Change-Id: Iee6d9f96cfb174b4026ee671ee4f897909b38418
      > > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2209060
      > > Commit-Queue: Dan Elphick <delphick@chromium.org>
      > > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
      > > Cr-Commit-Position: refs/heads/master@{#68137}
      > 
      > TBR=ulan@chromium.org,delphick@chromium.org
      > 
      > # Not skipping CQ checks because original CL landed > 1 day ago.
      > 
      > Change-Id: I68c9834872e55eb833be081f8ff99b786bfa9894
      > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2232552
      > Commit-Queue: Dan Elphick <delphick@chromium.org>
      > Reviewed-by: Dan Elphick <delphick@chromium.org>
      > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#68211}
      
      TBR=ulan@chromium.org,delphick@chromium.org
      
      # Not skipping CQ checks because original CL landed > 1 day ago.
      
      Change-Id: Id5b3cce41b5dec1dca816c05848d183790b1cc05
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2250254Reviewed-by: 's avatarDan Elphick <delphick@chromium.org>
      Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
      Commit-Queue: Dan Elphick <delphick@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#68407}
      32b911f9
  5. 05 Jun, 2020 1 commit
    • Dan Elphick's avatar
      Revert "[heap] Make ReadOnlySpace use bump pointer allocation" · f78d69fa
      Dan Elphick authored
      This reverts commit 81c34968 and also
      490f3580 which depends on the former.
      
      Reason for revert: Break CFI tests in chromium https://ci.chromium.org/p/chromium/builders/ci/Linux%20CFI/17438
      Original change's description:
      > [heap] Make ReadOnlySpace use bump pointer allocation
      >
      > This changes ReadOnlySpace to no longer be a PagedSpace but instead it
      > is now a BaseSpace. BasicSpace is a new base class that Space inherits
      > from and which has no allocation methods and does not dictate how the
      > pages should be held.
      >
      > ReadOnlySpace unlike Space holds its pages as a
      > std::vector<ReadOnlyPage>, where ReadOnlyPage directly subclasses
      > BasicMemoryChunk, meaning they do not have prev_ and next_ pointers and
      > cannot be held in a heap::List. This is desirable since with pointer
      > compression we would like to remap these pages to different memory
      > addresses which would be impossible with a heap::List.
      >
      > Since ReadOnlySpace no longer uses most of the code from the other
      > Spaces it makes sense to simplify its memory allocation to use a simple
      > bump pointer and always allocate a new page whenever an allocation
      > exceeds the remaining space on the final page.
      >
      > Change-Id: Iee6d9f96cfb174b4026ee671ee4f897909b38418
      > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2209060
      > Commit-Queue: Dan Elphick <delphick@chromium.org>
      > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#68137}
      
      TBR=ulan@chromium.org,delphick@chromium.org
      
      # Not skipping CQ checks because original CL landed > 1 day ago.
      
      Change-Id: I68c9834872e55eb833be081f8ff99b786bfa9894
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2232552
      Commit-Queue: Dan Elphick <delphick@chromium.org>
      Reviewed-by: 's avatarDan Elphick <delphick@chromium.org>
      Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#68211}
      f78d69fa
  6. 03 Jun, 2020 1 commit
    • Dan Elphick's avatar
      [heap] Make ReadOnlySpace use bump pointer allocation · 81c34968
      Dan Elphick authored
      This changes ReadOnlySpace to no longer be a PagedSpace but instead it
      is now a BaseSpace. BasicSpace is a new base class that Space inherits
      from and which has no allocation methods and does not dictate how the
      pages should be held.
      
      ReadOnlySpace unlike Space holds its pages as a
      std::vector<ReadOnlyPage>, where ReadOnlyPage directly subclasses
      BasicMemoryChunk, meaning they do not have prev_ and next_ pointers and
      cannot be held in a heap::List. This is desirable since with pointer
      compression we would like to remap these pages to different memory
      addresses which would be impossible with a heap::List.
      
      Since ReadOnlySpace no longer uses most of the code from the other
      Spaces it makes sense to simplify its memory allocation to use a simple
      bump pointer and always allocate a new page whenever an allocation
      exceeds the remaining space on the final page.
      
      Change-Id: Iee6d9f96cfb174b4026ee671ee4f897909b38418
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2209060
      Commit-Queue: Dan Elphick <delphick@chromium.org>
      Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#68137}
      81c34968
  7. 18 May, 2020 2 commits