Commit Graph

7128 Commits

Author SHA1 Message Date
Konstantin Shcheglov dbd2463d6d Don't schedule LIBRARY_ERRORS_READY for libraries that should not be analyzed.
This helps to save about 1500 ms, or about 10% on the analyzer project.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1155473003
2015-05-24 10:00:21 -07:00
Konstantin Shcheglov 4ca0c7acbb Adapt the existing incremental resolution implementation to the new model.
This is hopefully a temporary implementation, to be used until we have a
proper task-based version. Otherwise the new task model is too slow to
conveniently dogfood it.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1144023009
2015-05-23 16:56:01 -07:00
Brian Wilkerson ad2b8a43c8 Fix context creation in tests
R=scheglov@google.com

Review URL: https://codereview.chromium.org//1149723004
2015-05-22 14:25:29 -07:00
Konstantin Shcheglov 224734d4e4 Manage 'libraries containing part' in DartWorkManager.
It is on the couple critical paths:
1. getErrors()
2. SearchEngine.

The SearchEngine is used in both search itself and by completion.
Without this change search has n^2 complexity, where `n` is the number of targets.

Statistics for search shows more than 10x performance improvement.
Before: 70 ms (analyzer), 230 ms (analyzer + dart2js).
After: 6 ms (analyzer), 17 ms (analyzer + dart2js).

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1152773002
2015-05-22 09:20:55 -07:00
Konstantin Shcheglov 50f786ad50 Use UnlimitedCacheFlushManager for DEFAULT_CACHING_POLICY.
By doing so we avoid _flushManagerMap lookups and also don't do anything for unlimited results.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1151193002
2015-05-22 08:11:19 -07:00
Konstantin Shcheglov 326816f571 Optimize AnalysisContext.getSourcesWithFullName().
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1151563004
2015-05-21 16:05:51 -07:00
Konstantin Shcheglov 85da53429b Fix for a memory leak in CacheFlushManager.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1154563002
2015-05-21 13:52:13 -07:00
Konstantin Shcheglov deddddc9e5 Add and use AnalysisCache.sources getter.
This is not ideal, we might still want to start managing 'containingLibraries' at some point.

But it speeds up switching between file 10x - DartCompletionCache request of all top-level elements takes now about 170 ms, vs. 1800 ms before.

Also, we need "sources" in many places of AnalysisContext.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1149893004
2015-05-21 08:33:27 -07:00
Konstantin Shcheglov b6fbad3348 Reuse CompilationUnitElement in BuildCompilationUnitElementTask.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1148153002
2015-05-20 11:12:26 -07:00
Paul Berry e519fb8afb In constant evaluation, handle annotation referring to non-const constructor.
We need to be more careful about this in the new task model, since the
new task model is more aggressive about chasing dependencies, and we
don't want constant evaluation to try to visit a non-const
constructor.

R=scheglov@google.com

Review URL: https://codereview.chromium.org//1145913002
2015-05-20 09:25:41 -07:00
Paul Berry e2366de610 Generate the proper error when a constant refers to itself.
BUG=dartbug.com/23490
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//1131383008
2015-05-19 19:37:19 -07:00
Brian Wilkerson 0e8520eaa9 Create default tasks if plugins are not being used
R=scheglov@google.com

Review URL: https://codereview.chromium.org//1140313003
2015-05-19 14:12:13 -07:00
Paul Berry a9982b0e02 Properly handle circular references among constants in the task model.
Tasks may now override the getter "handlesDependencyCycles" to return
true to indicate that they can deal with circular dependencies.  Most
tasks will not have to do this, since outside of constant evaluation
circular dependencies among tasks should only be possible due to an
analyzer bug.

Any task that handles dependency cycles can detect that a cycle has
occurred by consulting AnalysisTask.dependencyCycle inside its
internalPerform() method.  The ComputeConstantValueTask uses this to
determine which constants are involved in the cycle.

This required modifying the TaskInputBuilder classes so that if the
current input can't be evaluated due to a circularity, they can
continue on to evaluate other inputs.  This allows the circularity to
be reported on the whole strongly connected component, rather than
just the firs cycle that was noticed (which would be
nondeterministic).

