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

Side by Side Diff: pkg/compiler/lib/src/ssa/optimize.dart

Issue 3010943002: Add ability to look up type parameters that are associated with ClassEntities with the element envi… (Closed)
Patch Set: Created 3 years, 3 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; 5 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem;
6 import '../common/names.dart' show Selectors; 6 import '../common/names.dart' show Selectors;
7 import '../common/tasks.dart' show CompilerTask; 7 import '../common/tasks.dart' show CompilerTask;
8 import '../compiler.dart' show Compiler; 8 import '../compiler.dart' show Compiler;
9 import '../constants/constant_system.dart'; 9 import '../constants/constant_system.dart';
10 import '../constants/values.dart'; 10 import '../constants/values.dart';
11 import '../common_elements.dart' show CommonElements; 11 import '../common_elements.dart' show CommonElements;
12 import '../elements/elements.dart' show ClassElement;
13 import '../elements/entities.dart'; 12 import '../elements/entities.dart';
14 import '../elements/resolution_types.dart'; 13 import '../elements/resolution_types.dart';
15 import '../elements/types.dart'; 14 import '../elements/types.dart';
16 import '../js/js.dart' as js; 15 import '../js/js.dart' as js;
17 import '../js_backend/backend.dart'; 16 import '../js_backend/backend.dart';
18 import '../js_backend/native_data.dart' show NativeData; 17 import '../js_backend/native_data.dart' show NativeData;
19 import '../js_backend/runtime_types.dart'; 18 import '../js_backend/runtime_types.dart';
20 import '../native/native.dart' as native; 19 import '../native/native.dart' as native;
21 import '../options.dart'; 20 import '../options.dart';
22 import '../types/types.dart'; 21 import '../types/types.dart';
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 1207
1209 HInstruction source; 1208 HInstruction source;
1210 int expectedIndex = 0; 1209 int expectedIndex = 0;
1211 1210
1212 for (HInstruction argument in node.inputs) { 1211 for (HInstruction argument in node.inputs) {
1213 if (argument is HTypeInfoReadVariable) { 1212 if (argument is HTypeInfoReadVariable) {
1214 HInstruction nextSource = argument.object; 1213 HInstruction nextSource = argument.object;
1215 if (nextSource is HThis) { 1214 if (nextSource is HThis) {
1216 if (source == null) { 1215 if (source == null) {
1217 source = nextSource; 1216 source = nextSource;
1218 ClassElement contextClass = 1217 ClassEntity contextClass =
1219 nextSource.sourceElement.enclosingClass; 1218 nextSource.sourceElement.enclosingClass;
1220 if (node.inputs.length != contextClass.typeVariables.length) { 1219 if (node.inputs.length !=
1220 _closedWorld.elementEnvironment
1221 .getTypeVariables(contextClass)
1222 .length) {
Johnni Winther 2017/09/04 06:59:56 If we replace this by if (node.inputs.length !=
Emily Fortuna 2017/09/05 17:13:31 ah, my mistake. I misunderstood the distinction be
1221 return null; 1223 return null;
1222 } 1224 }
1223 if (needsSubstitutionForTypeVariableAccess(contextClass)) { 1225 if (needsSubstitutionForTypeVariableAccess(contextClass)) {
1224 return null; 1226 return null;
1225 } 1227 }
1226 } 1228 }
1227 if (nextSource != source) return null; 1229 if (nextSource != source) return null;
1228 // Check that the index is the one we expect. 1230 // Check that the index is the one we expect.
1229 int index = argument.variable.element.index; 1231 int index = argument.variable.element.index;
1230 if (index != expectedIndex++) return null; 1232 if (index != expectedIndex++) return null;
(...skipping 1754 matching lines...) Expand 10 before | Expand all | Expand 10 after
2985 2987
2986 keyedValues.forEach((receiver, values) { 2988 keyedValues.forEach((receiver, values) {
2987 result.keyedValues[receiver] = 2989 result.keyedValues[receiver] =
2988 new Map<HInstruction, HInstruction>.from(values); 2990 new Map<HInstruction, HInstruction>.from(values);
2989 }); 2991 });
2990 2992
2991 result.nonEscapingReceivers.addAll(nonEscapingReceivers); 2993 result.nonEscapingReceivers.addAll(nonEscapingReceivers);
2992 return result; 2994 return result;
2993 } 2995 }
2994 } 2996 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698