Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(453)

Unified Diff: pkg/analyzer/lib/src/context/context.dart

Issue 1204373002: Initial version of limiting invalidation. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fixes for review comments. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/context/cache.dart ('k') | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/context/context.dart
diff --git a/pkg/analyzer/lib/src/context/context.dart b/pkg/analyzer/lib/src/context/context.dart
index f9a2b9d3679c1591335e68465bdd23b5871778f9..067af95865feaaa461d93f1b06f9043db6d8a5de 100644
--- a/pkg/analyzer/lib/src/context/context.dart
+++ b/pkg/analyzer/lib/src/context/context.dart
@@ -35,6 +35,7 @@ import 'package:analyzer/src/task/dart_work_manager.dart';
import 'package:analyzer/src/task/driver.dart';
import 'package:analyzer/src/task/html.dart';
import 'package:analyzer/src/task/html_work_manager.dart';
+import 'package:analyzer/src/task/incremental_element_builder.dart';
import 'package:analyzer/src/task/manager.dart';
import 'package:analyzer/task/dart.dart';
import 'package:analyzer/task/general.dart';
@@ -1720,7 +1721,31 @@ class AnalysisContextImpl implements InternalAnalysisContext {
} catch (e) {}
}
// We need to invalidate the cache.
- entry.setState(CONTENT, CacheState.INVALID);
+ {
+ Object delta = null;
+ if (AnalysisEngine.instance.limitInvalidationInTaskModel &&
+ AnalysisEngine.isDartFileName(source.fullName)) {
+ // TODO(scheglov) Incorrect implementation in general.
+ entry.setState(TOKEN_STREAM, CacheState.FLUSHED);
+ entry.setState(SCAN_ERRORS, CacheState.FLUSHED);
+ entry.setState(PARSED_UNIT, CacheState.FLUSHED);
+ entry.setState(PARSE_ERRORS, CacheState.FLUSHED);
+ CompilationUnit oldUnit = getResolvedCompilationUnit2(source, source);
+ if (oldUnit != null) {
+ CompilationUnit newUnit = parseCompilationUnit(source);
+ IncrementalCompilationUnitElementBuilder builder =
+ new IncrementalCompilationUnitElementBuilder(oldUnit, newUnit);
+ builder.build();
+ CompilationUnitElementDelta unitDelta = builder.unitDelta;
+ DartDelta dartDelta = new DartDelta(source);
+ dartDelta.hasDirectiveChange = unitDelta.hasDirectiveChange;
+ unitDelta.addedDeclarations.forEach(dartDelta.elementAdded);
+ unitDelta.removedDeclarations.forEach(dartDelta.elementRemoved);
+ delta = dartDelta;
+ }
+ }
+ entry.setState(CONTENT, CacheState.INVALID, delta: delta);
+ }
dartWorkManager.applyChange(
Source.EMPTY_LIST, <Source>[source], Source.EMPTY_LIST);
htmlWorkManager.applyChange(
@@ -1770,6 +1795,9 @@ class AnalysisContextImpl implements InternalAnalysisContext {
* TODO(scheglov) A hackish, limited incremental resolution implementation.
*/
bool _tryPoorMansIncrementalResolution(Source unitSource, String newCode) {
+ if (AnalysisEngine.instance.limitInvalidationInTaskModel) {
+ return false;
+ }
return PerformanceStatistics.incrementalAnalysis.makeCurrentWhile(() {
incrementalResolutionValidation_lastUnitSource = null;
incrementalResolutionValidation_lastLibrarySource = null;
« no previous file with comments | « pkg/analyzer/lib/src/context/cache.dart ('k') | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698