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

Unified Diff: pkg/analyzer/lib/src/dart/resolver/inheritance_manager.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/inheritance_manager.dart
diff --git a/pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart b/pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart
index 6bdabc94d69031cd94b02246fad31f40ca1eb8eb..0e0229cb5ebc28b2a811a395312a2e2548ef3748 100644
--- a/pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart
@@ -525,7 +525,9 @@ class InheritanceManager {
//
// Interface elements
//
- for (InterfaceType interfaceType in interfaces) {
+ int interfaceLength = interfaces.length;
+ for (int i = 0; i < interfaceLength; i++) {
+ InterfaceType interfaceType = interfaces[i];
ClassElement interfaceElement = interfaceType.element;
if (interfaceElement != null) {
if (!visitedInterfaces.contains(interfaceElement)) {
@@ -561,26 +563,27 @@ class InheritanceManager {
}
/**
- * Given some [ClassElement], this method finds and returns the [ExecutableElement] of
- * the passed name in the class element. Static members, members in super types and members not
- * accessible from the current library are not considered.
- *
- * @param classElt the class element to query
- * @param memberName the name of the member to lookup in the class
- * @return the found [ExecutableElement], or `null` if no such member was found
+ * Given some [classElement], this method finds and returns the executable
+ * element with the given [memberName] in the class element. Static members,
+ * members in super types and members not accessible from the current library
+ * are not considered.
*/
ExecutableElement _lookupMemberInClass(
- ClassElement classElt, String memberName) {
- List<MethodElement> methods = classElt.methods;
- for (MethodElement method in methods) {
+ ClassElement classElement, String memberName) {
+ List<MethodElement> methods = classElement.methods;
+ int methodLength = methods.length;
+ for (int i = 0; i < methodLength; i++) {
+ MethodElement method = methods[i];
if (memberName == method.name &&
method.isAccessibleIn(_library) &&
!method.isStatic) {
return method;
}
}
- List<PropertyAccessorElement> accessors = classElt.accessors;
- for (PropertyAccessorElement accessor in accessors) {
+ List<PropertyAccessorElement> accessors = classElement.accessors;
+ int accessorLength = accessors.length;
+ for (int i = 0; i < accessorLength; i++) {
+ PropertyAccessorElement accessor = accessors[i];
if (memberName == accessor.name &&
accessor.isAccessibleIn(_library) &&
!accessor.isStatic) {

Powered by Google App Engine
This is Rietveld 408576698