Commit graph

38394 commits

Author SHA1 Message Date
Matthias Hausner
7daa2a8915 Fix capturing variables in optimized compilations
Fourth(!) attempt. This CL fixes another instance where parsing a nested function modifies the parser state of the function that is being compiled.

When a local function gets compiled the second time, constant
expressions may not be parsed again, since the constant value
is found in the cache. If the expression refers to an outer
variable, it does not get captured correctly.

Fix: instead of parsing a local function repeatedly to capture
outer variables, use the local function’s context scope to mark
outer variables as captured. This fixes the bug, and makes the
compiler more efficient as well.

BUG= 26453
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2010283004 .
2016-05-27 11:27:10 -07:00
Konstantin Shcheglov
f0f51ed055 Create ExecutableElementImpl.type lazily.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/2015183003 .
2016-05-27 11:08:04 -07:00
Ivan Posva
0c38e23e1d - Fix product mode SIMDBC build.
BUG=

Review URL: https://codereview.chromium.org/2011363002 .
2016-05-27 10:56:11 -07:00
Harry Terkelsen
ca0bedc301 remove now-passing tests from list of failures
Fixes #26557

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2015273002 .
2016-05-27 10:26:45 -07:00
Florian Schneider
aa05691c77 status update: process_sync_test still timing out on Windows
TBR=zra@google.com,

BUG=#24596

Review URL: https://codereview.chromium.org/2018033002 .
2016-05-27 18:53:28 +02:00
Paul Berry
4b2742448d Remove skipBrokenAstInference flag (it is no longer needed).
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2013193003 .
2016-05-27 09:04:12 -07:00
Paul Berry
84c5cd016e Fix handling of identifier sequences starting with a function parameter.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2011323002 .
2016-05-27 08:45:51 -07:00
Lasse R.H. Nielsen
7009677096 Also add comments requested by review, and some more.
Also exclude more environments from running the test, restricting it to *only* the stand-alone VM and the analyzer.

Review URL: https://codereview.chromium.org/2015193002 .
2016-05-27 13:07:40 +02:00
Florian Schneider
05660b8f25 Skip new test that uses Platform.executable under precompilation
TBR=lrn@google.com,

BUG=

Review URL: https://codereview.chromium.org/2016313002 .
2016-05-27 12:30:23 +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
e25e6206d8 Fix analyze_dart2js_helpers_test
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2006333004 .
2016-05-27 10:45:38 +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
Lasse R.H. Nielsen
dead4294ae Fix analyzer warnings in packages_file_test.dart.
Review URL: https://codereview.chromium.org/2013353003 .
2016-05-27 10:11:45 +02:00
Lasse R.H. Nielsen
39df5d56b2 Add test of some package-config configurations.
More to come.

R=floitsch@google.com

Review URL: https://codereview.chromium.org/1993643002 .
2016-05-27 09:19:16 +02:00
John Messerly
5fcf79c618 Improve Future<T>.then<R> inference
This is not a general fix, but it's a simplest fix I could come up with.

It fixes the common problem of downwards and upwards inference conflicting. On the way down, we use the return context, but on the way back up, we ignore it for `Future.then`. This allows inference to conclude an instantiation like:

    f.then/*<Future<int>>*/(...)

Then, thanks to Future flattening, we get the right return type as well (return type is Future<R>, which strong mode interprets as Future< flatten(R) >, so it works out).

Many of the other example cases are not fixed, though. Downwards inference will only push down `R` not `Future<R> | R`, so if the Future<R> branch was needed, for example: Future<Lint<int>> g = f.then(() => new Future.value([])) will not infer the `<int>[]` allocation nor the `Future<List<int>>` type. I have a work-in-progress that fixes those but introduces a special union type notion for `Future<R> | R`, and I'm not sure we're ready for that.

R=leafp@google.com

