Commit Graph

4835 Commits

Author SHA1 Message Date
Johnni Winther bbd2d67481 Fix and tests command line options
Initial test of regression on the --resolve-only vs --resolution-inputs options.

R=het@google.com

Review URL: https://codereview.chromium.org/2104233003 .
2016-07-01 10:33:30 +02:00
Johnni Winther 2f1cc9e958 Handle forwarding constructors
Handle serialization of forwarding constructors that are defined by
forwarding constructors:

  class A {}
  class B {}
  class C {}
  class D = A with B, C;

The default constructor of D is a forwarding constructor defined by the
default constructor of its super type A+B, which itself is a forwarding
constructor. Thus, the defining constructor might itself be synthesized
and therefore serialized indirectly.

R=het@google.com

Review URL: https://codereview.chromium.org/2105183003 .
2016-07-01 10:28:50 +02:00
Johnni Winther 95e6dde715 Handle fields with initializers in constant constructors.
This also normalizes CompileTimeConstantEvaluator to always create an ErroneousConstantExpression for constants with compile time errors.

R=het@google.com

Review URL: https://codereview.chromium.org/2104843002 .
2016-07-01 10:22:10 +02:00
Erik Ernst 442fc53b3c Implementation of modified scoping for initializing formals.
In order to make an implementation of initializing formal access in
`dart2js` available as specified in issue #26655 now, this CL changes
the scope management such that initializing formals are not in scope in
the constructor body, only in the initializer list.

This is done by introducing a new notion of scopes implemented
by `ExtensionScope`: Such a scope will extend an existing
`NestedScope` rather than adding a new nested scope to it.

R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/2059883002 .
2016-06-29 11:42:03 +02:00
Johnni Winther 0cf82efd76 Handle double literals in constant constructors.
R=het@google.com

Review URL: https://codereview.chromium.org/2102553002 .
2016-06-28 09:47:16 +02:00
Johnni Winther f010d5e01c Fix evaluation of !=
ConstantExpression.evaluate now computes != as the negation of the result of ==

R=het@google.com

Review URL: https://codereview.chromium.org/2094273002 .
2016-06-28 09:41:49 +02:00
Johnni Winther 717333c801 Handle rti for closures.
Use ResolvedAst to retrieve ClosureClassMap data for runtime type information.

R=het@google.com

Review URL: https://codereview.chromium.org/2100813002 .
2016-06-28 09:36:27 +02:00
Stephen Adams 716898c227 Shorter encoding for zero optional arguments.
R=het@google.com

Review URL: https://codereview.chromium.org/2092243002 .

Addresses: https://github.com/dart-lang/sdk/issues/26754
2016-06-27 13:23:43 -07:00
Johnni Winther 1bafa91055 Support malformed types
Adds a simple serialization of malformed types.

R=het@google.com

Review URL: https://codereview.chromium.org/2099703002 .
2016-06-27 10:10:21 +02:00
Johnni Winther a4a21f529a Serialize only unserialized libraries on --resolve-only
This speeds up batch-mode testing of serialization significantly:
from 40 min to 10 min for language tests on my machine.

R=het@google.com

Review URL: https://codereview.chromium.org/2091693005 .
2016-06-27 10:02:47 +02:00
Johnni Winther 74775a65b2 Skip unresolved functions in NoSuchMethodRegistry
Deserialized function do not have a [ResolvedAst] if they are not live.

The first stop towards the best solution is to skip unresolved (not live)
method, next step is to avoid registration of these methods in the
first place.

R=het@google.com

Review URL: https://codereview.chromium.org/2092913004 .
2016-06-27 09:50:40 +02:00
Johnni Winther 1e27180a6a Serialize erroneous element and more
- Adds support for serialization/deserialization of ErroneousElement.
- Imports dart:core for serialized libraries.
- Fixes and tests reserialization for ResolvedAst.sourceUri

R=het@google.com

Review URL: https://codereview.chromium.org/2088233003 .
2016-06-24 10:38:19 +02:00
Johnni Winther 035781504f Support completely serialized compilation in batch mode.
This adds the ability to serialize the whole program and compiling it
purely from serialized data. The features is added to batch-mode under
the environment flag SERIALIZED_COMPILATION.

R=het@google.com

