1. 04 May, 2020 1 commit
    • Tobias Tebbi's avatar
      [torque] improve GC visitors · f1400e43
      Tobias Tebbi authored
      Summary of changes:
      
      - GC visitors no longer rely on superclass visitors, but instead visit
        everything themselves. This enables generating better code.
      - Try to match simple body descriptors to reduce the amount of generated
        code.
      - Turn SizeFor(instance) into an AllocatedSize() method.
      - Remove the special handling of resizable object sizes from Torque
        and instead overwrite AllocatedSize in classes that need special
        handling in C++.
      - Split the visitor id lists depending on whether the class has pointer
        fields.
      - Turn Torque-generated body descriptors into an .inc file to
        simplify includes.
      - Fix generated size functions to properly align the size.
      - Generate GC visitors (and C++ class definitions) for all string
        classes and FixedArray, WeakFixedArray, and WeakArrayList.
      - Store generated instance types in Torque class types. This is only
        used to determine if a type has a single instance type in this CL.
      
      Bug: v8:7793
      Change-Id: I4d362e96b047c305bd6d065247734957b8958c42
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2110014
      Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
      Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
      Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#67542}
      f1400e43
  2. 29 Apr, 2020 1 commit
  3. 22 Apr, 2020 1 commit
    • Seth Brenith's avatar
      Reland "[torque] Allow storing to bitfield structs that are stored in Smis" · a9270e2b
      Seth Brenith authored
      This is a reland of 80843eda
      
      Original change's description:
      > [torque] Allow storing to bitfield structs that are stored in Smis
      > 
      > This change:
      > 1. Updates the Torque compiler to allow direct access to bitfields that
      >    are packed within Smi values, which previously would have required a
      >    separate untagging step,
      > 2. Updates JSRegExpStringIterator to represent its flags in Torque,
      > 3. Adds reduction cases in MachineOperatorReducer for when the input to
      >    a branch or the left-hand side of a Word32Equals is based on a 64-bit
      >    shift-and-mask operation which has been truncated to 32 bits, as is
      >    the case in the code generated by step 1, and
      > 4. Adds a reduction case in MachineOperatorReducer to remove an extra
      >    Word64And operation added by step 1.
      > 
      > Bug: v8:7793
      > Change-Id: Ib4ac2def6211b3cae6be25a8b2a644be5c7d6d3f
      > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2119225
      > Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
      > Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#67290}
      
      Bug: v8:7793
      Change-Id: I783b6ec080042fec0e922927f6675dede458a072
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2159731Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
      Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#67305}
      a9270e2b
  4. 21 Apr, 2020 2 commits
    • Francis McCabe's avatar
      Revert "[torque] Allow storing to bitfield structs that are stored in Smis" · db61168a
      Francis McCabe authored
      This reverts commit 80843eda.
      
      Reason for revert: Causes compilation failure on macs
      
      https://ci.chromium.org/p/v8/builders/ci/Mac%20V8%20FYI%20Release%20(Intel)/8934?
      
      
      Original change's description:
      > [torque] Allow storing to bitfield structs that are stored in Smis
      > 
      > This change:
      > 1. Updates the Torque compiler to allow direct access to bitfields that
      >    are packed within Smi values, which previously would have required a
      >    separate untagging step,
      > 2. Updates JSRegExpStringIterator to represent its flags in Torque,
      > 3. Adds reduction cases in MachineOperatorReducer for when the input to
      >    a branch or the left-hand side of a Word32Equals is based on a 64-bit
      >    shift-and-mask operation which has been truncated to 32 bits, as is
      >    the case in the code generated by step 1, and
      > 4. Adds a reduction case in MachineOperatorReducer to remove an extra
      >    Word64And operation added by step 1.
      > 
      > Bug: v8:7793
      > Change-Id: Ib4ac2def6211b3cae6be25a8b2a644be5c7d6d3f
      > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2119225
      > Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
      > Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#67290}
      
      TBR=tebbi@chromium.org,seth.brenith@microsoft.com,nicohartmann@chromium.org
      
      Change-Id: Ifa683c92631291c9437438682b6efb2e12862682
      No-Presubmit: true
      No-Tree-Checks: true
      No-Try: true
      Bug: v8:7793
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2159730Reviewed-by: 's avatarFrancis McCabe <fgm@chromium.org>
      Commit-Queue: Francis McCabe <fgm@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#67291}
      db61168a
    • Seth Brenith's avatar
      [torque] Allow storing to bitfield structs that are stored in Smis · 80843eda
      Seth Brenith authored
      This change:
      1. Updates the Torque compiler to allow direct access to bitfields that
         are packed within Smi values, which previously would have required a
         separate untagging step,
      2. Updates JSRegExpStringIterator to represent its flags in Torque,
      3. Adds reduction cases in MachineOperatorReducer for when the input to
         a branch or the left-hand side of a Word32Equals is based on a 64-bit
         shift-and-mask operation which has been truncated to 32 bits, as is
         the case in the code generated by step 1, and
      4. Adds a reduction case in MachineOperatorReducer to remove an extra
         Word64And operation added by step 1.
      
      Bug: v8:7793
      Change-Id: Ib4ac2def6211b3cae6be25a8b2a644be5c7d6d3f
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2119225
      Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
      Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#67290}
      80843eda
  5. 09 Mar, 2020 1 commit
    • Tobias Tebbi's avatar
      [torque] Generate GC object visitors for Torque classes · 4f4d73f2
      Tobias Tebbi authored
      In the process:
      
      * Augment C++-generated Torque classes with SizeFor methods to
        calculate size of instances.
      
      * Add a new "@generateBodyDescriptor" annotation that causes Torque to
        generate C++ BodyDescriptors code that can be used to visit objects
        compatible with existing V8 mechanisms, e.g. GC
      
      * Fully automate C++ macro machinery so that adding non-extern Torque
        class doesn't require any C++ changes, including ensuring generation
        of instance types and proper boilerplate for validators and
        printers.
      
      * Make handling of @export a true annotation, allowing the modifier to
        be used on class declarations.
      
      * Add functionality such that classes with the @export annotation are
        available to be used from C++. Field accessors for exported classes
        are public and factory methods are generated to create instances of
        the objects from C++.
      
      * Change the Torque compiler such that Non-exported classes implicitly
        have the @generateBodyDescriptor annotation added and causes both
        verifiers and printers to be generated.
      
      * Switch non-extern Torque classes from using existing Struct-based
        machinery to being first-class classes that support more existing
        Torque class features.
      
      Change-Id: Ic60e60c2c6bd7acd57f949bce086898ad14a3b03
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2007490
      Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
      Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#66621}
      4f4d73f2
  6. 23 Jan, 2020 1 commit
  7. 20 Dec, 2019 1 commit
    • Tobias Tebbi's avatar
      [torque] multiple arrays in one object · 59e8d45a
      Tobias Tebbi authored
      This allows the definition of classes with several arrays and ports
      SmallOrderedHashTable subclasses to Torque as an example, including
      the existing CSA allocation functions for them.
      
      Overview of changes:
      - Introduce ResidueClass to encapsulate the modulo-arithmetic
        necessary to do alignment checks.
      - Add MachineOperatorReducer to the CSA pipeline to address now
        missing CSA ad-hoc constant folding that got blocked by a
        temporary phi.
      - Allow assignments to references to structs. This is needed to
        initialize the data_table part of SmallOrderedHashMap.
      - Make the NumberLiteralExpression AST-node store a double instead
        of a string. This is necessary to detect arrays with constant size
        used for padding.
      - Turn offsets into base::Optional<size_t> to ensure we don't use
        an invalid or statically unknown offset.
      - Remove CreateFieldReferenceInstruction since it doesn't work for
        complex offset computations and the logic can be expressed better
        in ImplementationVisitor.
      - Validate alignment of structs embedded in classes.
      
      Bug: v8:10004 v8:7793
      Change-Id: Ifa414b42278e572a0c577bf9da3d37f80771a258
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1958011
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
      Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#65538}
      59e8d45a
  8. 27 Nov, 2019 1 commit
  9. 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
  10. 13 Sep, 2019 1 commit
  11. 22 Aug, 2019 1 commit
    • Simon Zünd's avatar
      Introduce "-m32" compilation mode for Torque · 4f0ee93b
      Simon Zünd authored
      Forge (Google3) can only run 64-bit executables. As Torque runs as part
      of the build process, we need a 32-bit "cross-compile" mode when
      we target 32-bit architectures. Note that this flag won't be needed
      in Chromium/V8 land, since we build V8 with the same bit width as
      the target architecture.
      
      This CL adds a new runtime flag to torque "-m32". When enabled, the
      flag forces 32-bit word sizes for various pointer/word sizes. By
      default, the host system sizes from {src/commons/globals.h}
      are used.
      
      R=tebbi@chromium.org
      
      Bug: v8:9641
      Change-Id: I8701eec45e3fb59dc65049b0a679d34589c4127f
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1763540
      Commit-Queue: Simon Zünd <szuend@chromium.org>
      Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#63334}
      4f0ee93b
  12. 11 Jun, 2019 1 commit
    • Simon Zünd's avatar
      [cleanup] Move GlobalContext constructor to new .cc file · 4d70d33c
      Simon Zünd authored
      This CL creates global-context.cc and moves the GlobalContext
      constructor impl to this new file. Preparatory refactoring for import
      syntax.
      
      This CL also removes one unused static method from GlobalContext
      and changes two use-sites where Get() was used together with a static
      accessor.
      
      Drive-by: "Include what you use" for global-context.h
      
      Bug: v8:9183
      Change-Id: Iafd877d03af9ad65b1c99ebd9743be64192f45c9
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1649790
      Commit-Queue: Simon Zünd <szuend@chromium.org>
      Auto-Submit: Simon Zünd <szuend@chromium.org>
      Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#62081}
      4d70d33c
  13. 05 Jun, 2019 1 commit
  14. 20 May, 2019 1 commit
  15. 16 May, 2019 1 commit
  16. 14 May, 2019 2 commits
  17. 08 May, 2019 1 commit
    • Simon Zünd's avatar
      Reland "[torque] Introduce force_assert_statements compiler option" · 2e3862d7
      Simon Zünd authored
      This is a reland of 2d45ecf0
      
      The reland properly initializes struct fields in unittests. To prevent
      this in the future, TorqueCompilerOptions uses brace initialization.
      
      Original change's description:
      > [torque] Introduce force_assert_statements compiler option
      >
      > "assert(...)" statements are usually only visited and generated in
      > debug builds. To provide Language Server support for statements inside
      > asserts, the force_assert_statements option allows to manually
      > override this behavior and visit assert statements in release builds.
      >
      > R=sigurds@chromium.org
      >
      > Bug: v8:7793
      > Change-Id: I38f48e35f2b0a1a98abb74b7babb1edd2d7dba24
      > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1599180
      > Auto-Submit: Simon Zünd <szuend@chromium.org>
      > Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
      > Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#61295}
      
      Bug: v8:7793
      Change-Id: I96ef863c8c85ae87a00cbe858655d4a2c9368b41
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1599599
      Auto-Submit: Simon Zünd <szuend@chromium.org>
      Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
      Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#61315}
      2e3862d7
  18. 07 May, 2019 2 commits
  19. 28 Feb, 2019 1 commit
    • Simon Zünd's avatar
      [torque] Introduce LanguageServerData class · 3f057d44
      Simon Zünd authored
      This CL introduces a new contextual 'LanguageSererData'. Its purpose
      is to hold all the eagerly calculated data needed to answer
      language server requests. The first thing collected are the
      definitoins of some IdentifierExpresisons and macro/builtin
      call-sites.
      
      Collecting this data is not necessary for normal compilation, so it
      is disabled by default and can be enabled via a Torque compiler
      option. Since the holder class is a contextual for which no scope
      exists during normal compilation, accidental collection of
      unnecessary language server data *should* be prevented.
      
      R=tebbi@chromium.org
      
      Bug: v8:7793
      Change-Id: Iffcebad4c420a0a51b1ed3c37a37c3475c6ab2e8
      Reviewed-on: https://chromium-review.googlesource.com/c/1491594Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
      Commit-Queue: Simon Zünd <szuend@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#59941}
      3f057d44
  20. 19 Feb, 2019 1 commit
  21. 04 Feb, 2019 1 commit
  22. 10 Jan, 2019 1 commit
    • Daniel Clifford's avatar
      [torque]: Class declarations · d0e95c7a
      Daniel Clifford authored
      Class declarations support structured heap data that is a subtype of
      HeapObject. Only fields of Object subtypes (both strong and weak)
      are currently supported (no scalar fields yet).
      
      With this CL, both the field list macro used with the C++
      DEFINE_FIELD_OFFSET_CONSTANTS macro (to make field offset constants) as
      well as the Torque "operator '.field'" macros are generated for the
      classes declared in Torque. This is a first step to removing the
      substantial amount of duplication and boilerplate code
      needed to declare heap object classes.
      
      As a proof of concept, and handful of class field definitions,
      including those for non trivial classes like JSFunction, have been
      moved to Torque.
      
      Bug: v8:7793
      Change-Id: I2fa0b53db65fa6f5fe078fb94e1db3418f908753
      Reviewed-on: https://chromium-review.googlesource.com/c/1373971
      Commit-Queue: Daniel Clifford <danno@chromium.org>
      Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#58704}
      d0e95c7a
  23. 05 Dec, 2018 1 commit
  24. 13 Nov, 2018 1 commit
  25. 05 Nov, 2018 1 commit
    • Tobias Tebbi's avatar
      [torque] cleanup generics and scopes · 06c8ce59
      Tobias Tebbi authored
      - Name lookup in module scopes has namespace semantics now: All
        overloads from all parent modules are combined before overload
        resolution.
      - Allow overloads of different callables: runtime-functions,
        macros, builtins, and generics.
      - The duplication between the DeclarationVisitor and the
        ImplementationVisitor is removed: The DeclarationVisitor creates
        declarables for everything except for implicit generic specializations.
        The ImplementationVisitor iterates over declarables.
        The DeclarationVisitor only looks at the header of declarations, not
        at the body.
      - Modules become Declarable's, which will enable them to be nested.
      - Modules replace the existing Scope chain mechanism, which will make it
        easier to inline macros.
      - The DeclarationVisitor and Declarations become stateless. All state is
        moved to contextual variables and the GlobalContext.
      - Implicit specializations are created directly from the
        ImplementationVisitor. This will enable template parameter inference.
      - As a consequence, the list of all builtins is only available after the
        ImplementationVisitor has run. Thus GenerateBuiltinDefinitions has to
        move to the ImplementationVisitor. Also, this makes it necessary to
        resolve the link from function pointer types to example builtins only
        at this point.
      
      
      Bug: v8:7793
      Change-Id: I61cef2fd3e954ab148c252974344a6e38ee2d01d
      Reviewed-on: https://chromium-review.googlesource.com/c/1304294
      Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
      Reviewed-by: 's avatarDaniel Clifford <danno@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#57231}
      06c8ce59
  26. 15 Oct, 2018 1 commit
  27. 04 Oct, 2018 1 commit
  28. 24 Jul, 2018 1 commit
  29. 20 Jul, 2018 1 commit
  30. 15 Jun, 2018 1 commit
  31. 13 Jun, 2018 1 commit
  32. 30 May, 2018 1 commit
  33. 16 May, 2018 2 commits
  34. 08 May, 2018 1 commit
  35. 04 May, 2018 1 commit
    • Daniel Clifford's avatar
      [Torque]: add assert(), unreachable and debug statements · 9cd8995f
      Daniel Clifford authored
      - In debug builds, 'assert(<expr>)' evaluates and aborts execution
        if the provided Torque expression is false at runtime.
        assert(<expr>) supports the same set of expressions protocols
        as Toruqe's if statement, i.e. both bool values and BranchIf-
        style tests. Upon failure, the assertion prints the Torque
        source code of the failed expression, not the generated CSA
        code.
      - 'unreachable' calls CSA's Unreachable() and signals to Torque
        that code execution cannot continue (i.e. its statement
        returns the 'never' type). In debug builds, the line number
        and position of the statement are printed before breaking.
      - 'debug' calls CSA's DebugBreak(). In debug builds, the line
        number and position of the 'debug' are printed before breaking.
      
      Change-Id: I4efd052536bb402c097a0d5f7be56e154b5b3676
      Reviewed-on: https://chromium-review.googlesource.com/1042570
      Commit-Queue: Daniel Clifford <danno@chromium.org>
      Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#52984}
      9cd8995f
  36. 03 May, 2018 1 commit
    • Daniel Clifford's avatar
      Refactor/cleanup various Torque classes, inclduing making Type a Declarable · 90415437
      Daniel Clifford authored
      This is a preparatory step for implementing generics. Along the way, clean up
      and encapsulate a bunch of code, including:
      
      * Fully encapsulate Scope by adding the new class ScopeChain that provide an
        abstraction for creating and activating scopes.
      * Untangle Modules and Scopes.
      * Unify scope activation so that it is always associated with an AST node
        and triggered by a RAII helper class.
      * Unify (somewhat) how builtins and macros are created, fixing a few
        inconsistencies with when and how parameters and their types are declared.
      * Create a new Declarations class that brokers between the visitor classes and
        the ScopeChain. This moves handling of declaration-related errors out of the
        visitors but also makes it possible to do so without polluting Scope and
        ScopeChain with details about resolving SourcePositions in error cases.
      
      Change-Id: I180017d4cf39ccf5ef1d20b84f53284c252f8d87
      Reviewed-on: https://chromium-review.googlesource.com/1038504
      Commit-Queue: Daniel Clifford <danno@chromium.org>
      Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#52947}
      90415437