Commit Graph

4698 Commits

Author SHA1 Message Date
Harry Terkelsen c5728623b9 remove dependency on compiler from resolution
This is the first step of a refactoring that splits the resolution
phase from the backend. The end goal is that resolution can be run
without having to instantiate an entire compiler.

R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/2123073003 .
2016-07-18 10:40:21 -07:00
Johnni Winther 3305201211 Serialize this-types in NativeBehavior separately.
BUG=
R=het@google.com

Review URL: https://codereview.chromium.org/2150333002 .
2016-07-18 10:42:23 +02:00
Stephen Adams 7749b715d4 dart2js: get:hashCode methods to avoid Object.hashCode
R=het@google.com

Review URL: https://codereview.chromium.org/2154583002 .
2016-07-15 13:31:48 -07:00
Johnni Winther 5c5a46a6e1 Serialize data for LibraryElement.getImportsFor
R=het@google.com

Review URL: https://codereview.chromium.org/2150533002 .
2016-07-15 10:16:51 +02:00
Johnni Winther f2e435ba88 Serialize prefix members.
R=het@google.com

Review URL: https://codereview.chromium.org/2150493002 .
2016-07-15 09:55:34 +02:00
Johnni Winther 9214293d29 Test ImportElement and fix PrefixElementZ.isTopLevel
BUG=
R=het@google.com

Review URL: https://codereview.chromium.org/2150473002 .
2016-07-15 09:47:29 +02:00
Johnni Winther 38dd1553e8 Support checked mode
Checked mode checks are now always stored in the WorldImpact meaning that
data doesn't have to be serialized with checked mode enabled.

R=het@google.com

Review URL: https://codereview.chromium.org/2129183002 .
2016-07-12 10:10:12 +02:00
Erik Ernst 1011686cf8 Renamed isParameter to isRegularParameter.
This rename was planned a while ago, but it seemed reasonable to take
it in a separate CL because of the number of locations affected.

R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/2132383002 .
2016-07-12 09:31:04 +02:00
Harry Terkelsen f7878a179d fix handling of malformed typedefs
BUG=

Review URL: https://codereview.chromium.org/2136663002 .
2016-07-08 14:52:23 -07:00
Harry Terkelsen 10691da9f8 dart2js: allow trailing commas in parameter and argument lists
Fixes https://github.com/dart-lang/sdk/issues/26646

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

Review URL: https://codereview.chromium.org/2068003002 .
2016-07-08 10:03:51 -07:00
Erik Ernst 6942e0df63 Fixes bug in scoping for generic methods.
The updates to tests/language/generic_local_functions_test.dart use a
local function type argument in its return type, which had not been
tested and did not work.

After a bunch of attempts to change the order in which the resolution
is performed, it suddenly turned out that the offending statement
`visit(node.returnType)` in `ResolverVisitor.visitFunctionExpression`
might be redundant! (.. a subsequent re-resolution in
`ResolverVisitor.analyze` performs the same job, and uses the correct
scope).

So this CL simply removes that `visit..` statement, and the resulting
`dart2js` passes all tests.

Adresses issue https://github.com/dart-lang/sdk/issues/26805.

R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/2128243002 .
2016-07-08 13:28:36 +02:00
Johnni Winther ddf8a9ddd2 Serialize WarnOnUseElement
R=het@google.com

Review URL: https://codereview.chromium.org/2125793003 .
2016-07-08 11:22:07 +02:00
Johnni Winther 1f1e00f012 Handle redirects to unresolved redirects
The solves the handling of redirecting factories that redirects to other
redirecting factories whos immediate redirection target is unresolved.

For instance

  class C {
    factory C.a() = C.b;
    factory C.b() = Unresolved;
  }

The implementation normalizes the properties 'immediateRedirectionTarget',
'redirectionDeferredPrefix', 'effectiveTarget', 'effectiveTargetType', and
'isEffectiveTargetMalformed' by always storing the information on the
implementation element.

R=het@google.com

Review URL: https://codereview.chromium.org/2125823002 .
2016-07-08 11:14:20 +02:00
Johnni Winther 41535b3b5b Serialize parameter nodes for local functions.
R=het@google.com

Review URL: https://codereview.chromium.org/2125643002 .
2016-07-08 10:57:10 +02:00
Johnni Winther 4a7b1bb57e Support enclosingClass on deserialized local elements
R=het@google.com

Review URL: https://codereview.chromium.org/2124773002 .
2016-07-08 10:47:33 +02:00
Johnni Winther 185d4d5900 Fix serialization of IndexSetIfNullStructure.
R=het@google.com

Review URL: https://codereview.chromium.org/2103833002 .
2016-07-08 10:21:11 +02:00
Johnni Winther 3fcadea405 Compute correct names for closures in operator methods.
Operators were not correctly recognized because of the use of identical
instead of == and thus closures contained untransformed operators in
their names.

R=het@google.com

Review URL: https://codereview.chromium.org/2119193002 .
2016-07-08 10:10:31 +02:00
Johnni Winther d650d0059b Support serialization of generic methods.
BUG=
R=het@google.com

Review URL: https://codereview.chromium.org/2121743002 .
2016-07-08 10:03:02 +02:00
Johnni Winther 04d28ffecb Correct evaluation of interpolated null
R=het@google.com

Review URL: https://codereview.chromium.org/2118203002 .
2016-07-08 09:50:50 +02:00
Johnni Winther daed6fa215 Fix evaluation of constant map with duplicate keys.
BUG=
R=het@google.com

Review URL: https://codereview.chromium.org/2120943002 .
2016-07-08 09:38:37 +02:00
Johnni Winther c719383d0a Serialize async marker on getters.
BUG=
R=het@google.com

Review URL: https://codereview.chromium.org/2120923002 .
2016-07-08 09:31:14 +02:00
Jacob Richman 595ec1d785 Make is checks work on JavaScriptFunction objects.
BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org/2110273003 .
2016-07-01 11:31:25 -07:00
Johnni Winther a8114631c7 Use unordered map hash on ConstructedConstantValue.
R=het@google.com

Review URL: https://codereview.chromium.org/2112893002 .
2016-07-01 12:46:08 +02:00
Johnni Winther ceb053a257 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

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

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

Reverted: https://github.com/dart-lang/sdk/commit/fa8f7d20f3848db9676e8d1af30ceaefa1ccb21d
2016-07-01 12:36:55 +02:00
Johnni Winther fa8f7d20f3 Revert "Handle fields with initializers in constant constructors."
This reverts commit 95e6dde715.

BUG=

Review URL: https://codereview.chromium.org/2118763002 .
2016-07-01 11:25:50 +02:00
Johnni Winther 5e3419a8e2 Handle constant ?? expressions in constructors.
R=het@google.com

Review URL: https://codereview.chromium.org/2116483002 .
2016-07-01 11:03:15 +02:00
Johnni Winther f00a439f7c Handle invalid deferred prefix declarations.
R=het@google.com

Review URL: https://codereview.chromium.org/2116473002 .
2016-07-01 10:53:42 +02:00
Johnni Winther ee29d16836 Support serialization of loadLibrary
Adds support for serialization of the 'loadLibrary' getter implicitly
defined on deferred prefixes.

R=het@google.com

Review URL: https://codereview.chromium.org/2110323003 .
2016-07-01 10:48:08 +02:00
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