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

Side by Side Diff: pkg/analyzer/lib/src/dart/analysis/file_state.dart

Issue 2917183003: update the analyzer and analysis server perf tags (Closed)
Patch Set: Created 3 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 unified diff | Download patch
OLDNEW
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:convert'; 6 import 'dart:convert';
7 import 'dart:typed_data'; 7 import 'dart:typed_data';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 } 378 }
379 379
380 /** 380 /**
381 * Return a new parsed unresolved [CompilationUnit]. 381 * Return a new parsed unresolved [CompilationUnit].
382 */ 382 */
383 CompilationUnit parse(AnalysisErrorListener errorListener) { 383 CompilationUnit parse(AnalysisErrorListener errorListener) {
384 AnalysisOptions analysisOptions = _fsState._analysisOptions; 384 AnalysisOptions analysisOptions = _fsState._analysisOptions;
385 385
386 if (USE_FASTA_PARSER) { 386 if (USE_FASTA_PARSER) {
387 try { 387 try {
388 fasta.ScannerResult scanResult = fasta.scan(_contentBytes, 388 fasta.ScannerResult scanResult =
389 PerformanceStatistics.scan.makeCurrentWhile(() {
390 return fasta.scan(
391 _contentBytes,
389 includeComments: true, 392 includeComments: true,
390 scanGenericMethodComments: analysisOptions.strongMode); 393 scanGenericMethodComments: analysisOptions.strongMode,
394 );
395 });
391 396
392 var astBuilder = new fasta.AstBuilder( 397 var astBuilder = new fasta.AstBuilder(
393 new ErrorReporter(errorListener, source), 398 new ErrorReporter(errorListener, source),
394 null, 399 null,
395 null, 400 null,
396 new _FastaElementStoreProxy(), 401 new _FastaElementStoreProxy(),
397 new fasta.Scope.top(isModifiable: true), 402 new fasta.Scope.top(isModifiable: true),
398 uri); 403 uri);
399 astBuilder.parseGenericMethodComments = analysisOptions.strongMode; 404 astBuilder.parseGenericMethodComments = analysisOptions.strongMode;
400 405
401 var parser = new fasta.Parser(astBuilder); 406 var parser = new fasta.Parser(astBuilder);
402 astBuilder.parser = parser; 407 astBuilder.parser = parser;
403 parser.parseUnit(scanResult.tokens); 408 parser.parseUnit(scanResult.tokens);
404 var unit = astBuilder.pop() as CompilationUnit; 409 var unit = astBuilder.pop() as CompilationUnit;
405 410
406 LineInfo lineInfo = new LineInfo(scanResult.lineStarts); 411 LineInfo lineInfo = new LineInfo(scanResult.lineStarts);
407 unit.lineInfo = lineInfo; 412 unit.lineInfo = lineInfo;
408 return unit; 413 return unit;
409 } catch (e, st) { 414 } catch (e, st) {
415 // TODO(devoncarew): We likely shouldn't be doing raw prints here.
Brian Wilkerson 2017/06/03 23:16:37 You're right. We should minimally use the instrume
scheglov 2017/06/04 00:30:44 This branch does not work yet for anyone but us, a
devoncarew 2017/06/04 01:45:52 Removed the TODO: - I expect this will get cleaned
410 print(e); 416 print(e);
411 print(st); 417 print(st);
412 rethrow; 418 rethrow;
413 } 419 }
414 } else { 420 } else {
415 CharSequenceReader reader = new CharSequenceReader(content); 421 CharSequenceReader reader = new CharSequenceReader(content);
416 Scanner scanner = new Scanner(source, reader, errorListener); 422 Scanner scanner = new Scanner(source, reader, errorListener);
417 scanner.scanGenericMethodComments = analysisOptions.strongMode; 423 scanner.scanGenericMethodComments = analysisOptions.strongMode;
418 Token token = scanner.tokenize(); 424 Token token = PerformanceStatistics.scan.makeCurrentWhile(() {
425 return scanner.tokenize();
426 });
419 LineInfo lineInfo = new LineInfo(scanner.lineStarts); 427 LineInfo lineInfo = new LineInfo(scanner.lineStarts);
420 428
421 Parser parser = new Parser(source, errorListener); 429 Parser parser = new Parser(source, errorListener);
422 parser.enableAssertInitializer = analysisOptions.enableAssertInitializer; 430 parser.enableAssertInitializer = analysisOptions.enableAssertInitializer;
423 parser.parseGenericMethodComments = analysisOptions.strongMode; 431 parser.parseGenericMethodComments = analysisOptions.strongMode;
424 CompilationUnit unit = parser.parseCompilationUnit(token); 432 CompilationUnit unit = parser.parseCompilationUnit(token);
scheglov 2017/06/04 00:30:44 Instrument parsing here. This will cover parsing f
devoncarew 2017/06/04 01:45:52 I instrumented the whole (enclosing) method with t
425 unit.lineInfo = lineInfo; 433 unit.lineInfo = lineInfo;
426 return unit; 434 return unit;
427 } 435 }
428 } 436 }
429 437
430 /** 438 /**
431 * Read the file content and ensure that all of the file properties are 439 * Read the file content and ensure that all of the file properties are
432 * consistent with the read content, including API signature. 440 * consistent with the read content, including API signature.
433 * 441 *
434 * Return `true` if the API signature changed since the last refresh. 442 * Return `true` if the API signature changed since the last refresh.
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 _FastaElementProxy operator [](fasta.Builder builder) => 939 _FastaElementProxy operator [](fasta.Builder builder) =>
932 _elements.putIfAbsent(builder, () => new _FastaElementProxy()); 940 _elements.putIfAbsent(builder, () => new _FastaElementProxy());
933 941
934 @override 942 @override
935 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 943 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
936 } 944 }
937 945
938 class _FastaInterfaceTypeProxy implements fasta.KernelInterfaceType { 946 class _FastaInterfaceTypeProxy implements fasta.KernelInterfaceType {
939 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 947 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
940 } 948 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698