Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 import 'dart:typed_data'; | 7 import 'dart:typed_data'; |
| 8 | 8 |
| 9 import 'package:analyzer/context/context_root.dart'; | 9 import 'package:analyzer/context/context_root.dart'; |
| 10 import 'package:analyzer/context/declared_variables.dart'; | 10 import 'package:analyzer/context/declared_variables.dart'; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 import 'package:analyzer/src/dart/analysis/search.dart'; | 24 import 'package:analyzer/src/dart/analysis/search.dart'; |
| 25 import 'package:analyzer/src/dart/analysis/status.dart'; | 25 import 'package:analyzer/src/dart/analysis/status.dart'; |
| 26 import 'package:analyzer/src/dart/analysis/top_level_declaration.dart'; | 26 import 'package:analyzer/src/dart/analysis/top_level_declaration.dart'; |
| 27 import 'package:analyzer/src/generated/engine.dart' | 27 import 'package:analyzer/src/generated/engine.dart' |
| 28 show AnalysisContext, AnalysisEngine, AnalysisOptions; | 28 show AnalysisContext, AnalysisEngine, AnalysisOptions; |
| 29 import 'package:analyzer/src/generated/source.dart'; | 29 import 'package:analyzer/src/generated/source.dart'; |
| 30 import 'package:analyzer/src/lint/registry.dart' as linter; | 30 import 'package:analyzer/src/lint/registry.dart' as linter; |
| 31 import 'package:analyzer/src/summary/format.dart'; | 31 import 'package:analyzer/src/summary/format.dart'; |
| 32 import 'package:analyzer/src/summary/idl.dart'; | 32 import 'package:analyzer/src/summary/idl.dart'; |
| 33 import 'package:analyzer/src/summary/package_bundle_reader.dart'; | 33 import 'package:analyzer/src/summary/package_bundle_reader.dart'; |
| 34 import 'package:analyzer/src/task/driver.dart'; | |
| 34 import 'package:front_end/src/base/api_signature.dart'; | 35 import 'package:front_end/src/base/api_signature.dart'; |
| 35 import 'package:front_end/src/base/performace_logger.dart'; | 36 import 'package:front_end/src/base/performace_logger.dart'; |
| 36 import 'package:front_end/src/incremental/byte_store.dart'; | 37 import 'package:front_end/src/incremental/byte_store.dart'; |
| 37 import 'package:meta/meta.dart'; | 38 import 'package:meta/meta.dart'; |
| 38 | 39 |
| 39 /** | 40 /** |
| 40 * This class computes [AnalysisResult]s for Dart files. | 41 * This class computes [AnalysisResult]s for Dart files. |
| 41 * | 42 * |
| 42 * Let the set of "explicitly analyzed files" denote the set of paths that have | 43 * Let the set of "explicitly analyzed files" denote the set of paths that have |
| 43 * been passed to [addFile] but not subsequently passed to [removeFile]. Let | 44 * been passed to [addFile] but not subsequently passed to [removeFile]. Let |
| (...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 971 // Skip reading if the signature, so errors, are the same as the last time. | 972 // Skip reading if the signature, so errors, are the same as the last time. |
| 972 if (skipIfSameSignature) { | 973 if (skipIfSameSignature) { |
| 973 assert(!withUnit); | 974 assert(!withUnit); |
| 974 if (_lastProducedSignatures[path] == signature) { | 975 if (_lastProducedSignatures[path] == signature) { |
| 975 return AnalysisResult._UNCHANGED; | 976 return AnalysisResult._UNCHANGED; |
| 976 } | 977 } |
| 977 } | 978 } |
| 978 | 979 |
| 979 // If we don't need the fully resolved unit, check for the cached result. | 980 // If we don't need the fully resolved unit, check for the cached result. |
| 980 if (!withUnit) { | 981 if (!withUnit) { |
| 981 List<int> bytes = _byteStore.get(key); | 982 AnalysisResult result = driverCacheTag.makeCurrentWhile(() { |
| 982 if (bytes != null) { | 983 List<int> bytes = _byteStore.get(key); |
|
scheglov
2017/06/04 00:30:44
Maybe wrap with measuring only this statement.
Als
| |
| 983 return _getAnalysisResultFromBytes(file, signature, bytes); | 984 if (bytes != null) { |
| 985 return _getAnalysisResultFromBytes(file, signature, bytes); | |
| 986 } | |
| 987 }); | |
| 988 if (result != null) { | |
| 989 return result; | |
| 984 } | 990 } |
| 985 } | 991 } |
| 986 | 992 |
| 987 // We need the fully resolved unit, or the result is not cached. | 993 // We need the fully resolved unit, or the result is not cached. |
| 988 return _logger.run('Compute analysis result for $path', () { | 994 return _logger.run('Compute analysis result for $path', () { |
| 989 try { | 995 try { |
| 990 LibraryContext libraryContext = _createLibraryContext(library); | 996 LibraryContext libraryContext = _createLibraryContext(library); |
| 991 try { | 997 try { |
| 992 _testView.numOfAnalyzedLibraries++; | 998 _testView.numOfAnalyzedLibraries++; |
| 993 LibraryAnalyzer analyzer = new LibraryAnalyzer( | 999 LibraryAnalyzer analyzer = new LibraryAnalyzer( |
| (...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1983 libraryDeclarations.add(new TopLevelDeclarationInSource( | 1989 libraryDeclarations.add(new TopLevelDeclarationInSource( |
| 1984 file.source, declaration, isExported)); | 1990 file.source, declaration, isExported)); |
| 1985 } | 1991 } |
| 1986 } | 1992 } |
| 1987 } | 1993 } |
| 1988 | 1994 |
| 1989 // We're not done yet. | 1995 // We're not done yet. |
| 1990 return false; | 1996 return false; |
| 1991 } | 1997 } |
| 1992 } | 1998 } |
| OLD | NEW |