R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org//1147853002
2015-05-19 12:43:28 -07:00
Paul Berry eb6d1e2579 Fix constant evaluation dependency analysis for const external factories.
With the current constant evaluator, the bug is benign because we only
do dependency analysis within a library cycle, and the library cycle
containing dart:core (which is the only library cycle with const
external factories) contains no invocations of those const external
factories.

But in the new task model we do full dependency analysis across
library cycles, so the dependency analysis needs to be correct in
order for the const external factory to be safely invoked.

R=scheglov@google.com

Review URL: https://codereview.chromium.org//1134343003
2015-05-18 13:18:24 -07:00
Konstantin Shcheglov 4936eb8d5d Fix for 'Create part' Quick Fix.
1. NonExistingSource.modificationStamp should return -1.
2. NonExistingSource.fullName should be always an absolute path, not a URI.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1135073004
2015-05-18 11:55:23 -07:00
Brian Wilkerson 1a3e349409 Handle type parameters correctly when generating hints (issue 23243)
R=scheglov@google.com

Review URL: https://codereview.chromium.org//1142853002
2015-05-18 10:41:11 -07:00
scheglov@google.com a9d194d049 Always send errors/lines with parsed/resolved units.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45812 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-15 15:44:29 +00:00
paulberry@google.com 955a7c53a3 Modify WorkOrder to use a dependency walking algorithm that handles cycles.
There is no functional change in the behavior of the WorkOrder class;
if a cycle is found, we still set the ".exception" field in all the
work items involved in the cycle.

In a follow-up CL I will add the ability to override this behavior
when computing constant values.

R=brianwilkerson@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45800 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-14 22:38:26 +00:00
scheglov@google.com dd451d1424 Move DartWorkManager notification to _sourceChanged().
This fixes scheduling analysis after overlay changes.

R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45797 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-14 21:51:38 +00:00
paulberry@google.com 80e7ee46a6 In the new task model, use explicit dependencies on the type provider.
Previously, some of the tasks got the type provider from the context,
which meant we were at risk of invoking the task manager reentrantly
(which might have broken some task manager assumptions and potentially
degraded responsiveness).  With this CL, all tasks that need the type
provider get it using an explicit input.

Assertions are added so that if we accidentally introduce future code
paths that invoke the task manager in a reentrant fashion, we will see
the problem during unit tests.

R=brianwilkerson@google.com, scheglov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45794 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-14 19:49:32 +00:00
scheglov@google.com 4b942318c9 Don't invalidate dependent results when set values.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45793 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-14 19:45:39 +00:00
scheglov@google.com 47534318f6 Fix for invalidating results of a target being removed.
Tweaks for tests.

R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45785 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-14 14:33:08 +00:00
scheglov@google.com 6c66bbac50 Return empty contents for not existing sources.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45778 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-13 20:51:04 +00:00
paulberry@google.com 13af577c37 Rename CONSTANT_RESOLVED_UNIT to RESOLVED_UNIT.
And move the old RESOLVED_UNIT out of the public API and rename it to
RESOLVED_UNIT6.

R=brianwilkerson@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45777 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-13 20:41:10 +00:00
scheglov@google.com 9741a34885 Move getErrors() to DartWorkManager, report errors in ChangeNotice(s).
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45766 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-13 16:28:20 +00:00
scheglov@google.com 6e25226a0d Issue 23444. Use ConstructorMember(s) for super constructor fixes.
R=brianwilkerson@google.com
BUG= https://code.google.com/p/dart/issues/detail?id=23444

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45765 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-13 16:13:09 +00:00
scheglov@google.com dfd26c038b Create ChangeNotice(s) and set parsed/resolved units.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45736 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-12 13:52:20 +00:00
scheglov@google.com e6b4fbd402 Validate modifications times only for sources.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45724 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-12 01:50:13 +00:00
scheglov@google.com 0bb38ab8b9 Prioritize scheduling analysis for priority sources.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45722 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-12 00:29:15 +00:00
paulberry@google.com 130376558f Add a task for computing all constant values in a compilation unit.
R=brianwilkerson@google.com, scheglov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45719 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-11 22:18:02 +00:00
scheglov@google.com 7bcc0c21f9 Remove unused DartWorkManager.librarySources/partSources.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45717 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-11 20:52:26 +00:00
paulberry@google.com 0e4d3d0190 Unify evaluation of annotations with evaluation of other constants.
R=brianwilkerson@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45713 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-11 19:35:26 +00:00
scheglov@google.com 270980e22a Add AnalysisCache.getState() and getValue().
There is a small functionality change, I think a valid one.
We don't check is the value is valid, we ask the CacheEntry, which updates the flush manager.

