Commit Graph

71 Commits

Author SHA1 Message Date
Jakob Linke
2c7272fdde Rename Code to InstructionStream
.. as part of the big Code/CodeDataContainer name shuffle.  In the
next step, CodeDataContainer will be renamed to Code.

Bug: v8:13654
Change-Id: Ia80ac984d46dd6c2a108098055a5cd60e22a837c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4171628
Auto-Submit: Jakob Linke <jgruber@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#85337}
2023-01-17 12:45:45 +00:00
Michael Achenbach
2c4133a0ce [tools] Clean up Py2 code
Bug: chromium:1292013
Change-Id: I8202fed4d59edcc98fff193f3a4b102a5c79d553
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3525136
Reviewed-by: Liviu Rau <liviurau@chromium.org>
Reviewed-by: Tamer Tas <tmrts@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79505}
2022-03-17 09:05:27 +00:00
Tobias Tebbi
01b809d2fd [torque] fix bug in formatter
Change-Id: I05e7d0776eaa4722c5a5b9820ee6b34d9319d2ce
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3497816
Reviewed-by: Marja Hölttä <marja@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79367}
2022-03-04 13:11:50 +00:00
Michael Achenbach
efd28c14c2 [infra] Make various scripts compatible with Python3
This fixes all Python3 problems in scripts and tests running via
v8_presubmit.py. It includes:
- Test runner
- Release tools
- Perf runner
- Torque formatter
- V8's main presubmit

On bots, v8_presubmit is run with vpython, hence we also add
the required dependencies. After the Python3 migration, most
of the transitional code in this CL can be removed again.

Bug: chromium:1293709,chromium:1292016
Change-Id: Ic25e5965948b212c047e9d5194d2a4b6db1fa91b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3432213
Reviewed-by: Liviu Rau <liviurau@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78936}
2022-02-04 07:17:24 +00:00
Seth Brenith
f30f481525 [torque] Invert the default for @generateCppClass
Since most Torque-defined extern classes use @generateCppClass, it makes
more sense to instead annotate the small number that don't. This is part
of the cleanup work that Nico recommended in [1].

Classes that still have to opt out:

- Those that can be converted by https://crrev.com/c/3015666
- HeapObject: sort of special since it's the root of the inheritance
  hierarchy. Generated code would include two declarations that don't
  compile until HeapObject is defined:
    bool IsHeapObject_NonInline(HeapObject o);
    explicit TorqueGeneratedHeapObject(
        Address ptr, HeapObject::AllowInlineSmiStorage allow_smi);
- SmallOrdered*: these classes use templates on the C++ side, which is
  not currently representable in Torque.
- SwissNameDictionary: according to a comment, the Torque generation for
  this class is incorrect. I haven't investigated further.

Drive-by fix: make the Torque formatter keep LF on Windows rather than
writing CRLF.

[1] https://docs.google.com/document/d/1q_gZLnXd4bGnCx3IUfbln46K3bSs9UHBGasy9McQtHI/edit#

Bug: v8:8952
Change-Id: I1fbb5290f0c645842b84c53816c09bb3398206a5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3028721
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#75841}
2021-07-21 15:21:00 +00:00
Tobias Tebbi
09580ccf49 [torque] fix formatting of derefence and addressof operators
Bug: v8:7793
Change-Id: Ie573b3feef58329d524e51c942b67cf0525963ff
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2300545
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68885}
2020-07-16 10:17:35 +00:00
Tobias Tebbi
45557b1f89 [torque] format namespaces without indentation
Bug: v8:7793
Change-Id: Id2a93f8ac8c512dbc5cdeb43a97e04d8d6684954
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2196130
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67748}
2020-05-12 14:06:17 +00:00
Tobias Tebbi
a3e97c41ff [torque] improve formatting of try-label
Bug: v8:10421, v8:7793
Change-Id: If11fc7666f04ed0914f5fdfcdaa87acb8655d956
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2169100
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67591}
2020-05-06 09:51:39 +00:00
Ng Zhi An
5ae5d70cbc [torque] Fix formatting of tq files with #include
Formatter does not recognize #include, since we format .tq files as TS.
So replace it with a comment first, then substitute it back.

This should also fix the Presubmit in waterfall

https://ci.chromium.org/p/v8/builders/ci/V8%20Presubmit/10296