Review URL: https://codereview.chromium.org/2016793002 .
2016-05-26 17:02:49 -07:00
Paul Berry
f251da2dc9 Make AST-based type inference handle <bottom> consistently.
The non-AST-based type inference engine has the following quirk.  With
the source code:

var x = null;

The type of `x` is inferred as `dynamic`, whereas the type of the
synthetic initializer function associated with `x` is inferred as `()
-> <bottom>`.

This CL makes the AST-based type inference engine act in the same way
for consistency.

In the future we may want to change both engines to consistently infer
`dynamic`.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/2014383003 .
2016-05-26 15:21:31 -07:00
Konstantin Shcheglov
539c29c245 Resynthesize 'propagatedType' lazily and get rid of buildPropertyIntroducingElementCommonParts.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/2016083002 .
2016-05-26 15:11:55 -07:00
Konstantin Shcheglov
5bfc0b4a70 Resynthesize constant field initializers lazily.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2015053002 .
2016-05-26 15:08:34 -07:00
Ryan Macnak
227927a8bb Make Android gyp flags more like Linux gyp flags. Fix cases of -Wconversion-null.
R=zra@google.com

Review URL: https://codereview.chromium.org/2018723002 .
2016-05-26 14:56:24 -07:00
Konstantin Shcheglov
e417179ea3 Use PropertyAccessorElementImpl_Implicit[Getter, Setter].
This allows us to delay creating FunctionTypeImpl(s) for them, and
when using summaries also delay `property.type` resynthesis.

R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/2018653002 .
2016-05-26 14:54:47 -07:00
Paul Berry
be7db60753 Implement AST-based type inference involving expression-type closures.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2016873002 .
2016-05-26 14:31:24 -07:00
Paul Berry
20056c3f45 In AST-based type inference, use function elements rather than variable elements.
This paves the way for including closures in type inference, since
closures are function elements that don't have an associated variable.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/2014893004 .
2016-05-26 12:46:30 -07:00
Sigmund Cherem
91c8754a05 Preserve the original semantics in the poi tests.
R=het@google.com

Review URL: https://codereview.chromium.org/2016013002 .
2016-05-26 12:41:33 -07:00
Paul Berry
0548ae7f3f Fix circularity detection for AST-based type inference in the presence of closures.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2015833004 .
2016-05-26 12:00:58 -07:00
Konstantin Shcheglov
039f2a05c4 Resynthesize some more types lazily.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/2010143002 .
2016-05-26 11:45:23 -07:00
Ryan Macnak
e3f5760f66 Tree-shaker: drop imports/exports in a way that doesn't break the vm-service.
BUG=http://dartbug.com/26550
R=hausner@google.com

Review URL: https://codereview.chromium.org/2014913002 .
2016-05-26 11:29:27 -07:00
Florian Schneider
62f64eb312 Fix checked mode error in socket_bind_test.
BUG=
R=kustermann@google.com

Review URL: https://codereview.chromium.org/2007133007 .
2016-05-26 20:14:51 +02:00
Harry Terkelsen
9850a83bdb fix poi test
Fixes #26538

Review URL: https://codereview.chromium.org/2012233003 .
2016-05-26 11:01:12 -07:00
Brian Wilkerson
08ce826f3b Gather and report stats on the number of times flushed results are recomputed
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2005403005 .
2016-05-26 10:58:32 -07:00
Florian Schneider
b1ce8afde5 Fix a flaky failure in socket_bind_test.
Make the test more robust against the case where it use a IPv4 socket address
is already in use with IPv6 or vice versa by first finding a port that is free
for both.

BUG=
R=kustermann@google.com

Review URL: https://codereview.chromium.org/2014893002 .
2016-05-26 19:38:32 +02:00
Ryan Macnak
ef8baa8760 Add test harness option for app snapshots with unoptimized code.
./tools/test.py -m all -c dart2appjit -r dart_app --use-blobs

Rename 'dart_product' runtime to 'dart_app'.