R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45710 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-11 19:26:20 +00:00
brianwilkerson@google.com e114ef8457 Fix context tests
R=scheglov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45709 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-11 19:23:32 +00:00
scheglov@google.com c2de14f6c5 Implement AnalysisContext.ensureResolvedDartUnits().
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45707 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-11 18:49:03 +00:00
scheglov@google.com 6bc350e543 After every change iterate over the cache to find invalidated libraries and reschedule them.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45696 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-11 16:59:31 +00:00
scheglov@google.com b6bccf200d Use WorkManager(s) in AnalysisDriver.
Install DartWorkManager in AnalysisContextImpl.

R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45690 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-11 15:16:19 +00:00
scheglov@google.com 88973df145 Add DartWorkManager to manage Dart-specific results computation scheduling.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45677 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-09 23:22:21 +00:00
brianwilkerson@google.com 81e474c43e Clean up many generated constructors
R=scheglov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45676 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-09 19:06:12 +00:00
paulberry@google.com b901fbcf95 Add a "librarySource" field to CompilationUnitElementImpl.
This fixes a dependency problem in ComputeConstantDependenciesTask.
Prevously it used element.library.source to get access to the library
source, but this created an implicit dependency on LIBRARY_ELEMENT1
(since element.library is null if the library element hasn't been
built yet).  There was no way to make that dependency explicit since
previous to this change, the CompilationUnitElement did not store
enough information to determine what library it was part of until
after the library element had been created.

R=brianwilkerson@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45674 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-09 01:19:17 +00:00
scheglov@google.com 73f176d45e Add LIBRARY_ERRORS result.
This result will work as a top-level target for Dart work manager.

R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45668 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-08 23:11:13 +00:00
brianwilkerson@google.com d14e5042bb Removed CLASS_ELEMENTS from BuildCompilationUnitElementTask and cleaned up comments
R=scheglov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45661 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-08 21:39:59 +00:00
paulberry@google.com e51ffadb87 Add a task to the new task model for computing constant values.
Not yet implemented: proper handling of circular references.

R=brianwilkerson@google.com, scheglov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45651 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-08 19:44:41 +00:00
scheglov@google.com 262ba21fef When a target is removed, invalidate all dependent results.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45650 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-08 19:27:39 +00:00
scheglov@google.com bd51645937 Automatically remove empty entries from the cache.
Now we use Element(s) and other "big" structures as keys.
So, now we need a mechanism to remove entries with their keys altogether,
not just removing associated data.

R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45648 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-08 16:59:09 +00:00
scheglov@google.com 2d41ec2079 Remove memento.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45645 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-08 15:11:47 +00:00
paulberry@google.com 728e9b3a9e Create a task in the new task model to compute constant dependencies.
This is the first of several planned tasks for constant evaluation.

R=brianwilkerson@google.com, scheglov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45624 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-08 00:36:45 +00:00
brianwilkerson@google.com ed28cd5969 Progress toward new AnalysisContextImpl
R=scheglov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45623 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-07 23:19:46 +00:00
scheglov@google.com 194d48f9da Set CacheEntry.target in the contructor.
R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45619 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-07 21:04:51 +00:00
scheglov@google.com 61a371476b Remove unused InternalAnalysisContext.addSourceInfo().
The analysis cache is now accessible, if we will ever need this feature again.

R=brianwilkerson@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45616 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-07 20:17:13 +00:00