Change-Id: I316d52fc24e099474c542f75773683b54e8d0a63
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2175089
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67512}
2020-05-01 01:07:19 +00:00
Tobias Tebbi
e0c1ca5a30 [torque] fix formatting of union types
The Torque formatter script did a hack to put spaces arount the | of
union types. This was broken when the inserted comment ended up on the
end of a line. For this reason, and since it doesn't make sense to
fight the Google-wide TypeScript style for union types, this CL reverts
to not putting spaces around union types.

Bug: v8:7793
Change-Id: Ic0acf9e1da82540432a8e21b58497a6a7d523b9c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1871604
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Joshua Litt <joshualitt@chromium.org>
Reviewed-by: Michael Stanton <mvstanton@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64536}
2019-10-24 10:05:25 +00:00
Seth Brenith
8c7ae31456 [torque] Generate instance types
Design doc:
https://docs.google.com/document/d/1ZU6rCvF2YHBGMLujWqqaxlPsjFfjKDE9C3-EugfdlAE/edit

Changes from the design doc:
- Changed to use 'class' declarations rather than 'type' declarations
  for things that need instance types but whose layout is not known to
  Torque. These declarations end with a semicolon rather than having a
  full set of methods and fields surrounded by {}. If the class's name
  should not be treated as a class name in generated output (because
  it's actually a template, or doesn't exist at all), we use the
  standard 'generates' clause to declare the most appropriate C++ class.
- Removed @instanceTypeName.
- @highestInstanceType became @highestInstanceTypeWithinParentClassRange
  to indicate a semantic change: it no longer denotes the highest
  instance type globally, but only within the range of values for its
  immediate parent class. This lets us use it for Oddball, which is
  expected to be the highest primitive type.
- Added new abstract classes JSCustomElementsObject and JSSpecialObject
  to help with some range checks.
- Added @lowestInstanceTypeWithinParentClassRange so we can move the new
  classes JSCustomElementsObject and JSSpecialObject to the beginning of
  the JSObject range. This seems like the least-brittle way to establish
  ranges that also include JSProxy (and these ranges are verified with
  static assertions in instance-type.h).
- Renamed @instanceTypeValue to @apiExposedInstanceTypeValue.
- Renamed @instanceTypeFlags to @reserveBitsInInstanceType.

This change introduces the new annotations and adds the ability for
Torque to assign instance types that satisfy those annotations. Torque
now emits two new macros:
- TORQUE_ASSIGNED_INSTANCE_TYPES, which is used to define the
  InstanceType enumeration
- TORQUE_ASSIGNED_INSTANCE_TYPE_LIST, which replaces the non-String
  parts of INSTANCE_TYPE_LIST

The design document mentions a couple of other macro lists that could
easily be replaced, but I'd like to defer those to a subsequent checkin
because this one is already pretty large.

Bug: v8:7793
Change-Id: Ie71d93a9d5b610e62be0ffa3bb36180c3357a6e8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1757094
Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Sathya Gunasekaran  <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64258}
2019-10-11 22:37:22 +00:00
Tobias Tebbi
1ef99b93cc Reland "[torque] introduce JSAny type for user-accessible JavaScript values"
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 4418a7b96a.

Original change's description:
> Revert "[torque] introduce JSAny type for user-accessible JavaScript values"
>
> This reverts commit 79b00555ea.
>
> 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: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63395}
2019-08-26 13:25:12 +00:00
Tobias Tebbi
4418a7b96a Revert "[torque] introduce JSAny type for user-accessible JavaScript values"
This reverts commit 79b00555ea.

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}
2019-08-07 11:49:20 +00:00
Tobias Tebbi
79b00555ea [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}
2019-08-07 11:44:18 +00:00
Seth Brenith
f89d4e120c Don't write formatted tq files if nothing changed
This will prevent unnecessary recompilation effort on the subsequent
build, and avoids a common issue on Windows where format-torque replaces
all of the line endings in a .tq file without changing any actual
content.

