Commit Graph

104 Commits

Author SHA1 Message Date
Daniel Clifford
3d2cb0b4ae [torque]: Implement Generics for Builtins and Macros
Including specialization, e.g.:

  // Declare parameterized generic
  macro GenericMacroTest<T: type>(param: T): Object {
    return Undefined;
  }

  // Declare specialization of generic
  GenericMacroTest<Object>(param: Object): Object {
    return param;
  }

  ...
  assert(GenericMacroTest<Smi>(0) == Undefined);
  assert(GenericMacroTest<Smi>(1) == Undefined);
  assert(GenericMacroTest<Object>(Null) == Null);
  assert(GenericMacroTest<Object>(False) == False);
  ...

Known issue: specialization doesn't rigorously checked to verify
that specialization signature precisely matches generic declaration.

Change-Id: I9d9d96da4c5c8c9a76550844680e9e133a5edaed
Reviewed-on: https://chromium-review.googlesource.com/1043986
Commit-Queue: Daniel Clifford <danno@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53203}
2018-05-16 10:29:48 +00:00
Simon Zünd
a410e9e441 [torque] Emit labels only if they are used.
This CL changes the generated C++ code for LabeledStatementBlocks to
only emit labels if they are used.

Prior to this CL, when a label was only used on one path of an
if constexpr expression, and not at all anywhere else,
the try/label construct would BIND a label that was not used,
causing a CSA verification error.

R=tebbi@chromium.org

Change-Id: Ia81a0cd081b84528c95bbdbdb98b9ab51928e13f
Reviewed-on: https://chromium-review.googlesource.com/1057247
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Daniel Clifford <danno@chromium.org>
Commit-Queue: Simon Zünd <szuend@google.com>
Cr-Commit-Position: refs/heads/master@{#53173}
2018-05-15 08:29:33 +00:00
peterwmwong
e6238be3cb [torque]: Fix Labels with multiple parameters
Change-Id: I37ed9115c099f3d17f23a26348a1bbf5f773ee32
Reviewed-on: https://chromium-review.googlesource.com/1056668
Reviewed-by: Daniel Clifford <danno@chromium.org>
Commit-Queue: Peter Wong <peter.wm.wong@gmail.com>
Cr-Commit-Position: refs/heads/master@{#53136}
2018-05-13 17:07:25 +00:00
Daniel Clifford
5f920f770d [torque]: Add the ability to test Torque functionality with cctest
In the process, add a few simple tests for "constexpr" expressions, which
identified a few bugs that are also fixed in this CL.

Change-Id: I97486c781572642d2b574b92133b1f9cda3db592
Reviewed-on: https://chromium-review.googlesource.com/1055493
Commit-Queue: Daniel Clifford <danno@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53135}
2018-05-13 10:58:56 +00:00