1. 28 Apr, 2020 1 commit
  2. 18 Mar, 2020 1 commit
    • Tobias Tebbi's avatar
      [torque] add const references and disallow const class field writes · d7e02ea4
      Tobias Tebbi authored
      - Allow type expression for abstract type supertypes.
        For consistency, and ease of implementation, also allow this for enums.
      - Allow subtyping of structs. This requires changing all places where we
        checked for struct types and instead check if we have a subtype of a
        struct type.
      - This allows defining two subtypes of the Reference<T> struct for
        mutable and constant references. Mutable references are a subtype of
        constant references.
      - &T desugars to MutableReference<T>
        const &T desugars to ConstReference<T>
      - A const field of a class produces a constant reference.
        A const field of a mutable reference to a struct is const.
        A mutable field of a const reference to a struct is const.
      - It is possible to assign a new struct value to a mutable reference to
        a struct, even if the struct contains const fields. This is analogous
        to allowing assignments of let-bound structs with constant fields.
      
      Not in this CL:
      - A notion of const slices.
      - Applying const to appropriate class fields.
      
      Bug: v8:7793
      Change-Id: I6e7b09d44f54db25f8bf812be5f3b554b80414e0
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2096615Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
      Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#66759}
      d7e02ea4
  3. 18 Dec, 2019 1 commit
  4. 10 Dec, 2019 1 commit
    • Tobias Tebbi's avatar
      [torque] allow allocation of strings · 8ed9be48
      Tobias Tebbi authored
      This CL generalizes and improves how we handle allocations in Torque.
      
      Overview of the changes:
      - Remove obsolete special handling for JSObject classes, since it was
        incomplete: It breaks as soon as slack tracking is active.
      - Handle array initialization using slices.
      - Properly align allocation sizes. This enabled allocating strings.
      - Port AllocateSeq{One,Two}ByteString to Torque, which is much easier
        now than the old CSA code since allocation size alignment and
        large-object space allocation just happen out-of-the-box.
      - Remove obsolete or unnecessary intrinsics, some of them turn into
        macros in the torque_internal namespace.
      - Distinguish between header size and overall size for ClassType,
        make size optional and only defined when it is statically known.
      
      
      Bug: v8:10004 v8:7793
      Change-Id: I623db233e7fb4deed54e8039ae0c24705e9a44e8
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1932356Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
      Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#65397}
      8ed9be48
  5. 15 Nov, 2019 1 commit
    • Seth Brenith's avatar
      [torque] Generate more detailed errors when instantiating generics · 332290e4
      Seth Brenith authored
      Currently it's pretty easy to write Torque code that generates an error
      in some common generic function such as Convert<To: type, From: type>,
      and unless your change is very small, it can be hard to figure out what
      part of it caused that macro specialization. This CL updates the Torque
      compiler to emit some extra information about the stack of code
      positions that caused a specialization of a macro or builtin, similar to
      what Clang does for C++ templates. Obviously there might be multiple
      places that require a particular specialization, but we only report the
      first one that caused the specialization to be created.
      
      Bug: v8:7793
      Change-Id: I4c0fbf1fd437d0eb0d7d5002baef7a5361aea5ee
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1911019
      Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
      Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#64987}
      332290e4
  6. 31 Oct, 2019 1 commit
  7. 24 Oct, 2019 1 commit
    • Tobias Tebbi's avatar
      [torque] introduce generic abstract types · 5bba6680
      Tobias Tebbi authored
      This expands the existing mechanism for generic structs to also cover
      abstract types. This involves:
      - Moving the SpecializationKey from StructType to Type, so that it's
        also available to AbstractType.
      - Moving the generic parameters out of the StructDeclaration AST node
        and using the existing GenericDeclaration AST node for generic structs
        and abstract types too.
      - The GenericStructType declarable gets generalized to GenericType.
      
      This will be useful for defining a Weak<T> type for weak pointers.
      
      Bug: v8:7793
      Change-Id: I183b3a038a143cf0ae5888150104c4a025fd736c
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1859623
      Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
      Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#64533}
      5bba6680
  8. 22 Oct, 2019 1 commit
    • Tobias Tebbi's avatar
      [torque] replace name mangling with unique numbering · 419b4e7e
      Tobias Tebbi authored
      Name mangling is hard to get right and not easy to read.
      This CL replaces the remaining name mangling of types and generics
      with simpler names that are not always unique, but then fixes them
      up by appending a unique counter.
      
      For struct types, this required an @export annotation since we use some
      struct types in CSA.
      
      Drive-by-fixes:
      
      - Overwrite the copy constructor of Type to clear the list
      of alias names when creating a new type.
      
      - Change the existing append-a-number scheme to have different
        counters for each name. This the number of changed names when adding
        something and is more readable.
      
      Bug: v8:7793
      Change-Id: Ied11ea1a251130f4562ddc0d81967368349e0bf6
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1866650
      Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
      Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#64449}
      419b4e7e
  9. 07 Oct, 2019 1 commit
  10. 26 Aug, 2019 1 commit
    • Tobias Tebbi's avatar
      Reland "[torque] introduce JSAny type for user-accessible JavaScript values" · 1ef99b93
      Tobias Tebbi authored
      Changes in the reland: Rebased and added a check that JavaScript-linkage
      builtins use JSAny in parameters and return type, plus the necessary
      cleanups for this test to pass.
      
      Design Doc: https://docs.google.com/document/d/1z6j0pWHnNIfId0v00uWN2HBrGRDJxJfYuCr5K7Kr1xA
      
      This reverts commit 4418a7b9.
      
      Original change's description:
      > Revert "[torque] introduce JSAny type for user-accessible JavaScript values"
      >
      > This reverts commit 79b00555.
      >
      > Reason for revert: needs more discussion
      >
      > Original change's description:
      > > [torque] introduce JSAny type for user-accessible JavaScript values
      > >
      > > This CL introduces a JSAny type for user-exposed JavaScript values and
      > > a few new types to define it. Especially, it splits Symbol into
      > > PrivateSymbol (not exposed) and PublicSymbol (JavaScript exposed
      > > symbols).
      > >
      > > The change is mostly mechanical, but a few things are interesting:
      > > - PropertyKey and JSPrimitive were designed to coincide with the spec
      > >   notions of IsPropertyKey() and primitive value, respectively.
      > > - Since Name is an open type, we define AnyName to be the known
      > >   subtypes of Name. This is not too elegant, but by using AnyName
      > >   instead of Name, typeswitch can properly conclude something if a
      > >   subtype of Name is excluded.
      > >
      > > Small drive-by changes, which were necessary:
      > > - Allow subtyping on label parameters.
      > > - Fix the formatting of typeswitch, it was broken with union types
      > >   in case types.
      > >
      > > Bug: v8:7793
      > > Change-Id: I14b10507f8cf316ad85e048fe8d53d1df5e0bb13
      > > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1735322
      > > Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
      > > Reviewed-by: Jakob Gruber <jgruber@chromium.org>
      > > Cr-Commit-Position: refs/heads/master@{#63114}
      >
      > TBR=neis@chromium.org,jgruber@chromium.org,tebbi@chromium.org
      >
      > Change-Id: Ifde7881d74afe407628f40047997339d54cb2424
      > No-Presubmit: true
      > No-Tree-Checks: true
      > No-Try: true
      > Bug: v8:7793
      > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1741652
      > Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
      > Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#63115}
      
      TBR=neis@chromium.org,jgruber@chromium.org,tebbi@chromium.org
      
      # Not skipping CQ checks because original CL landed > 1 day ago.
      
      Bug: v8:7793
      Change-Id: Icca34e3824f55009b984d9348fd21884400f0081
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1769316
      Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
      Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
      Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#63395}
      1ef99b93
  11. 06 Aug, 2019 1 commit
  12. 26 Jul, 2019 1 commit
  13. 23 Jul, 2019 1 commit
    • Georg Schmid's avatar
      [torque] Add Generic Structs · 1d9a5d88
      Georg Schmid authored
      This CL introduces generic Torque structs. Generics are grounded early in the Torque compilation pipeline, meaning that every instantiation of a generic struct with concrete types will be turned into a distinct StructType.
      
      As an example, consider a Tuple of types T1, T2:
      
        struct Tuple<T1: type, T2: type> {
          const fst: T1;
          const snd: T2;
        }
      
      which can be manipulated using generic macros, such as
      
        macro Swap<T1: type, T2: type>(tuple: Tuple<T1, T2>): Tuple<T2, T1> {
          return Tuple<T2, T1>{fst: tuple.snd, snd: tuple.fst};
        }
      
      Currently there is no type inference for struct instantiation sites, so type arguments have to be provided explicitly:
      
        const intptrAndSmi = Tuple<intptr, Smi>{fst: 1, snd: 2};
      
      R=sigurds@chromium.org, tebbi@chromium.org
      
      Change-Id: I43111561cbe53144db473dc844a478045644ef6c
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1714868
      Commit-Queue: Georg Schmid <gsps@google.com>
      Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
      Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#62878}
      1d9a5d88
  14. 14 Jun, 2019 3 commits
  15. 27 May, 2019 1 commit
    • Tobias Tebbi's avatar
      [torque] no longer generate assemblers per namespace · 19d8bfa5
      Tobias Tebbi authored
      Instead of generating one CodeStubAssembler-like class per namespace,
      Torque-generated macros are now free-standing functions not included
      from CSA code, and explicitly exported macros become part of the new
      TorqueGeneratedExportedMacrosAssembler, which CodeStubAssembler
      inherits from, thus making them available to all CSA code.
      
      Structs are now defined in a new header csa-types-tq.h as free-standing
      types with the prefix "TorqueStruct".
      
      This is a preparation for generating per Torque-file instead of per
      namespace.
      
      Change-Id: I60fadc493a63f85d1d340768ec6f11ae47be0cb8
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1628787
      Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
      Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#61865}
      19d8bfa5
  16. 24 May, 2019 1 commit
  17. 20 May, 2019 1 commit
  18. 15 May, 2019 1 commit
    • Simon Zünd's avatar
      [torque-ls] Support types in document-wide symbol requests · d6b51cba
      Simon Zünd authored
      This CL adds support for all kinds of Types to "textDocument/symbol"
      requests. While LSP has support for classes and structs, it does not
      have support for generic types. Only classes are marked as such,
      while all other types are marked as structs in terms of the LSP.
      
      Special care has to be taken with TypeAliases. Generic call sites
      introduce a new scope (similar to namespace scopes), where new
      TypeAliases are created for Generic type arguments. These TypeAliases
      then point to the specialized type inside this call-site specific
      scope. To omit the specialized TypeAliaes from the symbols list,
      they are marked using the "is_user_defined" flag.
      
      R=sigurds@chromium.org
      
      Bug: v8:8880
      Change-Id: I576d1c677a5255d54f7774aa053f431608a4cd0c
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1613240
      Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
      Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
      Auto-Submit: Simon Zünd <szuend@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#61534}
      d6b51cba
  19. 14 May, 2019 2 commits
  20. 07 May, 2019 3 commits
  21. 06 May, 2019 1 commit
    • Simon Zünd's avatar
      [torque] Better SourcePositions for declarables · 9b30bdb4
      Simon Zünd authored
      This CL improves SourcePosition support inside the Torque compiler.
      It starts with the parser, where the SourcePosition of the
      MatchedInput now encompasses all tokens, not just the first one.
      
      Second, AST nodes can now be created with an explicit source position.
      This can be used to forward the "all encompassing" source position
      via MatchedInput -> ParseResultIterator to AST nodes.
      
      Third, declarables are extended to hold two different SourcePositions:
        - One represents the whole declarable. For a macro this would
          inlcude the body as well as the signature.
        - The other is the SourcePosition of the identifying part of a
          declarable. In most cases this is the name. For the rest this
          will stay invalid.
      
      R=sigurds@chromium.org, tebbi@chromium.org
      
      Bug: v8:7793
      Change-Id: I509f83aeef7a040d0ea6363b5b7c31ff1b11f47b
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1591600
      Commit-Queue: Simon Zünd <szuend@chromium.org>
      Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#61234}
      9b30bdb4
  22. 03 May, 2019 1 commit
  23. 02 May, 2019 1 commit
  24. 11 Apr, 2019 1 commit
    • Tobias Tebbi's avatar
      [torque] add references to HeapObject fields. · a9a1a3bb
      Tobias Tebbi authored
      This adds references to HeapObject fields to Torque.
      The syntax is based on Rust (which is essentially C pointer syntax).
      
      The type &T is a reference to T (which must be a scalar type for now).
      We can create references from field access expressions, using the
      addressof(&) operator:
        &obj.fieldname
      To read or assign a reference, we use the dereference(*) operator:
        *someref = *otherref
      
      This CL also uses references internally normal class field accesses,
      but only if there is no overload for field accessor functions.
      This allows to have overloaded field accessors for a subtype like
      FastJSArray. However, there is a change in behavior in that an
      operator ".fieldname" will stop reference creation and will therefore
      also stop write access to a class field of the same name. That's why
      this CL had to add a write overload ".length=" for FastJSArray.
      
      References desugar to a pair of a tagged HeapObject pointer and an
      untagged offset into this HeapObject. On the CSA-side, they are
      represented by the C++ struct
      
      struct TorqueReference {
        TNode<HeapObject> object;
        TNode<IntPtrT> offset;
      };
      
      Bug: v8:7793
      Change-Id: Ica6468d47847bd68fb6b85f731cf8fbe142fa401
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1557151
      Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
      Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#60780}
      a9a1a3bb
  25. 09 Apr, 2019 1 commit
  26. 03 Apr, 2019 1 commit
  27. 12 Mar, 2019 1 commit
  28. 11 Mar, 2019 1 commit
  29. 04 Mar, 2019 1 commit
  30. 27 Feb, 2019 2 commits
  31. 25 Feb, 2019 1 commit
  32. 18 Feb, 2019 1 commit
  33. 06 Feb, 2019 1 commit
  34. 04 Feb, 2019 1 commit