Bug: v8:8805
Change-Id: Id695351c242739d92aef47cd09e651bfbe3c8f9a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1673456
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Tamer Tas <tmrts@chromium.org>
Commit-Queue: Tamer Tas <tmrts@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62357}
2019-06-25 12:16:21 +00:00
Seth Brenith
e620ba139b [torque] Address remaining usages of @noVerifier in base.tq
For every @noVerifier in base.tq, this change either removes it or
ensures that it has some annotation explaining why it can't be removed.
The @noVerifier usages that can't be removed fall into the following
categories:
1. Classes that don't have their own instance types and therefore have
   no meaningful way to do an Is...() check
2. Fields that might not exist
3. Fields that are waiting for MaybeObject support in Torque

Bug: v8:9311
Change-Id: Id452d4151ec07347ae96a9b5f3b26e2ac8065d31
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1659134
Reviewed-by: Daniel Clifford <danno@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#62263}
2019-06-18 22:44:58 +00:00
Tobias Tebbi
bd0b0ce8e9 Reland "[torque] introduce separate implicit parameters for JavaScript calling convention"
This is a reland of 6eff6cc9f0

Original change's description:
> [torque] introduce separate implicit parameters for JavaScript calling convention
>
> Implicit parameters for builtins with JavaScript linkage are now separate, using
> the keyword "js-implicit". They have to be one of:
> - context: Context
> - receiver: Object (this in JS)
> - target: JSFunction (arguments.callee in JS)
> - newTarget: Object (new.target in JS)
>
> Bug: v8:9120 v8:7793
>
> Change-Id: I916f60971bb53d5046b6006725d0ce39291ca55e
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1658159
> Reviewed-by: Tamer Tas <tmrts@chromium.org>
> Reviewed-by: Simon Zünd <szuend@chromium.org>
> Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
> Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#62174}

TBR=tmrts@chromium.org

Bug: v8:9120 v8:7793
Change-Id: Idb25d316d9d87e345ab74c2df583ff2648da012c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1660483
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62182}
2019-06-14 14:02:13 +00:00
Yang Guo
4fb050565a Revert "[torque] introduce separate implicit parameters for JavaScript calling convention"
This reverts commit 6eff6cc9f0.

Reason for revert: Presubmit failure.

Original change's description:
> [torque] introduce separate implicit parameters for JavaScript calling convention
> 
> Implicit parameters for builtins with JavaScript linkage are now separate, using
> the keyword "js-implicit". They have to be one of:
> - context: Context
> - receiver: Object (this in JS)
> - target: JSFunction (arguments.callee in JS)
> - newTarget: Object (new.target in JS)
> 
> Bug: v8:9120 v8:7793
> 
> Change-Id: I916f60971bb53d5046b6006725d0ce39291ca55e
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1658159
> Reviewed-by: Tamer Tas <tmrts@chromium.org>
> Reviewed-by: Simon Zünd <szuend@chromium.org>
> Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
> Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#62174}

TBR=sigurds@chromium.org,tebbi@chromium.org,tmrts@chromium.org,szuend@chromium.org

Change-Id: Ide206788745bd15677bd60fe32d2476321967069
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:9120 v8:7793
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1660482
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62175}
2019-06-14 12:15:49 +00:00
Tobias Tebbi
6eff6cc9f0 [torque] introduce separate implicit parameters for JavaScript calling convention
Implicit parameters for builtins with JavaScript linkage are now separate, using
the keyword "js-implicit". They have to be one of:
- context: Context
- receiver: Object (this in JS)
- target: JSFunction (arguments.callee in JS)
- newTarget: Object (new.target in JS)

Bug: v8:9120 v8:7793

Change-Id: I916f60971bb53d5046b6006725d0ce39291ca55e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1658159
Reviewed-by: Tamer Tas <tmrts@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62174}
2019-06-14 12:02:58 +00:00
Simon Zünd
8dcf591ffc [torque] Remove VSCode Torque extension from tools/
The extension moved to a separate Github repository found at:
https://github.com/v8/vscode-torque

The extension is best installed via the VSCode Marketplace:
https://marketplace.visualstudio.com/items?itemName=v8-torque.vscode-torque

R=tebbi@chromium.org

Bug: v8:8880
Change-Id: I38e1bc7c912002b37d367beac10fb57c58763844
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1640198
Auto-Submit: Simon Zünd <szuend@chromium.org>
Reviewed-by: Tamer Tas <tmrts@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61972}
2019-06-03 21:10:39 +00:00
Tobias Tebbi
0dc9b63ed3 [torque] explicit exports of macros to CSA
Macros are now inaccessible from CSA except if their declaration is
marked with the "export" keyword. The implicit field accessors for class
fields are always exported.

