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

Side by Side Diff: pkg/analyzer/lib/src/task/dart.dart

Issue 1917893003: Optimize the task to re-resolve instance fields (issue 26306) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Add comment Created 4 years, 8 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library analyzer.src.task.dart; 5 library analyzer.src.task.dart;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
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 4499 matching lines...) Expand 10 before | Expand all | Expand 10 after
4510 // 4510 //
4511 LibraryElement libraryElement = getRequiredInput(LIBRARY_INPUT); 4511 LibraryElement libraryElement = getRequiredInput(LIBRARY_INPUT);
4512 CompilationUnit unit = getRequiredInput(UNIT_INPUT); 4512 CompilationUnit unit = getRequiredInput(UNIT_INPUT);
4513 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); 4513 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT);
4514 4514
4515 CompilationUnitElement unitElement = unit.element; 4515 CompilationUnitElement unitElement = unit.element;
4516 if (context.analysisOptions.strongMode) { 4516 if (context.analysisOptions.strongMode) {
4517 // 4517 //
4518 // Resolve references. 4518 // Resolve references.
4519 // 4519 //
4520 // TODO(leafp): This code only needs to re-resolve the right hand sides of 4520 InstanceFieldResolverVisitor visitor = new InstanceFieldResolverVisitor(
4521 // instance fields. We could do incremental resolution on each field
4522 // only using the incremental resolver. However, this caused a massive
4523 // performance degredation on the large_class_declaration_test.dart test.
4524 // I would hypothesize that incremental resolution of field is linear in
4525 // the size of the enclosing class, and hence incrementally resolving each
4526 // field was quadratic. We may wish to revisit this if we can resolve
4527 // this performance issue.
4528 PartialResolverVisitor visitor = new PartialResolverVisitor(
4529 libraryElement, 4521 libraryElement,
4530 unitElement.source, 4522 unitElement.source,
4531 typeProvider, 4523 typeProvider,
4532 AnalysisErrorListener.NULL_LISTENER); 4524 AnalysisErrorListener.NULL_LISTENER);
4533 unit.accept(visitor); 4525 visitor.resolveCompilationUnit(unit);
4534 } 4526 }
4535 // 4527 //
4536 // Record outputs. 4528 // Record outputs.
4537 // 4529 //
4538 outputs[RESOLVED_UNIT9] = unit; 4530 outputs[RESOLVED_UNIT9] = unit;
4539 outputs[CREATED_RESOLVED_UNIT9] = true; 4531 outputs[CREATED_RESOLVED_UNIT9] = true;
4540 } 4532 }
4541 4533
4542 /** 4534 /**
4543 * Return a map from the names of the inputs of this kind of task to the task 4535 * Return a map from the names of the inputs of this kind of task to the task
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
5549 5541
5550 @override 5542 @override
5551 bool moveNext() { 5543 bool moveNext() {
5552 if (_newSources.isEmpty) { 5544 if (_newSources.isEmpty) {
5553 return false; 5545 return false;
5554 } 5546 }
5555 currentTarget = _newSources.removeLast(); 5547 currentTarget = _newSources.removeLast();
5556 return true; 5548 return true;
5557 } 5549 }
5558 } 5550 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698