1. 29 May, 2018 3 commits
    • Tobias Tebbi's avatar
      [torque] add union types · bf9d2893
      Tobias Tebbi authored
      This adds support for union types to Torque.
      
      There is a new type expression
      A | B
      to form the union of the type expressions A and B.
      This is only possible if A and B have a common supertype, to prevent
      nonsensical unions of types with different representations.
      
      Union types are normalized:
      A | B == B | A
      A | (B | C) == (A | B) | C
      A | A == A
      
      The subtyping rules are defined recursively:
      (A | B) <: C  if  A <: C and B <: C
      A <: (B | C)  if  A <: B or A <: C
      
      This allows to define Object as a union type:
      
      type Tagged generates 'TNode<Object>';
      type Smi extends Tagged generates 'TNode<Smi>';
      type HeapObject extends Tagged generates 'TNode<HeapObject>';
      type Object = Smi | HeapObject;
      
      The type {Tagged} is introduced to have a common supertype of all
      tagged values, but we should not use it directly, because {Object}
      contains the additional information that there is nothing but {Smi}
      and {HeapObject} values.
      
      When mapping union types to CSA types, we select the most specific
      common supertype. For Number and Numeric, we already use union types
      on the CSA side. Since it is not possible to map to CSA union types
      in general, we special-case these two union types to map them to
      the CSA union types we already use.
      
      Bug: v8:7793
      Change-Id: I7a4e466436f55d04012f29ef17acfdb957653908
      Reviewed-on: https://chromium-review.googlesource.com/1076132Reviewed-by: 's avatarMichael Stanton <mvstanton@chromium.org>
      Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#53411}
      bf9d2893
    • Tobias Tebbi's avatar
      [cleanup] improve types in base.tq and use LoadTypedArrayLength everywhere · 54f77c42
      Tobias Tebbi authored
      Bug: v8:7754
      Change-Id: I8548d0e07fabc23bb5f65b1f91683c756195ae1b
      Reviewed-on: https://chromium-review.googlesource.com/1071654Reviewed-by: 's avatarMichael Stanton <mvstanton@chromium.org>
      Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
      Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#53398}
      54f77c42
    • Tobias Tebbi's avatar
      [torque] require exact match in return type for cast-like operations · 506d49fb
      Tobias Tebbi authored
      This fixes the bug that cast<A>(...) could be interpreted as
      cast<B>(...) if B is a subtype of A.
      
      Bug: v8:7793
      
      Change-Id: Ia03ce832f8c14ced09114d41c935be06d4629d99
      Reviewed-on: https://chromium-review.googlesource.com/1075890
      Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
      Reviewed-by: 's avatarMichael Stanton <mvstanton@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#53397}
      506d49fb
  2. 25 May, 2018 1 commit
  3. 24 May, 2018 2 commits
  4. 23 May, 2018 2 commits
  5. 22 May, 2018 4 commits
  6. 18 May, 2018 2 commits
  7. 17 May, 2018 1 commit
  8. 16 May, 2018 3 commits
  9. 15 May, 2018 1 commit
  10. 13 May, 2018 2 commits
  11. 08 May, 2018 1 commit
  12. 07 May, 2018 1 commit
    • Daniel Clifford's avatar
      [torque] 'bool' is now 'true|false' not 'yes|no' · dd5cdcee
      Daniel Clifford authored
      In the process, rename Boolean constants (i.e. JavaScript constants),
      to 'True' and 'False'. This uncovered a bug in the internal handling
      of True/False labels was fixed (they shouldn't be Values and Torque
      shouldn't conflate Labels with other Declarables, throwing exceptions
      when they're improperly used in the wrong context). Furthermore,
      the internal labels used for True and False for if statements
      have been renamed so that they can't be aliased from user Torque code.
      
      Change-Id: I09dbd2241d2bc2f1daff53862dee1b601810060c
      Reviewed-on: https://chromium-review.googlesource.com/1044370Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
      Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#53026}
      dd5cdcee
  13. 04 May, 2018 4 commits
    • Daniel Clifford's avatar
      [torque]: Add constexpr keyword/types for compile-time evaluation · aeb86d57
      Daniel Clifford authored
      Torque expressions of type constexpr are evaluated at compile-time
      rather than runtime. They are backed by C++ types rather than
      TNode<X> types, so the macro functions that are called by generated
      C++ code expect values to be computed when the snapshot is generated
      rather than by TurboFan-generated code.
      
      Specifically, "if" statements can have a constexpr modifier. With this
      modifier, a type of "constexpr bool" is expected rather than "bool",
      and in that case instead of generating a CSA BranchIf, it generates
      a C++ "if (<bool expression>)" that generates code for only the true or
      false path based on the bool value at torque-execution (compile time)
      rather than generating both paths (including inserting phi nodes
      for variables modified on either branch at the re-merge at the end
      of the if) and dynamically dispatching to the true or false path
      during d8/Chrome/node.js execution (runtime) using a CSA BranchIf.
      
      Change-Id: I8238e25aaadbfc618847e04556e96a3949ea5a8d
      Reviewed-on: https://chromium-review.googlesource.com/1042085
      Commit-Queue: Daniel Clifford <danno@chromium.org>
      Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#53001}
      aeb86d57
    • Daniel Clifford's avatar
      [torque]: Fix bugs reported by Peter Wong · be9b5f4c
      Daniel Clifford authored
      * Empty string literals (e.g. "" and '') were not recognized a strings. This is
        now fixed.
      * return statements without expressions (e.g. for functions with void return
        types) caused crashes.
      
      Change-Id: Ied60f9abffca457a0d85c9e01e3795839fe777c9
      Reviewed-on: https://chromium-review.googlesource.com/1042310
      Commit-Queue: Daniel Clifford <danno@chromium.org>
      Reviewed-by: 's avatarMichael Stanton <mvstanton@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#52997}
      be9b5f4c
    • Clemens Hammacher's avatar
      [base] Move implicit_cast to macros.h · 1a6cf58b
      Clemens Hammacher authored
      macros.h already not only defines macros, but also templatized helpers
      like {bit_cast} and {arraysize}. Thus {implicit_cast} also belongs
      there.
      
      R=tebbi@chromium.org
      
      Bug: v8:7570
      Change-Id: Iaea6075dad359d62498453575f22d73ca84e2323
      Reviewed-on: https://chromium-review.googlesource.com/1042401
      Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
      Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#52991}
      1a6cf58b
    • 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
  14. 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
  15. 25 Apr, 2018 1 commit
  16. 24 Apr, 2018 3 commits
  17. 20 Apr, 2018 1 commit
    • Mike Stanton's avatar
      [Torque] Support JavaScript builtins with fixed args · 93df7ff0
      Mike Stanton authored
      To implement builtin continuations called from the deoptimizer,
      we need to better support writing builtins declared with javascript
      binding in Torque. This CL adds fixed number of argument support.
      So you can declare in Torque, something like:
      
      builtin javascript Foo(context: Context, receiver: Object, bar: Object):
        Object {
        ...
      }
      
      Formerly, this would give you an error because we only supported
      javascript bindings with a varargs array.
      
      Bug: v8:7672
      Change-Id: I5b5b25bdbbd5e054049c39dd2f1a4c606472dcd5
      Reviewed-on: https://chromium-review.googlesource.com/1018941
      Commit-Queue: Michael Stanton <mvstanton@chromium.org>
      Reviewed-by: 's avatarDaniel Clifford <danno@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#52704}
      93df7ff0
  18. 19 Apr, 2018 2 commits
  19. 18 Apr, 2018 1 commit
  20. 16 Apr, 2018 1 commit
    • Daniel Clifford's avatar
      Torque: Implement a DSL for CSA · a3353da8
      Daniel Clifford authored
      An overview of motivation behind Torque and some of its principles
      can be found here: https://bit.ly/2qAI5Ep
      
      Note that there is quite a bit of work left to do in order to get
      Torque production-ready for any non-trivial amount of code, but
      landing the prototype as-is will allow for much faster iteration.
      
      Bugs will be filed for all of the big-ticket items that are not
      landing blockers but called out in this patch as important to fix.
      
      Cq-Include-Trybots: luci.v8.try:v8_linux_nosnap_rel;luci.v8.try:v8_linux_noi18n_rel_ng
      Change-Id: Ib07af70966d5133dc57344928885478b9c6b8b73
      Reviewed-on: https://chromium-review.googlesource.com/845682
      Commit-Queue: Daniel Clifford <danno@chromium.org>
      Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#52618}
      a3353da8