In this CL, unwarranted access from CSA is prevented by appending a
pseudo-random suffix to non-exported names. This is to be replaced by
something more principled, namely by not including these macros at all in
the headers included from CSA.

Bug: v8:7793
Change-Id: I3ffb2e91a616623f81b4b4508e001ad0cf65d2c2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1615258
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61672}
2019-05-20 22:53:35 +00:00
Michael Achenbach
2c355e54d8 Revert "[torque] Convert few class layout to torque and updated torque code formatter."
This reverts commit b9bfd006f6.

Reason for revert: 
The updated formatter violates some existing files that now require
new formatting:
https://ci.chromium.org/p/v8/builders/ci/V8%20Presubmit/4411

Original change's description:
> [torque] Convert few class layout to torque and updated torque code formatter.
> 
> 1. Converted Module, JSModuleNameSpace, JSCollator, JSV8BreakIterator,
>       TemplateList,
>       JSStrictArgumentsObject to torque.
> 2. Updated torque code formatter to now handle multi-line
>             declarations correctly.
> 
> Bug: v8:8952
> Change-Id: I97846b1bc0d2cba5d7a68468fc263423b1b55d19
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1536988
> Reviewed-by: Simon Zünd <szuend@chromium.org>
> Commit-Queue: Suraj Sharma <surshar@microsoft.com>
> Cr-Commit-Position: refs/heads/master@{#61624}

TBR=jgruber@chromium.org,tebbi@chromium.org,surshar@microsoft.com,szuend@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: v8:8952
Change-Id: I98424deb8002ba9b92262c4b7a1f753bd7c4f7c9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1617927
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61629}
2019-05-18 21:29:56 +00:00
Suraj Sharma
b9bfd006f6 [torque] Convert few class layout to torque and updated torque code formatter.
1. Converted Module, JSModuleNameSpace, JSCollator, JSV8BreakIterator,
      TemplateList,
      JSStrictArgumentsObject to torque.
2. Updated torque code formatter to now handle multi-line
            declarations correctly.

Bug: v8:8952
Change-Id: I97846b1bc0d2cba5d7a68468fc263423b1b55d19
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1536988
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Suraj Sharma <surshar@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#61624}
2019-05-17 19:04:18 +00:00
Seth Brenith
15a7e04eec [torque] Move Map layout definition to Torque
This commit attempts to change as little behavior as possible, but it
does require reordering the fields within Map to abide by Torque rules
specifying that strong and weak fields must be in separate sections.

Also includes some Torque compiler updates:
- Allow enums (types extending from integral types) as class fields
- Rename @ifdef to @if and add @ifnot for inverse checks
- Allow void fields in class declarations, which take up no space and
  emit no accessors

Bug: v8:8952
Change-Id: I1de6f34c1b15ed87d718666a05176980a218e97c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1480919
Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61588}
2019-05-16 19:39:37 +00:00
Daniel Clifford
2f21f07e41 [torque] Detect overflow in indexed field allocation
Also cleanup variable class size calculation for 'new'
statements as well as spread-based indexed field
initialization in Torque rather than in hand-written
ImplementationVisitor code. This is done with new
%-intrinsics. With this change, %-intrinsics can also
have bodies, in which case they are treated as macros.

Bug: v8:7793
Change-Id: I012d57166761688747eb683cb618263e8d0953db
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1554695
Commit-Queue: Daniel Clifford <danno@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61585}
2019-05-16 15:36:33 +00:00
Nico Hartmann
9105e5e8a5 [torque-language-server] Add 'new' keyword to syntax highlighting
Bug: v8:8880
Change-Id: I5bd99ca56dfafa71718b12078224bdc90bcfed14
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1613246
Commit-Queue: Nico Hartmann <nicohartmann@google.com>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61529}
2019-05-15 13:36:22 +00:00
Simon Zünd
82103a954e [cleanup] Remove dead ANTLR build script for Torque parser
This CL removes a build script that was used to create ANTLR visitors
for Torque parsing. As Torque rolls its own parser now, this script
can safely be removed.

R=tebbi@chromium.org