Review URL: https://codereview.chromium.org/2086443002 .
2016-06-23 11:22:02 +02:00
Stephen Adams 256fa69b64 Tear-off --fast-startup mode performance fix
Install $stubName property to enable fast tear-offs in --fast-startup mode.
Without the $stubName property, the most generic path is used which is 10x slower.

R=floitsch@google.com

Review URL: https://codereview.chromium.org/2079843005 .
2016-06-21 10:45:59 -07:00
Johnni Winther c3085e3164 Enforce use of the forEachInstanceField ordering for constructed constants.
This ensures that constructed constants use the same field layout as the emitted classes.

R=het@google.com

Committed: https://github.com/dart-lang/sdk/commit/67b71d0cb793d5faaa2ee6f070741cc775a3f59a

Review URL: https://codereview.chromium.org/2072223002 .

Reverted: https://github.com/dart-lang/sdk/commit/f817910fd03d49b42ec10346ae6f589d3dadae4e
2016-06-20 12:49:30 +02:00
Johnni Winther f817910fd0 Revert "Enforce use of the forEachInstanceField ordering for constructed constants."
This reverts commit 67b71d0cb7.

BUG=

Review URL: https://codereview.chromium.org/2080183002 .
2016-06-20 11:17:13 +02:00
Johnni Winther 67b71d0cb7 Enforce use of the forEachInstanceField ordering for constructed constants.
This ensures that constructed constants use the same field layout as the emitted classes.

R=het@google.com

Review URL: https://codereview.chromium.org/2072223002 .
2016-06-20 10:36:23 +02:00
Stephen Adams 909ec27b10 Code changes to avoid Firefox debug 'error' lint warnings.
Firefox produces many SyntaxErrors and TypeErrors for what are really
linter issues.

Improve compile-time and run-time codegen to avoid these warnings.

BUG=
R=het@google.com

Review URL: https://codereview.chromium.org/2072883004 .
2016-06-17 13:05:28 -07:00
Johnni Winther 450ad60d94 Cache metadata constants for make benefit of glorious try/poi/forget_element_test
Review URL: https://codereview.chromium.org/2076503002 .
2016-06-16 13:13:57 +02:00
Johnni Winther 85271bae28 Serialize and process patch metadata
- Metadata on patched elements is also serialized.
- Backend.onElementResolved is also called for deserialized elements.

BUG=
R=het@google.com

Review URL: https://codereview.chromium.org/2065413002 .
2016-06-16 12:21:35 +02:00
Johnni Winther 5f3cf6f932 Serialize metadata
R=het@google.com

Committed: https://github.com/dart-lang/sdk/commit/f8e3f223476b461d4c9fcf89b691441f73532bf4

Review URL: https://codereview.chromium.org/2060183002 .

Reverted: https://github.com/dart-lang/sdk/commit/368d4d54d3634cfbbbfcf63bce8d024dd7b9a4ae
2016-06-16 12:13:17 +02:00
Johnni Winther 34bab63be2 Remove Registry from registerMetadataConstant
Avoids registration of metadata from within resolution.
This prepares for handling deserialized metadata.

R=het@google.com

Committed: https://github.com/dart-lang/sdk/commit/ed1777e4b26643099ef0c24cd53d5c1629850141

Review URL: https://codereview.chromium.org/2056903003 .

Reverted: https://github.com/dart-lang/sdk/commit/368d4d54d3634cfbbbfcf63bce8d024dd7b9a4ae
2016-06-16 12:04:36 +02:00
Johnni Winther 368d4d54d3 Revert "Remove Registry from registerMetadataConstant" and "Serialize metadata"
This reverts commit ed1777e4b2.
This reverts commit f8e3f22347.

Review URL: https://codereview.chromium.org/2070493003 .
2016-06-16 10:11:51 +02:00
Johnni Winther f8e3f22347 Serialize metadata
R=het@google.com

Review URL: https://codereview.chromium.org/2060183002 .
2016-06-16 09:45:12 +02:00
Johnni Winther ed1777e4b2 Remove Registry from registerMetadataConstant
Avoids registration of metadata from within resolution.
This prepares for handling deserialized metadata.

R=het@google.com

Review URL: https://codereview.chromium.org/2056903003 .
2016-06-16 09:17:34 +02:00
Johnni Winther 364f84f05d Serialize NativeBehavior for elements
- Serialize nativeMethodBehavior, nativeFieldLoadBehavior and nativeFieldStoreBehavior.
- Add a test for the serialization/deserialization of native data for dart:html.

