1. 16 Mar, 2020 1 commit
  2. 05 Mar, 2020 3 commits
    • Clemens Backes's avatar
      Reland "[wasm] Further reduce the size of WasmCode" · 13cdf3a7
      Clemens Backes authored
      This is a reland of 79398ab0
      
      Original change's description:
      > [wasm] Further reduce the size of WasmCode
      >
      > Also, save dynamic allocations (plus their memory overhead).
      > This is realized by storing the relocation information, source position
      > table, and protected instruction information together in one "metadata"
      > byte array.
      > For each of the three components, we just store their size, such that
      > the accessors can return the respecitive {Vector} views as before.
      >
      > This makes each WasmCode object 24 bytes smaller on 64-bit
      > architectures. It also saves a few more bytes per code object because
      > less padding is needed for the individual allocations, and each dynamic
      > allocation comes with some constant memory overhead.
      >
      > Since the protected instructions will just be stored in a byte array
      > now, some APIs are refactored to just return that byte array directly
      > (instead of an array of {ProtectedInstructionData}). This also
      > simplifies serialization and deserialization, and will allow for
      > switching to a more compact representation in the future.
      >
      > Drive-by: Add some more checks to {Vector::cast} to protect against
      >   undefined behaviour.
      >
      > R=ahaas@chromium.org
      >
      > Bug: v8:10254
      > Change-Id: I81ca847023841110e3e52cc402fcb0349325d7af
      > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2078545
      > Reviewed-by: Andreas Haas <ahaas@chromium.org>
      > Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
      > Commit-Queue: Clemens Backes <clemensb@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#66596}
      
      Tbr: ahaas@chromium.org
      Bug: v8:10254
      Change-Id: Idcdcb4f13c3eb7a3f7fb5ef8a1229103ca0ae975
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2089934Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
      Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#66598}
      13cdf3a7
    • Clemens Backes's avatar
      Revert "[wasm] Further reduce the size of WasmCode" · 28afd1c9
      Clemens Backes authored
      This reverts commit 79398ab0.
      
      Reason for revert: Makes UBSan unhappy: https://ci.chromium.org/p/v8/builders/ci/V8%20Linux64%20UBSan/10186
      
      Original change's description:
      > [wasm] Further reduce the size of WasmCode
      > 
      > Also, save dynamic allocations (plus their memory overhead).
      > This is realized by storing the relocation information, source position
      > table, and protected instruction information together in one "metadata"
      > byte array.
      > For each of the three components, we just store their size, such that
      > the accessors can return the respecitive {Vector} views as before.
      > 
      > This makes each WasmCode object 24 bytes smaller on 64-bit
      > architectures. It also saves a few more bytes per code object because
      > less padding is needed for the individual allocations, and each dynamic
      > allocation comes with some constant memory overhead.
      > 
      > Since the protected instructions will just be stored in a byte array
      > now, some APIs are refactored to just return that byte array directly
      > (instead of an array of {ProtectedInstructionData}). This also
      > simplifies serialization and deserialization, and will allow for
      > switching to a more compact representation in the future.
      > 
      > Drive-by: Add some more checks to {Vector::cast} to protect against
      >   undefined behaviour.
      > 
      > R=​ahaas@chromium.org
      > 
      > Bug: v8:10254
      > Change-Id: I81ca847023841110e3e52cc402fcb0349325d7af
      > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2078545
      > Reviewed-by: Andreas Haas <ahaas@chromium.org>
      > Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
      > Commit-Queue: Clemens Backes <clemensb@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#66596}
      
      TBR=jkummerow@chromium.org,ahaas@chromium.org,clemensb@chromium.org,tebbi@chromium.org
      
      Change-Id: Id80aa82cfce8942879031032b322ee66855b5600
      No-Presubmit: true
      No-Tree-Checks: true
      No-Try: true
      Bug: v8:10254
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2089933Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#66597}
      28afd1c9
    • Clemens Backes's avatar
      [wasm] Further reduce the size of WasmCode · 79398ab0
      Clemens Backes authored
      Also, save dynamic allocations (plus their memory overhead).
      This is realized by storing the relocation information, source position
      table, and protected instruction information together in one "metadata"
      byte array.
      For each of the three components, we just store their size, such that
      the accessors can return the respecitive {Vector} views as before.
      
      This makes each WasmCode object 24 bytes smaller on 64-bit
      architectures. It also saves a few more bytes per code object because
      less padding is needed for the individual allocations, and each dynamic
      allocation comes with some constant memory overhead.
      
      Since the protected instructions will just be stored in a byte array
      now, some APIs are refactored to just return that byte array directly
      (instead of an array of {ProtectedInstructionData}). This also
      simplifies serialization and deserialization, and will allow for
      switching to a more compact representation in the future.
      
      Drive-by: Add some more checks to {Vector::cast} to protect against
        undefined behaviour.
      
      R=ahaas@chromium.org
      
      Bug: v8:10254
      Change-Id: I81ca847023841110e3e52cc402fcb0349325d7af
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2078545Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
      Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#66596}
      79398ab0
  3. 03 Mar, 2020 2 commits
  4. 27 Feb, 2020 1 commit
  5. 26 Feb, 2020 1 commit
    • Clemens Backes's avatar
      [wasm] Reduce size of {WasmCode} objects · c626bc5e
      Clemens Backes authored
      This is a first step to make {WasmCode} objects smaller. Many code
      offsets are currently stored in {size_t} even though there were
      originally (during assembly) an int. Others are stored in {uint32_t}.
      
      This CL switches the function index and all code lengths and offsets to
      int, because
      a) bigger code is not supported anyway, and
      b) the style guide recommends int over unsigned types.
      
      This makes the {WasmCode} 24 bytes smaller on x64 (from 144 to 120
      bytes).
      
      R=ahaas@chromium.org
      
      Bug: v8:10254
      Change-Id: I8f78bf4be64d59cf9393e3b6662d9d3bd153d387
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2074217Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#66462}
      c626bc5e
  6. 20 Feb, 2020 3 commits
    • Clemens Backes's avatar
      [wasm] Fix name used for code logging · 3e3deb4b
      Clemens Backes authored
      Different loggers had different logic to handle unnamed wasm functions.
      This CL makes sure that we always set a reasonable name when logging
      wasm code, and removes handling for unnamed code in individual loggers.
      
      Since logging only happens on user action, the code is not optimized for
      performance (i.e. we always just write to a {std::string}, even if the
      length of the string is known to be limited).
      
      R=jkummerow@chromium.org
      
      Bug: chromium:863205
      Change-Id: I941f7e8050c97dc938afd7883aaeb3b6347b762d
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2064977Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#66370}
      3e3deb4b
    • Thibaud Michaud's avatar
      [wasm] Add missing mutex guard for tier down flag · 9457f48e
      Thibaud Michaud authored
      R=clemensb@chromium.org
      
      Bug: v8:10245
      Change-Id: If99608d12034c241c37e8b0b345e92dce8847b9f
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2064976
      Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
      Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#66366}
      9457f48e
    • Clemens Backes's avatar
      [wasm] Avoid unnecessary jump tables · 1403fd7d
      Clemens Backes authored
      If multiple code spaces are created, each of them currently gets its own
      jump table (on 64 bit platforms). Since we try to allocate new code
      spaces right after existing ones, this is often not necessary. We could
      instead reuse the existing jump table(s).
      This saves code space for the unneeded jump tables and avoid the cost of
      patching the redundant jump tables when we replace code objects.
      
      This CL implements this by checking whether an existing jump table (or
      pair of far jump table and (near) jump table) fully covers a new code
      space, and reuses the existing jump table in that case.
      
      R=ahaas@chromium.org
      
      Change-Id: Id8751b9c4036cf8f85f9baa2b0be8b2cfb5716ff
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2043846Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#66364}
      1403fd7d
  7. 19 Feb, 2020 1 commit
  8. 18 Feb, 2020 1 commit
  9. 06 Feb, 2020 1 commit
    • Z Nguyen-Huu's avatar
      Reland "[wasm] Tierdown wasm module upon "Debugger.enable"" · 1f7861c8
      Z Nguyen-Huu authored
      This is a reland of 410ca4c5
      
      Skip new test for unsupported liftoff architecture.
      Previously, if there is some unsupported liftoff functions, it fall
      through Turbofan but recompilation didn't catch and count it. This CL
      fixes it by using requested_tier on finished units.
      
      Avoid to tier down asm.js.
      Introduce reached recompilation tier to monitor recompilation progress.
      
      Original change's description:
      > [wasm] Tierdown wasm module upon "Debugger.enable"
      >
      > Put a logic in Wasm Engine to tier down all existing modules per isolate
      > when debugger is enabled. This CL does not handle new module added after
      > debugger is enabled yet.
      >
      > Bug: v8:9654
      > Change-Id: I87060f5c416506543fcaf231bff9999d06ba4c0d
      > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2013692
      > Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
      > Reviewed-by: Simon Zünd <szuend@chromium.org>
      > Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
      > Reviewed-by: Clemens Backes <clemensb@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#66017}
      
      TBR=szuend@chromium.org,bmeurer@chromium.org
      
      Bug: v8:9654
      Change-Id: I6014ae52d1e04726e64ee9267c5ce559090414d7
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2031744
      Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
      Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#66164}
      1f7861c8
  10. 05 Feb, 2020 1 commit
  11. 04 Feb, 2020 1 commit
  12. 31 Jan, 2020 1 commit
  13. 30 Jan, 2020 1 commit
    • Eric Leese's avatar
      Revert "[wasm] Tierdown wasm module upon "Debugger.enable"" · fb96381b
      Eric Leese authored
      This reverts commit 410ca4c5.
      
      Reason for revert: This was causing Chrome to hang when debugging large wasm binaries.
      
      Clean revert except for modification to test/debugger/debugger.status
      
      Bug: chromium:1047210, v8:9654
      
      Original change's description:
      > [wasm] Tierdown wasm module upon "Debugger.enable"
      >
      > Put a logic in Wasm Engine to tier down all existing modules per isolate
      > when debugger is enabled. This CL does not handle new module added after
      > debugger is enabled yet.
      >
      > Bug: v8:9654
      > Change-Id: I87060f5c416506543fcaf231bff9999d06ba4c0d
      > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2013692
      > Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
      > Reviewed-by: Simon Zünd <szuend@chromium.org>
      > Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
      > Reviewed-by: Clemens Backes <clemensb@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#66017}
      
      TBR=clemensb@chromium.org,bmeurer@chromium.org,duongn@microsoft.com,szuend@chromium.org
      
      # Not skipping CQ checks because original CL landed > 1 day ago.
      
      Bug: v8:9654
      Change-Id: Id49e8c69f8212e95e698d7e7267056fb2eb7e60a
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2030737
      Auto-Submit: Eric Leese <leese@chromium.org>
      Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
      Reviewed-by: 's avatarSimon Zünd <szuend@chromium.org>
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#66054}
      fb96381b
  14. 29 Jan, 2020 1 commit
  15. 27 Jan, 2020 1 commit
    • Clemens Backes's avatar
      [wasm] Introduce declared_function_index helper · 4299cb69
      Clemens Backes authored
      We often only need to store information about declared (i.e.
      non-imported) functions in a wasm module. Thus we remove the number of
      imported function from a function index. We do this in several places,
      with different amount of checking.
      
      This CL extracts this logic to a new {declared_function_index} helper
      and uses it wherever we do this translation. This more or less
      establishes the concept of "declared function index" and hopefully
      prevents errors in the future.
      
      R=jkummerow@chromium.org
      
      Bug: chromium:1045767
      Change-Id: I7e957401495a2a8cb5d2c51031f9c69fe46195d8
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2020763
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#65994}
      4299cb69
  16. 22 Jan, 2020 1 commit
    • Z Nguyen-Huu's avatar
      Reland "[wasm] Perform NativeModule tier down in parallel." · 30f94ea4
      Z Nguyen-Huu authored
      This is a reland of faccc95b
      
      Since 1c9bb77d, async jobs use existing
      entry in native module cache and skip recompilation so we need to fix
      the test.
      
      Original change's description:
      > Reland "[wasm] Perform NativeModule tier down in parallel."
      >
      > This is a reland of 3352fcc9
      >
      > Disable stress-opt for test and check recompilation before clearing
      > callbacks.
      >
      > Original change's description:
      > > [wasm] Perform NativeModule tier down in parallel.
      > >
      > > Reuse logic in {CompileNativeModule} function in module-compiler.cc:
      > > initialize parallel compile jobs, then wait for them to finish while
      > > taking part in this compilation.
      > >
      > > Bug: v8:9654
      > > Change-Id: I9974d9f8b516e9faec716a592c7c0ee9c7077d8e
      > > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1977041
      > > Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
      > > Reviewed-by: Clemens Backes <clemensb@chromium.org>
      > > Cr-Commit-Position: refs/heads/master@{#65763}
      >
      > Bug: v8:9654
      > Change-Id: I8e8830f05e189596207365b7332a2cc25e493e47
      > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2002945
      > Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
      > Reviewed-by: Clemens Backes <clemensb@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#65901}
      
      Bug: v8:9654
      Change-Id: Ia63b86d4275088d93202046bc9823e6202b7991a
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2012986Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
      Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
      Cr-Commit-Position: refs/heads/master@{#65929}
      30f94ea4
  17. 21 Jan, 2020 2 commits
  18. 15 Jan, 2020 1 commit
  19. 14 Jan, 2020 1 commit
  20. 07 Jan, 2020 1 commit
  21. 02 Jan, 2020 1 commit
  22. 27 Dec, 2019 1 commit
  23. 19 Dec, 2019 1 commit
  24. 18 Dec, 2019 1 commit
  25. 17 Dec, 2019 1 commit
  26. 04 Dec, 2019 2 commits
  27. 02 Dec, 2019 3 commits
  28. 13 Nov, 2019 1 commit
  29. 12 Nov, 2019 2 commits
    • Clemens Backes's avatar
      [wasm] Improve code size estimates · aadf812c
      Clemens Backes authored
      UMA data shows that we currently still allocate up to ten code spaces
      per module. This is because the code size estimates are vastly off,
      especially if both Liftoff and TurboFan is being used.
      Also, code sizes differ by platform.
      
      This CL adds more logic to the {EstimateNativeModuleCodeSize} function
      to distinguish Liftoff and TurboFan, and to use different constants per
      platform. A largeish comment explains how the numbers were generated,
      and that they are an extreme over-generalization. However, without
      further information about the module, this is the best we can do.
      After all, being off even by a factor of two does not hurt too much, as
      explained in the comment.
      
      R=jkummerow@chromium.org
      
      Change-Id: Icd178f5f4d0c7c8fa29b11b6eff7d14e64a1af1c
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1910102
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#64913}
      aadf812c
    • Clemens Backes's avatar
      [wasm] Avoid overallocation of far jump table · c91284ee
      Clemens Backes authored
      On platforms that do not require the far jump table for wasm calls (32
      bit platforms currently), we do not need to include a far jump table
      slot per wasm function. Other places already used the
      {NumWasmFunctionsInFarJumpTable} helper function, but in the actual
      allocation of the far jump table, it was missing.
      
      R=jkummerow@chromium.org
      
      Change-Id: I30734a1a25cc80e38c47abfd39059d56c9e5de57
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1910101Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#64911}
      c91284ee
  30. 08 Nov, 2019 1 commit
    • Clemens Backes's avatar
      [wasm] Improve code size estimate for streaming · 77a2b4c1
      Clemens Backes authored
      In streaming compilation, we were computing a way too low code size
      estimate, since all {WasmFunction::code} fields were still zero when we
      were calling {EstimateNativeModuleCodeSize}. This lead to many separate
      code spaces being created during compilation, creating significant
      performance and memory overhead.
      
      This CL fixes this by passing the code section length when creating the
      {NativeModule}. From this, we can compute the code size estimate just as
      before.
      
      Drive-by: Rename "functions_count" to "num_functions" in
      {ProcessCodeSectionHeader} to be consistent with the declaration.
      
      R=ahaas@chromium.org
      
      Bug: v8:9950
      Change-Id: I30a54c01ed24d0dfecb8a4b6d123015f1803ddeb
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1903439
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#64849}
      77a2b4c1