Bug: v8:9183
Change-Id: Id56ee590d79e5c849ac111e8825cd3733cd55d90
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1587379
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61069}
2019-04-29 09:01:36 +00:00
Sigurd Schneider
79faf99b53 [torque] Improve syntax highlighting
This CL fixes an issue where a comment was not highlighted correctly
after a class definition.

Bug: v8:7793
Notry: true
Change-Id: I378a1373c8f4a6c8d48c4bb2ee4a4c3b39b2341f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1585733
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Auto-Submit: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61067}
2019-04-29 08:31:26 +00:00
Tobias Tebbi
438eee8493 [torque-ls] add option to trace communication from client
Bug: v8:8880
Change-Id: I835c465ccb63bcc20e9ec9cafda153a49de2bf7d
Reviewed-on: https://chromium-review.googlesource.com/c/1497010
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60010}
2019-03-04 14:43:02 +00:00
Simon Zünd
7eae3a63bf [torque] Update README.md for the extension to include build step
R=mathias@chromium.org

Bug: v8:8880
Change-Id: I6954ede6669f19d970ad4257fa4699da2db62fd3
Reviewed-on: https://chromium-review.googlesource.com/c/1495982
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59969}
2019-03-01 12:33:35 +00:00
Simon Zünd
9911fd13cc [torque-ls] Add prototype language server implementation for Torque
Design Doc: https://goo.gl/9G9d9k

The initial prototype consists of a few parts:

The VS Code extension is now built using TypeScript. The build artifact
is checked-in along side the extension. The extension now starts up
the language server when it is activated. The path to the LS
executable is configurable via VS Code settings.

The language server is a separate executable. It adds a light-weight
object model on top of a Json Parser for reading/writing LSP requests
and responses. The current server is very much bare-bones featurewise:
    - Tell the client that the server can handle "goto definition"
    - Recompile when Torque files change
    - Goto definition support for Macros/Builtins, local variables
      and arguments.

R=mathias@chromium.org, mvstanton@chromium.org, tebbi@chromium.org

Bug: v8:8880
Change-Id: Ie9b433e64ee63e9aa757b6bf71e5d52beb15b079
Reviewed-on: https://chromium-review.googlesource.com/c/1494354
Reviewed-by: Michael Stanton <mvstanton@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59960}
2019-03-01 09:30:47 +00:00
Z Duong Nguyen-Huu
04bb510c4e Reland "Make format torque tools work on win"
This is a reland of 1fdf64059d

Original change's description:
> Make format torque tools work on win
>
> Reformatting Torque file is required to upload a CL
> but it can only work on POSIX
>
> Change-Id: I51283e3f6b29abf492be7efb5b8f10454d09fb37
> Reviewed-on: https://chromium-review.googlesource.com/c/1475919
> Reviewed-by: Michael Stanton <mvstanton@chromium.org>
> Commit-Queue: Michael Stanton <mvstanton@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#59719}

Change-Id: I09a19a9989091205eb413fd60b2e8bec289092fd
Reviewed-on: https://chromium-review.googlesource.com/c/1479530
Commit-Queue: Michael Stanton <mvstanton@chromium.org>
Reviewed-by: Michael Stanton <mvstanton@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59748}
2019-02-21 03:37:26 +00:00
Sigurd Schneider
3b0c4a413c Revert "Make format torque tools work on win"
This reverts commit 1fdf64059d.

Reason for revert: Alters behavior on linux; we need to investigate

Original change's description:
> Make format torque tools work on win
> 
> Reformatting Torque file is required to upload a CL
> but it can only work on POSIX
> 
> Change-Id: I51283e3f6b29abf492be7efb5b8f10454d09fb37
> Reviewed-on: https://chromium-review.googlesource.com/c/1475919
> Reviewed-by: Michael Stanton <mvstanton@chromium.org>
> Commit-Queue: Michael Stanton <mvstanton@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#59719}

TBR=mvstanton@chromium.org,bmsdave@gmail.com,duongn@microsoft.com

Change-Id: I8845fa1d1ddf5ce841a84ef59c9572673e4a2510
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/1478199
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59736}
2019-02-20 14:13:53 +00:00
Z Duong Nguyen-Huu
1fdf64059d Make format torque tools work on win
Reformatting Torque file is required to upload a CL
but it can only work on POSIX

