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

Unified Diff: pkg/analyzer/lib/task/model.dart

Issue 1383043002: Stop defensively copying AST structures before resolution (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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/task/model.dart ('k') | pkg/analyzer/test/src/context/context_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/task/model.dart
diff --git a/pkg/analyzer/lib/task/model.dart b/pkg/analyzer/lib/task/model.dart
index 018b349cec3c6421e94454a5318b05247b31971e..9d949c308f836f0ec532fef3850f5e63d5bb39ff 100644
--- a/pkg/analyzer/lib/task/model.dart
+++ b/pkg/analyzer/lib/task/model.dart
@@ -5,6 +5,7 @@
library analyzer.task.model;
import 'dart:collection';
+import 'dart:developer';
import 'package:analyzer/src/generated/engine.dart' hide AnalysisTask;
import 'package:analyzer/src/generated/error.dart' show AnalysisError;
@@ -84,6 +85,12 @@ abstract class AnalysisTask {
static final Map<Type, int> countMap = new HashMap<Type, int>();
/**
+ * A table mapping the types of analysis tasks to user tags used to collect
+ * timing data for the Observatory.
+ */
+ static Map<Type, UserTag> tagMap = new HashMap<Type, UserTag>();
+
+ /**
* A table mapping the types of analysis tasks to stopwatches used to compute
* how much time was spent executing each kind of task.
*/
@@ -228,11 +235,15 @@ abstract class AnalysisTask {
//
int count = countMap[runtimeType];
countMap[runtimeType] = count == null ? 1 : count + 1;
+// UserTag tag = tagMap.putIfAbsent(
+// runtimeType, () => new UserTag(runtimeType.toString()));
Stopwatch stopwatch = stopwatchMap[runtimeType];
if (stopwatch == null) {
stopwatch = new Stopwatch();
stopwatchMap[runtimeType] = stopwatch;
}
+// UserTag previousTag = tag.makeCurrent();
+// try {
stopwatch.start();
//
// Actually perform the task.
@@ -245,6 +256,9 @@ abstract class AnalysisTask {
} finally {
stopwatch.stop();
}
+// } finally {
+// previousTag.makeCurrent();
+// }
} on AnalysisException {
rethrow;
} catch (exception, stackTrace) {
@@ -272,7 +286,7 @@ abstract class ListResultDescriptor<E> implements ResultDescriptor<List<E>> {
E>;
@override
- ListTaskInput<E> of(AnalysisTarget target);
+ ListTaskInput<E> of(AnalysisTarget target, {bool flushOnAccess: false});
}
/**
@@ -387,9 +401,10 @@ abstract class ResultDescriptor<V> {
/**
* Return a task input that can be used to compute this result for the given
- * [target].
+ * [target]. If [flushOnAccess] is `true` then the value of this result that
+ * is associated with the [target] will be flushed when it is accessed.
*/
- TaskInput<V> of(AnalysisTarget target);
+ TaskInput<V> of(AnalysisTarget target, {bool flushOnAccess: false});
}
/**
@@ -530,6 +545,12 @@ abstract class TaskInputBuilder<V> {
void set currentValue(Object value);
/**
+ * Return `true` if the value accessed by this input builder should be flushed
+ * from the cache at the time it is retrieved.
+ */
+ bool get flushOnAccess;
+
+ /**
* Return the [value] that was computed by this builder.
*
* Throws a [StateError] if [moveNext] has not been invoked or if the last
« no previous file with comments | « pkg/analyzer/lib/src/task/model.dart ('k') | pkg/analyzer/test/src/context/context_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698