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

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

Issue 2850143002: Reuse RuntimeTypesNeedBuilderImpl and _RuntimeTypesNeed for kernel based elements (Closed)
Patch Set: Fix comment Created 3 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 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 'dart:collection'; 5 import 'dart:collection';
6 6
7 import 'package:js_runtime/shared/embedded_names.dart'; 7 import 'package:js_runtime/shared/embedded_names.dart';
8 8
9 import '../closure.dart'; 9 import '../closure.dart';
10 import '../common.dart'; 10 import '../common.dart';
(...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 addInlinedInstantiation(type); 1232 addInlinedInstantiation(type);
1233 if (!currentInlinedInstantiations.isEmpty) { 1233 if (!currentInlinedInstantiations.isEmpty) {
1234 instantiatedTypes = 1234 instantiatedTypes =
1235 new List<ResolutionInterfaceType>.from(currentInlinedInstantiations); 1235 new List<ResolutionInterfaceType>.from(currentInlinedInstantiations);
1236 } 1236 }
1237 1237
1238 HInstruction newObject; 1238 HInstruction newObject;
1239 if (!isNativeUpgradeFactory) { 1239 if (!isNativeUpgradeFactory) {
1240 // Create the runtime type information, if needed. 1240 // Create the runtime type information, if needed.
1241 bool hasRtiInput = false; 1241 bool hasRtiInput = false;
1242 if (rtiNeed.classNeedsRtiField(classElement)) { 1242 if (rtiNeed.classNeedsRtiField(classElement.declaration)) {
1243 // Read the values of the type arguments and create a 1243 // Read the values of the type arguments and create a
1244 // HTypeInfoExpression to set on the newly create object. 1244 // HTypeInfoExpression to set on the newly create object.
1245 hasRtiInput = true; 1245 hasRtiInput = true;
1246 List<HInstruction> typeArguments = <HInstruction>[]; 1246 List<HInstruction> typeArguments = <HInstruction>[];
1247 classElement.typeVariables 1247 classElement.typeVariables
1248 .forEach((ResolutionTypeVariableType typeVariable) { 1248 .forEach((ResolutionTypeVariableType typeVariable) {
1249 HInstruction argument = localsHandler 1249 HInstruction argument = localsHandler
1250 .readLocal(localsHandler.getTypeVariableAsLocal(typeVariable)); 1250 .readLocal(localsHandler.getTypeVariableAsLocal(typeVariable));
1251 typeArguments.add(argument); 1251 typeArguments.add(argument);
1252 }); 1252 });
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 localsHandler.startFunction(element, node); 1371 localsHandler.startFunction(element, node);
1372 close(new HGoto()).addSuccessor(block); 1372 close(new HGoto()).addSuccessor(block);
1373 1373
1374 open(block); 1374 open(block);
1375 1375
1376 // Add the type parameters of the class as parameters of this method. This 1376 // Add the type parameters of the class as parameters of this method. This
1377 // must be done before adding the normal parameters, because their types 1377 // must be done before adding the normal parameters, because their types
1378 // may contain references to type variables. 1378 // may contain references to type variables.
1379 var enclosing = element.enclosingElement; 1379 var enclosing = element.enclosingElement;
1380 if ((element.isConstructor || element.isGenerativeConstructorBody) && 1380 if ((element.isConstructor || element.isGenerativeConstructorBody) &&
1381 rtiNeed.classNeedsRti(enclosing)) { 1381 rtiNeed.classNeedsRti(enclosing.declaration)) {
1382 enclosing.typeVariables 1382 enclosing.typeVariables
1383 .forEach((ResolutionTypeVariableType typeVariable) { 1383 .forEach((ResolutionTypeVariableType typeVariable) {
1384 HParameterValue param = 1384 HParameterValue param =
1385 addParameter(typeVariable.element, commonMasks.nonNullType); 1385 addParameter(typeVariable.element, commonMasks.nonNullType);
1386 localsHandler.directLocals[ 1386 localsHandler.directLocals[
1387 localsHandler.getTypeVariableAsLocal(typeVariable)] = param; 1387 localsHandler.getTypeVariableAsLocal(typeVariable)] = param;
1388 }); 1388 });
1389 } 1389 }
1390 1390
1391 if (element is MethodElement) { 1391 if (element is MethodElement) {
(...skipping 5349 matching lines...) Expand 10 before | Expand all | Expand 10 after
6741 this.oldReturnLocal, 6741 this.oldReturnLocal,
6742 this.oldReturnType, 6742 this.oldReturnType,
6743 this.oldResolvedAst, 6743 this.oldResolvedAst,
6744 this.oldStack, 6744 this.oldStack,
6745 this.oldLocalsHandler, 6745 this.oldLocalsHandler,
6746 this.inTryStatement, 6746 this.inTryStatement,
6747 this.allFunctionsCalledOnce, 6747 this.allFunctionsCalledOnce,
6748 this.oldElementInferenceResults) 6748 this.oldElementInferenceResults)
6749 : super(function); 6749 : super(function);
6750 } 6750 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698