Change-Id: I51283e3f6b29abf492be7efb5b8f10454d09fb37
Reviewed-on: https://chromium-review.googlesource.com/c/1475919
Reviewed-by: Michael Stanton <mvstanton@chromium.org>
Commit-Queue: Michael Stanton <mvstanton@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59719}
2019-02-20 07:32:22 +00:00
Vadim Gorbachev (bmsdave)
7315d7b3d7 Preparing v8 to use with python3 /tools
There are now less that 400 days until the end of life
of Python 2(aka _legacy_ Python) https://pythonclock.org/ .
The code compatibility check for python2 and python3
used the following tools: futurize, flake8
You can see the reports here: https://travis-ci.com/bmsdave/v8/builds

This CL was uploaded by git cl split.

Bug: v8:8594
Change-Id: I661c52a70527e8ddde841fee6d4dcba282b4a938
Reviewed-on: https://chromium-review.googlesource.com/c/1470123
Commit-Queue: Sergiy Belozorov <sergiyb@chromium.org>
Reviewed-by: Sergiy Belozorov <sergiyb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59675}
2019-02-19 09:12:07 +00:00
Tamer Tas
bb909b5af5 [tools] auto-format unformatted Torque source files
Presubmit script complains when an unformatted Torque file is submitted.

This CL automates the formatting process of the Torque files.

Presubmit script is run before every 'git cl upload', the workflow will make
sure that the upload is canceled, but the files are formatted.

Bug: chromium:898436, v8:8805
Change-Id: I821ce36907c62e222451e883c5e3e18a9359f20e
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/1458222
Reviewed-by: Daniel Clifford <danno@chromium.org>
Reviewed-by: Sergiy Belozorov <sergiyb@chromium.org>
Commit-Queue: Tamer Tas <tmrts@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59453}
2019-02-08 11:51:37 +00:00
Tobias Tebbi
7d0bd08854 [torque] improve VSCode syntax highlighting more
- fix highliting of extends clause in types
- label constants as constants

Change-Id: Iad1682a5c294dc1999067f4e43feb4aada7e1ced
Reviewed-on: https://chromium-review.googlesource.com/c/1451924
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59338}
2019-02-04 13:25:58 +00:00
Tobias Tebbi
142225ac9e [torque] improve VSCode syntax highlighting
Change-Id: Iec5d7b2c73b45012d3bc457f0928c7f39afc8815
Reviewed-on: https://chromium-review.googlesource.com/c/1446454
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59227}
2019-01-31 09:20:45 +00:00
Tobias Tebbi
76394d6b34 [torque] add general down-cast intrinsic
Bug: v8:7793
Change-Id: If79b3d760406e44530da5656459ece6db3eff7ab
Reviewed-on: https://chromium-review.googlesource.com/c/1435935
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Michael Stanton <mvstanton@chromium.org>
Reviewed-by: Daniel Clifford <danno@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59098}
2019-01-25 14:16:33 +00:00
Daniel Clifford
32a92cf594 [torque] Correctly support JSObject allocation with 'new'
This requires honoring the instance size of the object stored in the
map for JSObject. To do this, allocation is now split into two
instrinsics, one that calculates the base size of the allocated object
(%GetAllocationBaseSize) and one that actually allocates (%Allocate).

In the process, remove objects.tq, which only existed to contain a
macro to fetch the default JSObject map, which is functionality that
is now in the JSObject class constructor.

Bug: v8:7793
Change-Id: I426a7943aac67eacad46d4ff39f5c821489a04bc
Reviewed-on: https://chromium-review.googlesource.com/c/1426959
Commit-Queue: Daniel Clifford <danno@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59052}
2019-01-24 06:27:56 +00:00
Tobias Tebbi
752882fd3d [torque] add "struct" keyword to VS Code plugin
TBR: szuend@chromium.org

Change-Id: Ifef721eecab79dbcfb306dd241b3476fc1b6ec56
Reviewed-on: https://chromium-review.googlesource.com/c/1424952
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58971}
2019-01-21 16:42:33 +00:00
Daniel Clifford
b615dfa550 [torque] Implement methods and constructors for structs and classes
With the changes in this patch,	it is now possible to add methods to
both Torque's class and struct types. As a special case, "constructor"
methods are used to initialize the values of classes and structs when
they are constructed.

