Commit Graph

447 Commits

Author SHA1 Message Date
Johnni Winther 6931a7a288 Use [localFunctionNeedsSignature] to determine when to add JSignatureMethod
Closes #32078

Change-Id: Ib1c9c08b1fdf33e3d94c02595135cf430357fed6
Reviewed-on: https://dart-review.googlesource.com/43742
Reviewed-by: Emily Fortuna <efortuna@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-02-27 12:33:53 +00:00
Aske Simon Christensen bb088347f0 Separate severity for context messages
Change-Id: I8c0f9f0eae141e38e1f57afce4a30b6f95e8e412
Reviewed-on: https://dart-review.googlesource.com/43721
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2018-02-26 16:24:13 +00:00
Johnni Winther 011cd01875 Handle local initializers in constant constructors
Change-Id: Ifcbaf4b19f4411cd499db35242523eea215c77c4
Reviewed-on: https://dart-review.googlesource.com/40820
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-02-26 10:04:58 +00:00
Johnni Winther 7c2d96490d Support forwarding bounds in function type variables
Change-Id: Ifeab9ad06f512d9b6a5db02fc89d45250c25c054
Reviewed-on: https://dart-review.googlesource.com/40821
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-02-26 09:45:56 +00:00
Sigmund Cherem 04095f7cee Replace PrimitiveValue.primitiveValue by individual fields on the concrete
primitive classes (intValue, doubelValue, etc).