R=het@google.com

Review URL: https://codereview.chromium.org/2057993003 .
2016-06-16 08:52:25 +02:00
Johnni Winther 77c689fd16 Cache fromEnvironment state in ConstructorElementCommon
Cache the value of the properties `isFromEnvironmentConstructor`,
`isIntFromEnvironmentConstructor`, `isBoolFromEnvironmentConstructor`,
and `isStringFromEnvironmentConstructor` in ConstructorElementCommon.

R=het@google.com

Review URL: https://codereview.chromium.org/2060143002 .
2016-06-15 09:43:44 +02:00
Harry Terkelsen 3bb92ad12d rename operathor to operator now that vm bug is fixed
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/2052693002 .
2016-06-09 09:29:20 -07:00
Johnni Winther 286b21133b Compute and cache element NativeBehavior during resolution.
NativeBehavior for method calls and field load/store are now computed
during resolution and apply as part of the world impact. This prepares
for (full) serialization/deserialization of native elements.

R=het@google.com

Review URL: https://codereview.chromium.org/2045223002 .
2016-06-09 09:50:51 +02:00
Harry Terkelsen ddac2a8a76 Revert "check that Class and typedef refs are const"
This reverts commit 8a6a6377e7.

BUG=

Review URL: https://codereview.chromium.org/2049343002 .
2016-06-08 16:32:30 -07:00
Harry Terkelsen 8a6a6377e7 check that Class and typedef refs are const
Fixes #26580

R=sra@google.com

Review URL: https://codereview.chromium.org/2049553002 .
2016-06-08 16:02:55 -07:00
Erik Ernst c3dfe51295 Adds status entries for initializing_formal tests.
This CL should fix the problem that arose with commit
543a51ff3e. Here's the description from
that CL:

This CL adds tests for previously uncovered elements of the semantics
and includes fixes such that the desired behavior is obtained. In
particular, an `isInitializingFormal` element may now occur in contexts
where it wasn't expected until now, and changes were made to handle it.
It is also checked that a capture of an initializing formal (in a
function literal) captures the parameter, not the field.

R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/2042293002 .
2016-06-08 10:50:33 +02:00
Harry Terkelsen 74abdfe09e typecheck erroneous members as dynamic
Fixes #26582

R=sra@google.com

Review URL: https://codereview.chromium.org/2046053002 .
2016-06-07 13:18:45 -07:00
Erik Ernst 6d56db592b Revert "New tests for initializing formal access."
This reverts commit 543a51ff3e
because several status file updates are needed.

Review URL: https://codereview.chromium.org/2039243002 .
2016-06-06 16:07:03 +02:00
Erik Ernst 543a51ff3e New tests for initializing formal access.
This CL adds tests for previously uncovered elements of the semantics
and includes fixes such that the desired behavior is obtained. In
particular, an `isInitializingFormal` element may now occur in contexts
where it wasn't expected until now, and changes were made to handle it.
It is also checked that a capture of an initializing formal (in a
function literal) captures the parameter, not the field.

R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/2039833002 .
2016-06-06 15:55:44 +02:00
Johnni Winther e97c1c673f Align semantics of getDefaultConstructor()
The modelx implementation of getDefaultConstructor() (surprisingly)
returned constructors with only optional arguments. This CL aligns the
modelz implementation with this, adding a TODO to figure out what the
best behavior is.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2033893004 .
2016-06-06 11:23:22 +02:00
Johnni Winther 153c36ce39 Don't crash when tree shaking is disabled
When tree shaking is disabled, type checking crashed on member lookup into serialized classes.
Also classes are now ensured to be resolved when computing lookup.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2031293002 .
2016-06-06 11:08:01 +02:00
Johnni Winther b11a92f2ed Handle use of fromEnvironment from serialized data.
This CL removes the [intEnvironment], [boolEnvironment] and [stringEnvironment]
from [Compiler] and instead determine .fromEnvironment directly from the
constructor element itself.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2033383002 .
2016-06-06 10:52:41 +02:00
Johnni Winther 0b926d64a4 Handle deferred access of unserialized code.
This CL fixes crashes in deferred_load when using serialized dart:core:
- resolution impacts are cached in [Resolution] for both serialized and unserialized elements.
- type variable constants (for mirrors) are computed using [ConstantExpression]s.
- LibraryElementZ.getImportsFor returns the empty list; thus still not valid for deferred access in serialized code.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2034973003 .
2016-06-06 10:26:37 +02:00
Harry Terkelsen 6b721d5145 add resolver dart2js script
can resolve helloworld