The functionality in this patch	includes:

- The refactoring of class- and struct-handling code to share field
  and method declaration code between both.

- Addition of the "%Allocate" intrinsic that allocates raw bytes to be
  allocated from the V8 GC's NewSpace heap as the basis for freshly
  created, initialized class objects.

- An implementation of a CallMethodExpression AST node that enables
  calling methods and constructors, including special handling of
  passing through the "this" pointer for method calls on structs by
  reference. The syntax for struct construction using "{}" remains as
  before, but now calls the struct's matching constructor rather than
  implicitly initializing the struct fields with the initialization
  arguments. A new syntax for allocation classes is introduced: "new
  ClassName{constructor_param1, constructor_param1, ...}", which
  de-sugars to an %Allocate call followed by a call to the matching
  constructor.

- class	constructors can use the "super" keyword to initialize	their
  super class.

- If classes and struct do not have a constructor, Torque creates a
  default constructor for them based on their field declarations,
  where each field's initial value is assigned to a same-typed
  parameter to the the default constructor. The default constructor's
  parameters are in field-declaration order, and for derived classes,
  the default constructor automatically uses a "super" initialization
  call to initialize inherited fields.

- Class field declarations now automatically create ".field" and
  ".field=" operators that create CSA-compatible object accessors.

- Addition of a no-argument constructor for JSArrays that creates an
  empty, PACKED_SMI_ELEMENTS JSArray using the machinery added
  elsewhere in this patch.

Bug: v8:7793
Change-Id: I31ce5f4b444656ab999555d780aeeba605666bfa
Reviewed-on: https://chromium-review.googlesource.com/c/1392192
Commit-Queue: Daniel Clifford <danno@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58860}
2019-01-16 17:13:13 +00:00
Daniel Clifford
d0e95c7a1a [torque]: Class declarations
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: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58704}
2019-01-10 14:32:50 +00:00
Daniel Clifford
79605b4508 [torque] Add new and refine existing Torque intrinsic support
Intrinsic changes:

- Rename %RawCast to %RawObjectCast and add error checking so that it
  only applies to subtypes of Objects.

- Add %RawPointerCast, which is similar to %RawObjectCast but must be
  used for all subtypes of RawPtr.

- Add %RawConstexprCast, which allows one constexpr to be be cast to
  another at compile time. It translate to an appropriate static_cast
  in the generated code

- Add %FromConstexpr, which handles most of the standard cases of
  generating XXXConstant CSA nodes from constexpr constants. It uses
  either SmiConstant, NumberConstant, StringConstant, IntPtrConstant
  or Int32Constant, depending on the cast-to type generic <To> type.

- Add support for intrinsics that return constexpr results.

Cleanup:

- Turn FromConstexpr into a generic with two generic types, a <To> and
  a <From> type. Most FromConstexpr can use the new %FromConstexpr
  intrinsic rather than provide an explicit implementation.

Bug: v8:7793
Change-Id: Icab5db16d203034ec157fa3ad5157d10c7dc8464
Reviewed-on: https://chromium-review.googlesource.com/c/1357049
Commit-Queue: Daniel Clifford <danno@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58049}
2018-12-05 19:06:56 +00:00
Daniel Clifford
c098b96ce9 Reland "[torque] Implement intrinsics support"
This is a reland of 74a0ad7dda

Original change's description:
> [torque] Implement intrinsics support
> 
> Also add the first intrinsic and usage of it: %RawCast
> 
> Bug: v8:7793
> Change-Id: Id1e3288e8bab6adb510731076a39590e8fd156be
> Reviewed-on: https://chromium-review.googlesource.com/c/1344152
> Commit-Queue: Daniel Clifford <danno@chromium.org>
> Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#57692}

Bug: v8:7793
Change-Id: I315c7d44f265d0f937598e8afb1c28b08d6a23da
Reviewed-on: https://chromium-review.googlesource.com/c/1347472
Reviewed-by: Daniel Clifford <danno@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57715}
2018-11-22 08:59:39 +00:00
Tobias Tebbi
621de4bd2c Revert "[torque] change formatter to emit LF newlines on Windows"
This reverts commit d8c471ffa1.

Reason for revert: breaks waterfall

