1. 22 Mar, 2021 1 commit
  2. 16 Mar, 2021 1 commit
  3. 05 Mar, 2021 1 commit
    • Manos Koukoutos's avatar
      [wasm-gc] Implement non-nullable function tables · e3acd9f8
      Manos Koukoutos authored
      This adds the possibility to define non-nullable function tables of heap
      types kFunc and user-defined functions. When such table is defined, it
      is obligatory to provide an initializer expression after its limits.
      Currently, this can only be a function reference.
      
      Changes:
      - Change WasmTableObject::raw_type to encode the whole entry type.
      - Restructure call_indirect to load the signature only if needed, and
        do null checks only if needed.
      - Add the requirement to provide an initializer expression for
        non-nullable tables in module-decoder.
      - Rename "global initializer" -> "initializer expression" everywhere.
      - Add table initialization in module-instantiate.
      - Edit both the C++ and JS WasmModuleBuilder.
      - Add and slightly improve tests.
      - Format wasm-module-builder.js.
      
      Bug: v8:9495
      Change-Id: I7453ee7d567afd5b5fe48a4f1653513787cfe99a
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2732673
      Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
      Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#73215}
      e3acd9f8
  4. 02 Feb, 2021 1 commit
    • Manos Koukoutos's avatar
      [wasm-gc] Fixes around rtts, especially functions · 44fa3408
      Manos Koukoutos authored
      Changes:
      - Rename ObjectReferenceKnowledgs::object_must_be_data_ref to
        reference_kind, introduce an enum to describe it.
      - In both compilers, remove the dynamic check whether the object is an
        array/struct. This is known statically. Instead, if we are checking
        for a function, just check for rtt equality and exit.
      - Remove is_data_ref_type(), replace it in the compilers with calls to
        has_signature().
      - Restructure AllocateSubRtt() to handle function rtts properly.
      - Add a couple execution tests.
      
      Bug: v8:7748
      Change-Id: I46fbbfe2f2a7d29b583de0d536d71c534b98322f
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2661460Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
      Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#72477}
      44fa3408
  5. 15 Jan, 2021 1 commit
  6. 13 Jan, 2021 1 commit
    • Benedikt Meurer's avatar
      [wasm][debug] Simplify debug name handling. · 1bd5755b
      Benedikt Meurer authored
      This moves the logic for the debug name heuristic, which derives names
      for imported and exported entities from the relevant tables, into
      wasm-debug.{cc,h} and stores these maps on the DebugInfoImpl rather than
      on the WasmModule.
      
      Drive-by-fix: Also use the import table based heuristic for function
      names, just like we use it for everything else.
      
      Bug: chromium:1164305
      Change-Id: I8a21e0880c680079f63e6607b5b62c788049b9e1
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2625870
      Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
      Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#72061}
      1bd5755b
  7. 15 Dec, 2020 1 commit
  8. 30 Nov, 2020 1 commit
    • Clemens Backes's avatar
      [wasm] Pass correct code section start in streaming compilation · 7bace1d4
      Clemens Backes authored
      The streaming decoder computed the code section start from the passed
      "offset". That offset is computed from the module offset *after* the
      number of functions has been read. Hence 1 is subtracted, with the
      comment:
      // The offset passed to {ProcessCodeSectionHeader} is an error offset and
      // not the start offset of a buffer. Therefore we need the -1 here.
      
      That subtraction of 1 worked when the number of functions was encoded in
      a 1-byte LEB, otherwise it was off.
      
      This CL fixes the immediate issue of passing the right code offset. The
      usage of the previously existing offset also seems wrong, and I will try
      to clean that up in a follow-up CL.
      
      R=ahaas@chromium.org
      CC=szuend@chromium.org
      
      Bug: chromium:1150303
      Change-Id: I64bb2ececeb4749b7ba2096cd148ccb4079eca4f
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2562383
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#71503}
      7bace1d4
  9. 17 Nov, 2020 1 commit
  10. 09 Nov, 2020 1 commit
  11. 13 Oct, 2020 1 commit
  12. 05 Oct, 2020 1 commit
    • Manos Koukoutos's avatar
      [wasm-gc][bug] Fix signature canonicalization · 4d9d8518
      Manos Koukoutos authored
      We used not to emit canonical indexes for arrays and structs into
      WasmModule::signature_ids, which resulted in signature_ids not referring
      to the correct type indices in a WasmModule.
      
      Changes:
      - Rename signature_ids to canonical_type_ids.
      - Emit trivial canonical type ids for structs and arrays.
      - Add a test to catch the existing bug.
      - Improve DCHECKs for module type accessors.
      
      Bug: v8:7748
      Change-Id: I67ad58865e35b459b21db12557564b652035db75
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2444989
      Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
      Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#70318}
      4d9d8518
  13. 18 Sep, 2020 1 commit
    • Manos Koukoutos's avatar
      [wasm-gc] Preparation for typed function tables · a5f68abe
      Manos Koukoutos authored
      Changes:
      - Rename IsSignatureEqual -> MatchesSignature for consistency
      - Add WasmInstanceObject field to WasmTableObject.
      - Improve some error messages related to tables in
        function-body-decoder-impl.h.
      - Introduce WasmTable::IsValidTableType. Use it wherever appropriate.
      - Overload equality operators in HeapType to work with
        HeapType::Representation.
      - Rename DynamicTypeCheckRef -> TypecheckJSObject.
      - Handle WasmCapiFunctions in TypecheckJSObject.
      - Use TypecheckJSObject in WasmTableObject::IsValidElement.
      - A few more minor improvements.
      
      Bug: v8:9495
      Change-Id: I2867dd3486d7c31717ac26b87a50e15cf2b898be
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2416491
      Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
      Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#70001}
      a5f68abe
  14. 09 Sep, 2020 1 commit
  15. 13 Aug, 2020 1 commit
  16. 05 Aug, 2020 1 commit
    • Manos Koukoutos's avatar
      [wasm-gc] Allow reference types to function signatures · a61aaed9
      Manos Koukoutos authored
      Changes:
      - Remove restriction that function types cannot be used as ref types.
      - Introduce WasmModule::has_type().
      - Remove deferred signature checks in module-decoder. Instead, check if
        type indices are out of bounds in consume_value_type (was bugged
        before).
      - Remove obsolete GetCanonicalRttIndex.
      - Refine type of ref.func.
      - Statically check immediate type against table type for call_indirect.
      - Dynamic check for call_indirect should only happen when for funcref
        (currently the only function supertype).
      - Allocate a different map per function signature (with Map::Copy).
      - Introduce function type equivalence and (trivial) subtyping.
      - Add a few elementary tests.
      
      Bug: v8:7748
      Change-Id: If57d0bfd856c9eb3784191f3de423f53dfd26ef1
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2335190
      Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
      Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
      Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#69250}
      a61aaed9
  17. 27 Jul, 2020 1 commit
    • Paolo Severini's avatar
      [wasm] Generate distinct IR trace files for Wasm import call wrappers · 037e64c8
      Paolo Severini authored
      Currently, when running with --trace-turbo, V8 generates a different
      .json file for each wasm-to-js thunk that it compiles, but these files
      all have the same name "turbo-wasm-to-js-0.json", and only one file is
      generated.
      This makes it difficult to actually examine the difference in the IR
      for this call wrappers produced for different signatures.
      
      This patch fixes this by naming each trace file as:
      "wasm-to-js-<kind>-<signature>-0.json", like for example
      "turbo-wasm-to-js-5-ii-i-0.json".
      
      Change-Id: Iebb73829cddd4f6bbf9d02ed1ce94a80dcfa5ca7
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2316834
      Commit-Queue: Paolo Severini <paolosev@microsoft.com>
      Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#69085}
      037e64c8
  18. 15 Jul, 2020 1 commit
  19. 09 Jul, 2020 1 commit
    • Manos Koukoutos's avatar
      [wasm-gc] Refactoring in preparation of generalizing WasmInitExpr · 01e59c4b
      Manos Koukoutos authored
      Motivation: With rtt.sub now allowed in constant expressions, we have
      to generalize WasmInitExpr to be able to handle expressions with
      operands. This CL prepares the ground for this change and adds no
      functionality.
      
      Changes:
      - ValueType::heap_representation and HeapType::representation now
        return HeapType::Representation.
      - Add ValueType::is_rtt().
      - WasmInitExpr:
        - Make kind private. Rename val -> operator, make it private. Add
          accessors.
        - Rename kGlobalIndex -> kGlobalGet.
        - Squash global_index and function_index into index.
        - Add heap_type Immediate. Use it for RefNullConst. TypeOf in
          module-decoder.cc can now fully determine the type of a
          WasmInitExpr.
        - Add class constructors/static method constructors for each Operator
          kind.
        - Delete copy constructor. WasmInitExpr will use std::unique_ptr for
          its operands.
      - consume_init_expr now uses a stack.
      - A few minor improvements.
      
      Bug: v8:7748
      Change-Id: I3ba3ee7ac2d6bc58e887790c37110ceb80658985
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2284483
      Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
      Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#68759}
      01e59c4b
  20. 29 Jun, 2020 2 commits
  21. 18 Jun, 2020 1 commit
    • Manos Koukoutos's avatar
      [wasm-gc] Change ValueType representation to account for new types · 52f65296
      Manos Koukoutos authored
      Motivation:
      Changes to the typed function references and gc proposals solidified
      the notion of heap type, clarified nullable vs. non-nullable reference
      types, and introduced rtts, which contain an integer depth field in
      addition to a heap type. This required us to overhaul our ValueType
      representation, which results in extensive changes.
      
      To keep this CL "small", we do not try to implement the binary encoding
      as described in the proposals, but rather devise a simpler one of our
      own (see below). Also, we do not try to implement additional
      functionality for the new types.
      
      Changes:
      - Introduce HeapType. Move heap types from ValueType to HeapType.
      - Introduce Nullability for reference types.
      - Rework ValueType helper methods.
      - Introduce rtts in ValueType with an integer depth field. Include depth
        in the ValueType encoding.
      - Make the constructor of ValueType private, instead expose static
        functions which explicitly state what they create.
      - Change every switch statement on ValueType::Kind. Sometimes, we need
        nested switches.
      - Introduce temporary constants in ValueTypeCode for nullable types,
        use them for decoding.
      - In WasmGlobalObject, split 'flags' into 'raw_type' and 'is_mutable'.
      - Change IsSubtypeOfRef to IsSubtypeOfHeap and implement changes in
        subtyping.
      - kWasmFuncRef initializers are now non-nullable. Initializers are
        only required to be subtypes of the declared global type.
      - Change tests and fuzzers as needed.
      
      Bug: v8:7748
      Change-Id: If41f783bd4128443b07e94188cea7dd53ab0bfa5
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2247657
      Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
      Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
      Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#68408}
      52f65296
  22. 05 Jun, 2020 1 commit
  23. 03 Jun, 2020 1 commit
  24. 05 May, 2020 1 commit
  25. 30 Apr, 2020 1 commit
  26. 20 Apr, 2020 1 commit
  27. 06 Apr, 2020 1 commit
  28. 30 Mar, 2020 1 commit
  29. 26 Mar, 2020 1 commit
  30. 17 Mar, 2020 1 commit
  31. 27 Feb, 2020 1 commit
  32. 26 Feb, 2020 1 commit
  33. 24 Feb, 2020 1 commit
  34. 17 Feb, 2020 1 commit
  35. 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
  36. 24 Jan, 2020 1 commit
    • Clemens Backes's avatar
      [wasm] Implement toString of exported functions · 003f622a
      Clemens Backes authored
      We currently print asm.js functions converted to wasm as
      "function foo() { [native code] }", even though without asm to wasm
      translation we get the proper source code. This is an observable
      difference that should not be, and also foozzie finds this frequently in
      different variations.
      
      This CL makes us remember the start position (position of the "function"
      token) and end position (right behind the closing "}") of each function
      we transform to wasm. These offsets, together with the Script that
      contained the function, allows us to reconstruct the source code of the
      function for the {toString()} method.
      
      R=jkummerow@chromium.org
      
      Bug: chromium:667678
      Change-Id: If22471cad4cefdfc67f6d1b8fda85aa0eeb411bd
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2016582
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#65972}
      003f622a
  37. 22 Jan, 2020 1 commit
  38. 21 Jan, 2020 1 commit
    • Clemens Backes's avatar
      Move decoded asm.js offset table off-heap · 87f09404
      Clemens Backes authored
      The asm.js offset table exists in two forms: Delta-encoded in a byte
      array, as generated during asm translation, and decoded, for faster
      lookup.
      This CL moves the encoded version from the {AsmWasmData} and
      {WasmModuleObject} to the {WasmModule}, and stores it off-heap in a C++
      array instead of a {ByteArray}.
      Also, it moves the decoded version off-heap by storing it in a C++ data
      structure that makes lookup easy, instead of encoding it again in
      another {ByteArray}.
      
      This change is a nice refactoring in itself, but it also prepares adding
      more information to the offset table. For reconstructing the source code
      of an asm.js function, we will need to store the start and end offsets
      of the whole function as well (see linked bug).
      
      R=jkummerow@chromium.org
      
      Bug: chromium:667678
      Change-Id: I79b789c3122dd8ba803cedc6bfdcc3d4b1fa0fd4
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2011108
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#65900}
      87f09404
  39. 17 Jan, 2020 1 commit