BUG=

Review URL: https://codereview.chromium.org/2024473002 .
2016-06-02 17:21:06 -07:00
Harry Terkelsen 88dd7c8f37 use const Link so that empty Link is always identical
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2033873002 .
2016-06-02 14:25:09 -07:00
Johnni Winther 6384fc0c77 Fix poi test.
BUG=

Review URL: https://codereview.chromium.org/2030043002 .
2016-06-02 14:20:55 +02:00
Johnni Winther bb9fab0065 Fix code-size regression
This reinserts the native spec-string interpretation.

The CL https://codereview.chromium.org/2004833003/ changed the interpretation of `List` from `List<E>` to `List<dynamic>` causing these native classes to be added through subtyping:

NativeUint8List <: List
NativeUint8ClampedList <: List
NativeUint32List <: List
NativeUint16List <: List
NativeInt8List <: List
NativeInt32List <: List
NativeInt16List <: List
NativeFloat64List <: List
NativeFloat32List <: List
NativeTypedArrayOfInt <: List
NativeTypedArrayOfDouble <: List

R=sra@google.com

Committed: https://github.com/dart-lang/sdk/commit/565b30123c471b4b126e51f90cefab4f271c07b3

Reverted: https://github.com/dart-lang/sdk/commit/fa5b98126cd0b03163cf1e985944ef84daffe96b

Review URL: https://codereview.chromium.org/2021723003 .
2016-06-02 13:56:51 +02:00
Johnni Winther fa5b98126c Revert "Fix code-size regression"
This reverts commit 565b30123c.

BUG=

Review URL: https://codereview.chromium.org/2037593002 .
2016-06-02 11:41:44 +02:00
Johnni Winther f1ba23bd15 Compute non-final static fields without the constant compiler.
Previously the non-final static fields were pulled from the constant compiler.
Now, since all fields have a valid [constant] field, these fields are now computed
directly from the set of all referenced static fields.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2024873002 .
2016-06-02 11:33:48 +02:00
Johnni Winther b0bc802b5c Register deserialized lazy statics.
Register non-const fields without constant initializers as 'lazy statics' during deserialization.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2023863002 .
2016-06-02 11:24:12 +02:00
Erik Ernst c35caf253e Introduces "--initializing-formal-access".
This CL is an adjusted version of CL 2025853002, adding updates to
`InitializingFormalElementZ` to match the updates applied to
`InitializingFormalElementX`, and adding the new option to the
`MessageKind.DUPLICATE_DEFINITION` example.

Description from 2025853002:

This CL adjusts the treatment of initializing formals, such that they
can be used in initializers and in constructor bodies. E.g., `x` can be
used as in `C(this.x) : y = x { var z = x + 2; }`.

It hides the new feature under the option '--initializing-formal-access'
which is used in the test 'initializing_formal_access_test.dart'.

It also adds an `example` test to `MessageKind.DUPLICATE_DEFINITION` to
verify that name clashes among initializing formals and other
parameters are detected (which was previously not the case).

Finally, it fixes a typo in a comment, `InitializingFormalParameter` ->
`InitializingFormalElement`.

R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/2029003002 .
2016-06-02 11:09:56 +02:00
Johnni Winther 7499d74f4b Compute and check members for serialization
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2015903002 .
2016-06-02 11:00:13 +02:00
Johnni Winther ac1bc765d9 Support references to unserialized libraries.
This adds initial support for combining serialized and unserialized libraries
even in the case where the serialized library refers to the unserialized library.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2024783003 .
2016-06-02 10:39:29 +02:00
Johnni Winther 5916ee557f Improve equivalence testing of unnamed mixin applications.
The equivalence of unnamed mixin applications cannot be tested directly since
they are not nominal entities. In the example below two classes by the synthetic
name `S+M` are introduces. This CL adds a reference to the introducing class so
that the unnamed mixin applications can be distinguished as `S+M from C1` and
`S+M from C2`.

class S {}
class M {}
class C1 extends S with M {}
class C2 extends S with M {}

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2017903002 .
2016-06-02 10:26:26 +02:00