Original change's description:
> [torque] change formatter to emit LF newlines on Windows
> 
> Otherwise, it will always replace LF with CRLF, which is not what you
> want if you follow the Chromium instructions for Windows, that is,
> configure git with core.autocrlf = false.
> 
> Change-Id: I30fcfc471cde79d5c80d05ce582a8507cf5810b5
> Reviewed-on: https://chromium-review.googlesource.com/c/1345150
> Reviewed-by: Daniel Clifford <danno@chromium.org>
> Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#57691}

TBR=danno@chromium.org,tebbi@chromium.org

Change-Id: Ib30ae0d5b1803dbe8e6e8a0928cc41a6ce2d2bb8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/1346502
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57695}
2018-11-21 18:06:29 +00:00
Daniel Clifford
4685349480 Revert "[torque] Implement intrinsics support"
This reverts commit 74a0ad7dda.

Reason for revert: Presubmit tests fail

Original change's description:
> [torque] Implement intrinsics support
> 
> Also add the first intrinsic and usage of it: %RawCast
> 
> Bug: v8:7793
> Change-Id: Id1e3288e8bab6adb510731076a39590e8fd156be
> Reviewed-on: https://chromium-review.googlesource.com/c/1344152
> Commit-Queue: Daniel Clifford <danno@chromium.org>
> Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#57692}

TBR=danno@chromium.org,tebbi@chromium.org

Change-Id: Ief78187f2edaf80c715dea676cbd40edd747ad21
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:7793
Reviewed-on: https://chromium-review.googlesource.com/c/1346500
Reviewed-by: Daniel Clifford <danno@chromium.org>
Commit-Queue: Daniel Clifford <danno@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57694}
2018-11-21 16:28:12 +00:00
Daniel Clifford
74a0ad7dda [torque] Implement intrinsics support
Also add the first intrinsic and usage of it: %RawCast

Bug: v8:7793
Change-Id: Id1e3288e8bab6adb510731076a39590e8fd156be
Reviewed-on: https://chromium-review.googlesource.com/c/1344152
Commit-Queue: Daniel Clifford <danno@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57692}
2018-11-21 16:04:03 +00:00
Tobias Tebbi
d8c471ffa1 [torque] change formatter to emit LF newlines on Windows
Otherwise, it will always replace LF with CRLF, which is not what you
want if you follow the Chromium instructions for Windows, that is,
configure git with core.autocrlf = false.

Change-Id: I30fcfc471cde79d5c80d05ce582a8507cf5810b5
Reviewed-on: https://chromium-review.googlesource.com/c/1345150
Reviewed-by: Daniel Clifford <danno@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57691}
2018-11-21 15:42:03 +00:00
Tobias Tebbi
00ffe4a613 [torque] enable multiple inheritance from Torque-generated assemblers
This enables more seamless interop between Torque and CSA:

Since CodeStubAssembler can now inherit from the Torque base namespace,
macros defined in the base namespace can be used in CodeStubAssembler
macros, even without qualification.
At the same time, macros in the base namespace can refer to
CodeStubAssembler macros. The only new limitation is that types defined
in code-stub-assembler.h cannot be referenced in the signature of macros
defined in the base namespace, since this would produce a cyclic header
dependency. A work-around for this woud be to put such types (like int31
in this CL) into a separate header included by both. I (mis-)used
code-assembler.h for that.
Another side-effec is that types and enums defined in CodeStubAssembler
have to be accessed in a qualified way from Torque.

Other assemblers can now inherit from their Torque equivalent, so
porting macros into the corresponding Torque namespace doesn't require
any change to the existing use-sites.

To avoid C++ ambiguities, the Torque-generated assemblers must not define
anything also defined in Code(Stub)Assembler. This includes the type
aliases for TNode, PLabel, ...
My workaround is to qualify everything in the generated C++.

As a drive-by fix, I had to change the formatter to avoid a situation
where it doesn't compute a fixed point: putting a keyword at the
beginning of a line removes the '\s' in front of it, so I replaced that
with '\b'.

Bug: v8:7793
Change-Id: If3b9e9ad967a181b380a10d5673615606abd1041
Reviewed-on: https://chromium-review.googlesource.com/c/1341955
Reviewed-by: Daniel Clifford <danno@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57645}
2018-11-20 13:33:36 +00:00