GVN pure stringifiers and string concatenation.
I removed the comment regarding #9293. I could not understand it.
Removing the 'setDependsOnSomething()' does occasionally produce
worse-looking code, but at the application level, the code is
marginally smaller.
https://github.com/dart-lang/sdk/issues/48243 is a more general
description of the 'looks better' problem that pure operations tend to
sink to their use, increasing live-ranges of the operands. The
sinking is sometimes advantageous - e.g. when the new location is on
an error path.
I see common subexpression elimination often in the pattern of
constructing default strings for Intl.plural:
Intl.plural(...,
one: '$first (+$howManyMore language)',
other: '$first (+$howManyMore languages)',
...);
--> old JavaScript
var
t1 = A.S(first) + " (+" + howManyMore + " language)",
t2 = A.S(first) + " (+" + howManyMore + " languages)";
return A.Intl__plural(..., t1, t2, ...);
--> new JavaScript
var
t1 = A.S(first) + " (+" + howManyMore;
return A.Intl__plural(..., t1 + " language)", t1 + " languages)", ...);
Change-Id: I56aff26c9e5e31954fef224378f3723a05b318ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233641
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This CL add support for introspecting members added in Phase 2 from
one macro application to the next.
Included is a refactoring of the class/member patching where the
origin now owns the patches similar to how library patching now
works.
Change-Id: Ifdf03461d66be3f5a5df4b5bdb1e3da9f4cfd688
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233462
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This CL
* Makes :async_op only have two parameters: We take advantage
of the fact that errors not only have exception != null but
also stacktrace != null.
* Makes :async_op have no optional parameters. This reduces
code size significantly.
* Removes unused parameter in _awaitHelper calls
* Wrap the then callback instead of the error callback. (needed
to make optional parameters required)
This results in 2% code savings on a big g3 app.
The size of :async_op shrinks on average by 11%
TEST=ci
Change-Id: I38d5fba4ebebc780b48dac5aa6a250d2c7952bfd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233362
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Results of Phase 2 macros are now applied. The macro application code
has been refactored to support that Phase 1 can apply all macro
applications within a library in bulk, but Phase 2 can apply each
macro application in sequence.
The later is to prepare for making added member visible to subsequent
macro applications within Phase 2. This functionality has not been
completed yet.
Change-Id: Idaf2702e21bde75aedb1509d88e02f270196af5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233380
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This also:
- Adds support to the bootstrap code to handle communicating via sendPort or stdio
- Refactors pretty heavily the isolate executor code such that it can be reused.
- Refactors the isolated executor test into a shared test for all executors
- Removes the mirror based executor entirely - I don't see a path forward with this one.
- Reorganizes all executor based files under macros/executor
Change-Id: I2fc6bb3e6ce56c8b331719f4dc08617b3a521398
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233200
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
We can reuse the existing "resolved" AST printer here.
One possible deficiency in the existing implementation is that it
sorts children by name, does not print them in their syntactic
positions, i.e. for `(var a)` we should print `keyword: var`,
and then `identifier: a`. The reason for this sorting is that
implementation adds properties from superclasses later, and there
is no correct positions for it.
Of course we have `childrenEntities`, which are sorted correctly,
but they lack names. Maybe if we added a new API with names, we
could use it here.
Ah, another issue is resolution information, e.g. `staticElement`,
`staticType` - these don't have the right syntactic position. We
could add them after syntactic entities, this is probably not worse
than what we have now.
Change-Id: I1354556acd69afdce7da712ce10d1a1fc724871b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232687
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This way, instead of implicit result that the given node is a
SimpleIdentifier and requiring a cast in the client, or a
PrefixedIdentifier - so we have to check whether it is one or another
again; we now prove the result by returning the actual value, not
just a flag.
Change-Id: I65f0a21e5d3c1e7be06e621a0f7fb6a5e6b2db2d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232780
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Without this change, any linked edit groups that fall between the offset and offset+length of the new edit are not updated, which means new edits can be inserted that overlap with the linked edit groups instead of pushing them along by the delta.
Change-Id: If3e60bfa1efa4736f91bb85eb29cd785e933e78c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232099
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This adds support for the generating a synthesized augmentation
library for each library in which phase 1 macros were applied.
Current implementation piggybacks on the patch library support. The
intension is that both patches and augmentations are handled through
the same general mechanism. For now, the wording refers to augmentation
libraries as patch libraries where the implementation is shared.
Testing is extended to verify that the generated classes are
included in the resulting AST.
Change-Id: Ie0d4cfdc84b55ca87e0014794f14b38e442f08eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233101
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
- Support TransferableTypedData in the bootstrap code and IsolatedExecutor.
- Also removed the fake executor and conditional import. Mode will likely be chosen based on factors other than just the availability of `dart:isolate`.
- Run the tests in both serialization modes.
Change-Id: I5c731d192c0d3a8cdc5f7fb900dc07a32f4f4d51
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232981
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>