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

Unified Diff: pkg/analyzer/lib/src/dart/element/type.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/element/type.dart
diff --git a/pkg/analyzer/lib/src/dart/element/type.dart b/pkg/analyzer/lib/src/dart/element/type.dart
index ea3baf5173532ff30441c1d1957808348a1788b2..0ee0b9795dc44fdb255d51b4e1b97b404fc96272 100644
--- a/pkg/analyzer/lib/src/dart/element/type.dart
+++ b/pkg/analyzer/lib/src/dart/element/type.dart
@@ -864,13 +864,16 @@ class FunctionTypeImpl extends TypeImpl implements FunctionType {
*/
void _forEachParameterType(
ParameterKind kind, callback(String name, DartType type)) {
- if (baseParameters.isEmpty) {
+ List<ParameterElement> parameters = baseParameters;
+ if (parameters.isEmpty) {
return;
}
List<DartType> typeParameters =
TypeParameterTypeImpl.getTypes(this.typeParameters);
- for (ParameterElement parameter in baseParameters) {
+ int length = parameters.length;
+ for (int i = 0; i < length; i++) {
+ ParameterElement parameter = parameters[i];
if (parameter.parameterKind == kind) {
TypeImpl type = parameter.type ?? DynamicTypeImpl.instance;
if (typeArguments.length != 0 &&
@@ -1184,13 +1187,12 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
InterfaceTypeImpl._(Element element, String name, this.prunedTypedefs)
: super(element, name);
-
@override
List<PropertyAccessorElement> get accessors {
if (_accessors == null) {
List<PropertyAccessorElement> accessors = element.accessors;
List<PropertyAccessorElement> members =
- new List<PropertyAccessorElement>(accessors.length);
+ new List<PropertyAccessorElement>(accessors.length);
for (int i = 0; i < accessors.length; i++) {
members[i] = PropertyAccessorMember.from(accessors[i], this);
}
@@ -1199,7 +1201,6 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
return _accessors;
}
-
@override
List<ConstructorElement> get constructors {
if (_constructors == null) {

Powered by Google App Engine
This is Rietveld 408576698