Rename Dart_PrecompiledJITSnapshotBlob to Dart_CreateAppJITSnapshot and add documentation.

Remove out-of-date scripts in tools/precompilation.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/1992703005 .
2016-05-26 10:37:47 -07:00
Konstantin Shcheglov
0a5ecc50ab Resynthesize return types lazily.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/2007323006 .
2016-05-26 10:14:01 -07:00
Konstantin Shcheglov
cdc0b17246 Resynthesize ParameterElementImpl.parameterKind lazily.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2015963002 .
2016-05-26 10:08:48 -07:00
Paul Berry
e71e111b24 Summarize references to closure parameters properly.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2013093002 .
2016-05-26 10:04:27 -07:00
Paul Berry
dcadf0b35c Store expression function closures summaries when needed for type inference.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2012263002 .
2016-05-26 09:26:40 -07:00
Ryan Macnak
48637d1010 Fix Dartium GOMA builds (-Werror,-Wmismatched-new-delete).
Review URL: https://codereview.chromium.org/2017663002 .
2016-05-26 09:15:55 -07:00
Paul Berry
6d2b7f4067 Refactor AST summarization logic for serializing initializer expressions.
This should pave the way for serializing the bodies of expression-type
function closures.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/2017613003 .
2016-05-26 08:44:12 -07:00
Konstantin Shcheglov
ac7f892cc4 Resynthesize FieldFormalParameterElementImpl(s) lazily.
And also resynthesize parameter types lazily.

R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/2016543002 .
2016-05-26 08:36:41 -07:00
Paul Berry
8d43e02174 Migrate UnlinkedParam.defaultValue to UnlinkedExecutable.bodyExpr.
To do AST-based type inference involving function closures, we have
added a `bodyExpr` field to UnlinkedExecutable.  Since every
UnlinkedParam with a default value has a corresponding
UnlinkedExecutable representing its initializer, it makes sense to
store the constant expression there for uniformity.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/2010993002 .
2016-05-26 08:12:39 -07:00
Florian Schneider
48134f9b66 VM: Remove unused script_ field from Library objects.
BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org/2016713002 .
2016-05-26 16:32:52 +02:00
Vyacheslav Egorov
bfa8a7a2a3 VM: Field::IsConsistentWith should check unboxing state of the field.
R=fschneider@google.com
BUG=

Review URL: https://codereview.chromium.org/2012183003 .
2016-05-26 15:14:48 +02:00
Florian Schneider
6afbb17cec VM: Fix assertion failure from background compiler.
The background compiler expects only cloned Field objects.

BUG=#26540
R=vegorov@google.com

Review URL: https://codereview.chromium.org/2016653002 .
2016-05-26 12:18: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
Ryan Macnak
7bdf01560a Speculatively revert "Make the object store visible in Observatory."
This reverts commit 2eb8408969.

TBR=turnidge@google.com

Review URL: https://codereview.chromium.org/2002253005 .
2016-05-25 17:33:52 -07: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
Paul Berry
f1bd126241 Migrate UnlinkedVariable.constExpr to UnlinkedExecutable.bodyExpr.
To do AST-based type inference involving function closures, we will
need to be able to store closure body expressions in unlinked
summaries--this requires adding a `bodyExpr` field to
UnlinkedExecutable.  Since every UnlinkedVariable with a body
expression has a corresponding UnlinkedExecutable representing its
initializer, it makes sense to store the constant expression there for
uniformity.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/2013883003 .
2016-05-25 15:22:49 -07:00
Paul Berry
b1afdec64c Fix type errors introduced by 8fdeb785fd
TBR=srawlins@google.com

Review URL: https://codereview.chromium.org/2016533002 .
2016-05-25 15:20:42 -07:00
Sam Rawlins
8fdeb785fd Add label support to ExitDetector
BUG=https://github.com/dart-lang/sdk/issues/26534
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2008363002 .
2016-05-25 14:04:22 -07:00