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

Unified Diff: pkg/analyzer/lib/src/dart/resolver/scope.dart

Issue 2015513003: Optimize more megamorphic dispatch sites (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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
Index: pkg/analyzer/lib/src/dart/resolver/scope.dart
diff --git a/pkg/analyzer/lib/src/dart/resolver/scope.dart b/pkg/analyzer/lib/src/dart/resolver/scope.dart
index 0b17d711236ed06f122ae0181804f793111dd960..e90ba8619d8c29e80b562fab5adc395d6b216e2f 100644
--- a/pkg/analyzer/lib/src/dart/resolver/scope.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/scope.dart
@@ -57,11 +57,15 @@ class ClassScope extends EnclosedScope {
* Define the instance members defined by the given [classElement].
*/
void _defineMembers(ClassElement classElement) {
- for (PropertyAccessorElement accessor in classElement.accessors) {
- define(accessor);
+ List<PropertyAccessorElement> accessors = classElement.accessors;
+ int accessorLength = accessors.length;
+ for (int i = 0; i < accessorLength; i++) {
+ define(accessors[i]);
}
- for (MethodElement method in classElement.methods) {
- define(method);
+ List<MethodElement> methods = classElement.methods;
+ int methodLength = methods.length;
+ for (int i = 0; i < methodLength; i++) {
+ define(methods[i]);
}
}
}
@@ -174,7 +178,10 @@ class FunctionScope extends EnclosedScope {
}
_parametersDefined = true;
Scope parameterScope = enclosingScope;
- for (ParameterElement parameter in _functionElement.parameters) {
+ List<ParameterElement> parameters = _functionElement.parameters;
+ int length = parameters.length;
+ for (int i = 0; i < length; i++) {
+ ParameterElement parameter = parameters[i];
if (!parameter.isInitializingFormal) {
parameterScope.define(parameter);
}
@@ -186,8 +193,10 @@ class FunctionScope extends EnclosedScope {
*/
void _defineTypeParameters() {
Scope typeParameterScope = enclosingScope.enclosingScope;
- for (TypeParameterElement typeParameter
- in _functionElement.typeParameters) {
+ List<TypeParameterElement> typeParameters = _functionElement.typeParameters;
+ int length = typeParameters.length;
+ for (int i = 0; i < length; i++) {
+ TypeParameterElement typeParameter = typeParameters[i];
typeParameterScope.define(typeParameter);
}
}

Powered by Google App Engine
This is Rietveld 408576698