Commit Graph

4698 Commits

Author SHA1 Message Date
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 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
Johnni Winther 565b30123c 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

Review URL: https://codereview.chromium.org/2021723003 .
2016-06-02 10:16:44 +02:00
Erik Ernst 5b72755837 Revert "Introduces "--initializing-formal-access"."
This reverts commit b80a73775c
because introduced new failures in co19 tests.

Review URL: https://codereview.chromium.org/2021133003 .
2016-05-31 18:03:14 +02:00
Erik Ernst b80a73775c Introduces "--initializing-formal-access".
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/2025853002 .
2016-05-31 15:39:02 +02:00
Johnni Winther 91616103aa Use correct type on evaluated literal symbols.
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2018523002 .
2016-05-27 11:05:00 +02:00
Johnni Winther d78290a5b2 Compute import paths using ImportElement and ExportElement
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2005293003 .
2016-05-27 10:58:52 +02:00
Johnni Winther 6cd484ddb5 Correctly skip if-null expressions.
Closes #26543

R=eernst@google.com

Review URL: https://codereview.chromium.org/2016693002 .
2016-05-27 10:44:47 +02:00
Johnni Winther dd4368e217 Fix several element properties in serialization.
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2012163003 .
2016-05-27 10:37:36 +02:00
Johnni Winther 326af10bc8 Add names and support for preserialized data to serialization tests
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2013763002 .
2016-05-26 09:36:32 +02:00
Sigmund Cherem 266ad7fd0f Remove reference to compiler from libary loader, fix analyzer warning
R=het@google.com

Review URL: https://codereview.chromium.org/2009773004 .
2016-05-25 15:27:32 -07:00
Harry Terkelsen 779465d862 fix warning in noSuchMethod registry
BUG=

Review URL: https://codereview.chromium.org/2006143007 .
2016-05-25 11:38:13 -07:00
Harry Terkelsen b5fbea4f4a accept null type casts in dummy noSuchMethod checks
Fixes #23843

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2009853003 .
2016-05-25 10:14:53 -07:00
Harry Terkelsen 7476560209 run dartfmt on dart2js
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2007353002 .
2016-05-25 10:14:02 -07:00
Sigmund Cherem b741e3f0df Make CompilerTask independent of compiler.
Now this base class only has logic for measuring time.

R=het@google.com, johnniwinther@google.com

Review URL: https://codereview.chromium.org/2000323006 .
2016-05-25 09:11:08 -07:00
Johnni Winther 42435f2643 Support multiple resolution inputs from command line.
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2004833003 .
2016-05-25 11:02:34 +02:00
Erik Ernst acc5f59a99 Changes dart2js to warn at reified usage of method type variables.
This CL changes the response to `x is T`, `x is! T`, `x as T`, and `T`
used as a type expression (say, `foo(T)`) where `T` is a method type
variable: It will now emit a warning in these cases.

Test examples associated with `TYPE_VARIABLE_FROM_METHOD_NOT_REIFIED`
have been activated and corrected, such that this behavior is tested.

As a result 'language/generic_methods_type_expression_test.dart' will
now cause warnings when compiled with `dart2js`.

Note that this does not break any tests, because `dart2js` does not make
the compilation fail when there is a warning (also, the analyzer and the
vm are unaffected because this is about a change to `dart2js`, not a
change to the test file).

R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/2001093006 .
2016-05-25 10:46:50 +02:00
Sigmund Cherem ea5f49c969 Delete support for source mirrors
R=johnniwinther@google.com

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

Review URL: https://codereview.chromium.org/1799283002 .
2016-05-24 13:05:47 -07:00
Erik Ernst af79c19a53 Revision of "Adjusts dart2js backend to handle method type arguments"
Adjusted version of CL https://codereview.chromium.org/1976213002/,
only changed by adding entries in status files for the test
'tests/language/generic_methods_type_expression_test.dart'.

Review URL: https://codereview.chromium.org/2001393003 .
2016-05-24 11:12:02 +02:00
Johnni Winther 552dc14877 Support multiple serialization sources in DeserializerSystemImpl.
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2007573002 .
2016-05-24 10:23:11 +02:00
Johnni Winther 7877bfe64e Yet another unnecessary ElementX reference
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2005843002 .
2016-05-24 10:02:21 +02:00
Johnni Winther e0594d7b7e Handle constant function references.
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2000153002 .
2016-05-24 09:52:00 +02:00
Erik Ernst 912bcc8418 Revert "Adjusts dart2js backend to handle method type arguments."
This reverts commit 04e45eb634.

BUG=

Review URL: https://codereview.chromium.org/2000223002 .
2016-05-23 18:35:53 +02:00
Erik Ernst 04e45eb634 Adjusts dart2js backend to handle method type arguments.
This CL has the same purpose as 1969753002, stated in the title line,
but it works for checked mode execution (where 1969753002 was broken),
and for usage of method type arguments in additional situations.

Approach: `DartType` and subtypes have been extended with new methods
to erase `MethodTypeVariableType` to `DynamicType`. This is done early
(after resolution, before SsaBuilder), such that only few parts of the
compiler need to deal with anything new. This approach handles method
type variables in checked mode, in `new` expressions, and in function
typed parameters. Finally, tests are added for the new cases, and
status files updated.

UPDATE: See message #10 and #12 for an updated description of the approach.

R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/1976213002 .
2016-05-23 17:17:29 +02:00
Johnni Winther 95fa410d53 Handle resolvedAst for forwarding constructors and callType on unnamed mixin applications.
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2000663002 .
2016-05-23 10:42:45 +02:00