(This is step 1 of ?? to support int64, see https://github.com/dart-lang/sdk/issues/31788)

Change-Id: I3fa3a69761d332640b03416e883d57fef0819e2f
Reviewed-on: https://dart-review.googlesource.com/41923
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-02-21 17:25:27 +00:00
Sigmund Cherem d0c3e48a5f Add dart2js-with-kernel to the CQ
This is blocked on first landing the change to the dart2js_swarming recipe.

R=whesse@google.com,athom@google.com

Change-Id: Id7c26499cbb3d5337d6c72c10a688dd22d60dd78
Reviewed-on: https://dart-review.googlesource.com/41580
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2018-02-16 23:46:57 +00:00
Johnni Winther f2b8cafb44 Handle assert in initializers of constant constructors.
Change-Id: Ibb4053af00392b3c43177c60c8551cc6ffe937eb
Reviewed-on: https://dart-review.googlesource.com/38320
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-02-13 14:00:01 +00:00
Johnni Winther d30aaaa4b8 Ensure no type parameters on constructors.
Change-Id: I6a40e2f74b8a89e5873d94d406a56f82db0d0b48
Reviewed-on: https://dart-review.googlesource.com/40526
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-02-13 11:11:05 +00:00
Johnni Winther b7ef215604 Ensure no function type variables on constructors
Closes #32069

Change-Id: I9e8e35aad7844863717d19d6335da87b9c823375
Reviewed-on: https://dart-review.googlesource.com/39700
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-02-08 09:09:09 +00:00
Emily Fortuna ef3c271542 Generate signature function in strong mode (previously was behind a flag).
Change-Id: Ia99623beb4f5cbba719833af2d710702d2caaa6d
Reviewed-on: https://dart-review.googlesource.com/38902
Commit-Queue: Emily Fortuna <efortuna@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-02-07 23:02:40 +00:00
Sigmund Cherem 5428a12b84 Ensure that env includes the actual mixin application fields and procedures.
From the docs of mixedInClass and mixin: the former is the direct thing that is
mixed in, but if it is a named mixin application it may not contain the actual
fields and procedures, instead the `.mixin` class does.

Change-Id: I049ced771925431d613b0b661154c1761fbe0a51
Reviewed-on: https://dart-review.googlesource.com/38161
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Emily Fortuna <efortuna@google.com>
2018-02-02 07:10:30 +00:00
Sigmund Cherem 3b6d39cc2c Correctly defer typedef references
Change-Id: I61fb5ebb399dcfca5193b7ae870badc10add23e5
Reviewed-on: https://dart-review.googlesource.com/37880
Reviewed-by: Emily Fortuna <efortuna@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-01-31 21:10:29 +00:00
Johnni Winther ffd18a37ef Track type arguments of static and dynamic calls
- and use these to optimize for type argument need on instance
methods and closurized static methods.

Change-Id: Id41d8f8aa7639da15fbd24844e397a4524b6ed20
Reviewed-on: https://dart-review.googlesource.com/35261
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-01-19 22:31:37 +00:00
Johnni Winther c6c8d08e85 Small cleanup.
Change-Id: Ieaa759df5974e7bd2d9b521cc3d0ca9de1af11f5
Reviewed-on: https://dart-review.googlesource.com/35600
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-01-19 21:20:57 +00:00
Sigmund Cherem e2ad2db805 Generate checks for library-is-loaded to fasta and dart2js.
Change-Id: Ibf453ca7390b81da7231dcb1be43e426c00d6eeb
Reviewed-on: https://dart-review.googlesource.com/35100
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-01-18 20:17:14 +00:00
Johnni Winther 73e35eb035 Update RTI optimization to handle type literal uses
... for generic methods and local function. Also update capture
conversion to recognize the new kinds of type variables.

Change-Id: I9b8771b0ebe6c9e926712fa31b0bdea966cc6a25
Reviewed-on: https://dart-review.googlesource.com/34600
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Emily Fortuna <efortuna@google.com>
2018-01-17 15:12:55 +00:00
Sigmund Cherem 72c3c8ea61 Several deferred loading improvements:
- fix some discrepancies between old and new deferred loading.
  * Kernel is now using the correct world impact
  * For the old FE, I'm more careful about avoiding metadata nodes when mirros
    are disabled as well.
  * Better approximate when a constant is deferred in the kernel codegen

- make 'dump()' independent of the IR, so we can easily compare them side by
  side.

- exclude primitives in kernel since we don't need to track them. I
  didn't change the old front end because it is not as easy to do. I did this
  change because kernel was processing many more constants than the old frontend
  (the old frontend skipped constants that were never evaluated, we have no way
  to do it selectively like that in the new front end).

Change-Id: I337d3fd818753125476b7390da5d900ebdc02709
Reviewed-on: https://dart-review.googlesource.com/34509
Reviewed-by: Emily Fortuna <efortuna@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-01-13 01:42:32 +00:00
Emily Fortuna cbd05542cc Created a signature method on closures that returns the type of the closure function.
Some additional optimization work will need to be done at the end so
that we take out these functions when they are not needed (when we
don't have type variables).


Bug:
Change-Id: I28d59d04844ec18510b9befe45f26f4109d86ffa
Reviewed-on: https://dart-review.googlesource.com/32667
Commit-Queue: Emily Fortuna <efortuna@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-01-13 00:27:22 +00:00
Johnni Winther 06e6f4d105 Add --disable-rti-optimization flag
- to separate rti implementation correctness from optimization soundness.

Change-Id: I0786dd45261d6f8cf1380f016bfb7c6f773df6b1
Reviewed-on: https://dart-review.googlesource.com/33880
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-01-11 07:56:56 +00:00
Johnni Winther 8e8915f538 Support generic closures in rti analysis
Change-Id: I1d393cff5b83f8db69e7bddb8ecfcd4a5205854f
Reviewed-on: https://dart-review.googlesource.com/32700
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-01-08 11:36:40 +00:00
Emily Fortuna cea3419584 Removed unnecessary Location parameter in closure conversion.
Bug:
Change-Id: I4460e8b54e104de1c8643f62f35176a2af537a6d
Reviewed-on: https://dart-review.googlesource.com/32722
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Emily Fortuna <efortuna@google.com>
2018-01-06 00:34:08 +00:00
Sigmund Cherem 497d592ac7 Fixes for deferred constants in the kernel pipeline.
The constant collector was inconsistent with the old frontend: we were
skipping primitives and we were not going into the body of closures.

Change-Id: I3321426da7e684d203f0ac7a2a2c7028f3138a7b
Reviewed-on: https://dart-review.googlesource.com/32663
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Emily Fortuna <efortuna@google.com>
2018-01-05 23:37:58 +00:00
Kevin Millikin 6fa813d818 Change handling of Kernel static errors
Before: Kernel static errors were represented by throwing a distinguished
error or else by calling a distinguished library const constructor.

Now: Kernel static errors are represented by InvalidExpression.  To support
error reporting, InvalidExpression has an optional message and a file
offset.  A back end can choose to signal these errors at any time; for
example, when deserializing the binary, or when compiling the procedure
containing the static error, or when the erroneous expression is evaluated
at run time.

InvalidStatement is removed because it can be encoded as ExpressionStatement
of InvalidExpression.

Future work:

* supporting static errors where an expression cannot appear in the AST
* allowing InvalidExpression to contain an Expression for error recovery
* adding a top-level list of static errors and warnings to the binary

Bug: https://github.com/dart-lang/sdk/issues/29840
Change-Id: Ifdfe9a76cee6cefed28061bf245be70531d2f413
Reviewed-on: https://dart-review.googlesource.com/31320
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-01-04 11:00:25 +00:00
Johnni Winther 985eba5139 Refactor RuntimeTypesNeed(Builder) and make them testable
Change-Id: I67234dd2b076327c138e5b1d7de47ee3edc987d1
Reviewed-on: https://dart-review.googlesource.com/31901
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-01-04 08:35:31 +00:00
Johnni Winther e9243a4d16 Pass type arguments in static calls.
+ support generic type variable type literals
+ support generic type variable is test

Change-Id: I2473c39c33940c631070b919c7dcfe712fd1fe3d
Reviewed-on: https://dart-review.googlesource.com/31783
Reviewed-by: Stephen Adams <sra@google.com>
2018-01-03 07:57:58 +00:00
Johnni Winther 220a91122a Add --strong-mode flag to dart2js
+ move generic methods tests into a subfolder.

Change-Id: I00cde6a7dc7d6ff1677a8ca60f3a243f065e3765
Reviewed-on: https://dart-review.googlesource.com/31782
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-01-02 08:42:21 +00:00
Emily Fortuna fa9e576a40 Adjust importsTo so that you can get the import chain for entities other than memberEntities.
Also added some more tests to the deferred equivalence test.


Bug:
Change-Id: Ia5ca50728a96020ff76b7b519558cdb5847d598e
Reviewed-on: https://dart-review.googlesource.com/31600
Commit-Queue: Emily Fortuna <efortuna@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-12-28 19:31:13 +00:00
Emily Fortuna 21891a965f Do id equivalence testing for deferred imports.
Also allows us to more generally compare annotations in multi-file tests.

Bug:
Change-Id: I2f4ac34b918cc80400ebc417dfcc2caf56457ac2
Reviewed-on: https://dart-review.googlesource.com/30923
Commit-Queue: Emily Fortuna <efortuna@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2017-12-22 20:04:44 +00:00
Johnni Winther 9fe7c0e806 Port unittests, part #5 of ?
Change-Id: I58c9deea426072907a5d02f61f23f138b1f50c1d
Reviewed-on: https://dart-review.googlesource.com/31101
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-12-22 12:11:47 +00:00
Sigmund Cherem f404b59d1f Disable multi-inheritance error when using the kernel FE
Workaround for Issue #31118

Change-Id: I1d19eb1adeb7236501c276eeee5446ada36115a3
Reviewed-on: https://dart-review.googlesource.com/31240
Reviewed-by: Emily Fortuna <efortuna@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2017-12-21 21:33:03 +00:00
Sigmund Cherem 414bad86df Directly create dart2js platform files using its patch files
Change-Id: I1c7d59968bfafeeb5a8b5252fa2d47e3c05b893e
Reviewed-on: https://dart-review.googlesource.com/27404
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Emily Fortuna <efortuna@google.com>
2017-12-19 20:31:57 +00:00
Emily Fortuna 4cd0593574 Tiny fix to fix type errors in our compiler while running host-checked
and deferred loaded code.

Bug:
Change-Id: I57b51a287fd7ffad59a1a59eae34e739b5e5603b
Reviewed-on: https://dart-review.googlesource.com/29745
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Emily Fortuna <efortuna@google.com>
2017-12-15 18:42:33 +00:00
Johnni Winther b13a6015cc Support subtyping for function type variables.
Change-Id: I0e00330d76cc9b1f3d48bb1f0d87f6334976de54
Reviewed-on: https://dart-review.googlesource.com/29281
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-12-14 10:09:55 +00:00
Stephen Adams d7516551ca measure computeWorldImpact in Kernel pipeline
Change-Id: I23d80a1272413350f3bf846d6e55e4bc533ddc59
Reviewed-on: https://dart-review.googlesource.com/25724
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2017-12-08 21:01:51 +00:00
Johnni Winther cd2afed97b Add typeArgumentCount to CallStructure
- to prepare for passing type parameters to generic methods.

Change-Id: I71fce9b2febdc69e650ec13569a70564b75ea3f1
Reviewed-on: https://dart-review.googlesource.com/26602
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-12-07 08:43:23 +00:00
Sigmund Cherem 1ad04b5935 Ignore metadata in the deferred-loading kernel implementation.
Since the kernel implementation doesn't support dart:mirrors, we don't need to
track these symbols. We should consider doing the same in the old
pipeline as well.

This address a deeper bug where we were adding to the K-element-map more
entities after we had closed the world and we had created the J-element-map.

The added regression test was failing because we tried to convert the K
annotation to its J conterpart, but we couldn't find it in the conversion maps
because it was added too late. If we add support for mirrors in the future, we
just need to ensure that such K elements are discovered before the deferred
loading phase.

Change-Id: I029062067cb21bdc06c30d09c77031775f381c20
Reviewed-on: https://dart-review.googlesource.com/26520
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Harry Terkelsen <het@google.com>
2017-12-06 22:19:31 +00:00
Emily Fortuna fe178582ef Add constraint checks for constructors (factory and generative).
Bug:
Change-Id: I68a3420276cd49c33ca4697262117aa8d4a3ff0f
Reviewed-on: https://dart-review.googlesource.com/26740
Commit-Queue: Emily Fortuna <efortuna@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2017-12-06 21:51:30 +00:00
Stephen Adams 5971a27674 Cache additionalExports as Set
Cache additionalExports as a Set to speed up kernel version of deferred loading

Bug: https://github.com/dart-lang/sdk/issues/31520
Change-Id: I0c67c2c0255bbbd3a4c844bae3a3b8ecf2233e13
Reviewed-on: https://dart-review.googlesource.com/25740
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-12-06 19:24:26 +00:00
Johnni Winther 08bd6919bf Introduce FunctionTypeVariable
+ rewrite subtype_test and friends to enable type tests from kernel
+ compute bounds on regular type variables

Change-Id: I8979d3e69bdfe7713146f546cc80c4d81f04778b
Reviewed-on: https://dart-review.googlesource.com/26200
Reviewed-by: Emily Fortuna <efortuna@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-12-06 14:46:44 +00:00
Jens Johansen 078f25acf9 [CFE/dart2js] Create dart2js-specific CFE entry point
This CL creates the initial dart2js-specific CFE entry point.
It is currently mostly a matter of copying the dart2js code for running the
front-end into the front-end, although it also applies a workaround for
making batch-mode faster.

Running the same dart2js with kernel tests as on the bots locally I get
this:

* Before: [09:11 | 100% | +10507 | -    0]
* Now [04:46 | 100% | +10507 | -    0]

Change-Id: I68f147fd7aadb0281807b4688b9f6fdc5aa24c28
Reviewed-on: https://dart-review.googlesource.com/25300
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2017-12-06 08:24:28 +00:00
Emily Fortuna dc1b5525bf Create temporary Method type in kernel world for compatibility with Dart 1
Bug:
Change-Id: I9efa163ce1a9a76df405f32d35850743e7f090cc
Reviewed-on: https://dart-review.googlesource.com/25723
Commit-Queue: Emily Fortuna <efortuna@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2017-12-04 19:37:54 +00:00
Peter von der Ahé e14726a3f4 Use absolute URIs instead of relative paths
We change the type of FileUriNode.fileUri from String to Uri, which in principle
doesn't change the binary format. However, we did notice that LibraryParts
weren't serialized as specified in binary.md, so we also fixed that.

Since fileUris are stored as strings in a separate table, Uri.parse is only called
once per unique URI.

Fasta only uses relativizeUri when printing diagnostics, and URIs stored in
expectation files (golden files) are relativized using String.replaceAll.

Change-Id: Ib2dc1b80c03a0cdaf84e48b8b3ba73b16bdf8a40
Reviewed-on: https://dart-review.googlesource.com/25421
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-12-04 11:34:24 +00:00
Samir Jindel bf797e6507 [kernel] Re-land assert initializers.
This change updates Dart2js and DDC.
Thanks to johnniwinther@ for the Dart2js updates.

The original revision is in patchset 2.

Change-Id: I26db33312f003f88ccccb67b27998ef21a1f667f
Reviewed-on: https://dart-review.googlesource.com/25820
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2017-12-04 11:22:34 +00:00
Stephen Adams df1490ba39 measure ssa builder from kernel
TBR=sigmund@google.com

Change-Id: I60aa2c52dde5c77f3205f500d29e465aaf3abc60
Reviewed-on: https://dart-review.googlesource.com/25721
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2017-12-02 01:42:22 +00:00
Johnni Winther 03685a3c0b Remove _targetFunction and add asyncMarker to StackFrame
Change-Id: I6c1f92ec6759a67686ff40d26871f2e2a004a443
Reviewed-on: https://dart-review.googlesource.com/24860
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2017-12-01 16:06:52 +00:00
Jens Johansen 22d0696d91 [CFE] Move front-end API under src/
This CL deprecates the front-end API and moves it into src/api_prototype.

For now all usages have been updated to point to the new location,
but they should be updated to use custom-client invocations instead (e.g.
one specific way for DDC, another for dart2js etc.)

Bug:
Change-Id: I9b4f41f6ebf55d42510fd35240d942d1dc7292d6
Reviewed-on: https://dart-review.googlesource.com/24822
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2017-12-01 08:42:16 +00:00
Emily Fortuna b7ef9072f1 Set "type" for FutureOr to dynamic (temporarily).
Bug:
Change-Id: Ie4a376316c0fa444642c2535c0a97f3245c92fda
Reviewed-on: https://dart-review.googlesource.com/24621
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Emily Fortuna <efortuna@google.com>
2017-11-30 18:18:04 +00:00
Johnni Winther 9ddb267c41 Use [StackFrame] class to hold data local to the current member in KernelSsaGraphBuilder
Change-Id: I6f80ef33f7da3a3b332dea6a44bd435d16bbd06b
Reviewed-on: https://dart-review.googlesource.com/24461
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-11-30 09:32:11 +00:00
Johnni Winther c5034c6532 Remove enterInlinedMember and leaveInlinedMember from KernelToLocalsMap
Change-Id: I9a33e7ba4b499785c50916c09496a35eaf99c301
Reviewed-on: https://dart-review.googlesource.com/24422
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2017-11-30 08:46:11 +00:00
Johnni Winther 69106c6c8c Support simple static inlining from kernel.
Change-Id: Ie9a062b2d825c9fb0ed7bd5933eb7cf841509409
Reviewed-on: https://dart-review.googlesource.com/23660
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2017-11-27 10:19:41 +00:00