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

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

Issue 2807593002: Use entities in impact transformers. (Closed)
Patch Set: Created 3 years, 8 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';
11 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; 11 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem;
12 import '../common/names.dart' show Identifiers, Selectors; 12 import '../common/names.dart' show Identifiers, Selectors;
13 import '../common/tasks.dart' show CompilerTask; 13 import '../common/tasks.dart' show CompilerTask;
14 import '../compiler.dart' show Compiler; 14 import '../compiler.dart' show Compiler;
15 import '../constants/constant_system.dart'; 15 import '../constants/constant_system.dart';
16 import '../constants/expressions.dart'; 16 import '../constants/expressions.dart';
17 import '../constants/values.dart'; 17 import '../constants/values.dart';
18 import '../common_elements.dart' show CommonElements; 18 import '../common_elements.dart' show CommonElements;
19 import '../elements/resolution_types.dart'; 19 import '../elements/resolution_types.dart';
20 import '../elements/types.dart';
20 import '../diagnostics/messages.dart' show Message, MessageTemplate; 21 import '../diagnostics/messages.dart' show Message, MessageTemplate;
21 import '../dump_info.dart' show InfoReporter; 22 import '../dump_info.dart' show InfoReporter;
22 import '../elements/elements.dart'; 23 import '../elements/elements.dart';
23 import '../elements/entities.dart'; 24 import '../elements/entities.dart';
24 import '../elements/modelx.dart' show ConstructorBodyElementX; 25 import '../elements/modelx.dart' show ConstructorBodyElementX;
25 import '../io/source_information.dart'; 26 import '../io/source_information.dart';
26 import '../js/js.dart' as js; 27 import '../js/js.dart' as js;
27 import '../js_backend/backend_helpers.dart' show BackendHelpers; 28 import '../js_backend/backend_helpers.dart' show BackendHelpers;
28 import '../js_backend/js_backend.dart'; 29 import '../js_backend/js_backend.dart';
29 import '../js_emitter/js_emitter.dart' show CodeEmitterTask, NativeEmitter; 30 import '../js_emitter/js_emitter.dart' show CodeEmitterTask, NativeEmitter;
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 fields.add(member); 1230 fields.add(member);
1230 ResolutionDartType type = localsHandler.substInContext(member.type); 1231 ResolutionDartType type = localsHandler.substInContext(member.type);
1231 constructorArguments 1232 constructorArguments
1232 .add(typeBuilder.potentiallyCheckOrTrustType(value, type)); 1233 .add(typeBuilder.potentiallyCheckOrTrustType(value, type));
1233 } 1234 }
1234 }, includeSuperAndInjectedMembers: true); 1235 }, includeSuperAndInjectedMembers: true);
1235 1236
1236 ResolutionInterfaceType type = classElement.thisType; 1237 ResolutionInterfaceType type = classElement.thisType;
1237 TypeMask ssaType = 1238 TypeMask ssaType =
1238 new TypeMask.nonNullExact(classElement.declaration, closedWorld); 1239 new TypeMask.nonNullExact(classElement.declaration, closedWorld);
1239 List<ResolutionDartType> instantiatedTypes; 1240 List<DartType> instantiatedTypes;
1240 addInlinedInstantiation(type); 1241 addInlinedInstantiation(type);
1241 if (!currentInlinedInstantiations.isEmpty) { 1242 if (!currentInlinedInstantiations.isEmpty) {
1242 instantiatedTypes = 1243 instantiatedTypes = new List<DartType>.from(currentInlinedInstantiations);
1243 new List<ResolutionDartType>.from(currentInlinedInstantiations);
1244 } 1244 }
1245 1245
1246 HInstruction newObject; 1246 HInstruction newObject;
1247 if (!isNativeUpgradeFactory) { 1247 if (!isNativeUpgradeFactory) {
1248 // Create the runtime type information, if needed. 1248 // Create the runtime type information, if needed.
1249 bool hasRtiInput = false; 1249 bool hasRtiInput = false;
1250 if (backend.rtiNeed.classNeedsRtiField(classElement)) { 1250 if (backend.rtiNeed.classNeedsRtiField(classElement)) {
1251 // Read the values of the type arguments and create a 1251 // Read the values of the type arguments and create a
1252 // HTypeInfoExpression to set on the newly create object. 1252 // HTypeInfoExpression to set on the newly create object.
1253 hasRtiInput = true; 1253 hasRtiInput = true;
(...skipping 1739 matching lines...) Expand 10 before | Expand all | Expand 10 after
2993 // Until now we only handle these as getters. 2993 // Until now we only handle these as getters.
2994 invariant(node, deferredLoader.isDeferredLoaderGetter); 2994 invariant(node, deferredLoader.isDeferredLoaderGetter);
2995 FunctionEntity loadFunction = helpers.loadLibraryWrapper; 2995 FunctionEntity loadFunction = helpers.loadLibraryWrapper;
2996 PrefixElement prefixElement = deferredLoader.enclosingElement; 2996 PrefixElement prefixElement = deferredLoader.enclosingElement;
2997 String loadId = 2997 String loadId =
2998 compiler.deferredLoadTask.getImportDeferName(node, prefixElement); 2998 compiler.deferredLoadTask.getImportDeferName(node, prefixElement);
2999 var inputs = [ 2999 var inputs = [
3000 graph.addConstantString(new ast.DartString.literal(loadId), closedWorld) 3000 graph.addConstantString(new ast.DartString.literal(loadId), closedWorld)
3001 ]; 3001 ];
3002 push(new HInvokeStatic(loadFunction, inputs, commonMasks.nonNullType, 3002 push(new HInvokeStatic(loadFunction, inputs, commonMasks.nonNullType,
3003 targetCanThrow: false)..sourceInformation = sourceInformation); 3003 targetCanThrow: false)
3004 ..sourceInformation = sourceInformation);
3004 } 3005 }
3005 3006
3006 generateSuperNoSuchMethodSend( 3007 generateSuperNoSuchMethodSend(
3007 ast.Send node, Selector selector, List<HInstruction> arguments) { 3008 ast.Send node, Selector selector, List<HInstruction> arguments) {
3008 String name = selector.name; 3009 String name = selector.name;
3009 3010
3010 ClassElement cls = currentNonClosureClass; 3011 ClassElement cls = currentNonClosureClass;
3011 MethodElement element = cls.lookupSuperMember(Identifiers.noSuchMethod_); 3012 MethodElement element = cls.lookupSuperMember(Identifiers.noSuchMethod_);
3012 if (!Selectors.noSuchMethod_.signatureApplies(element)) { 3013 if (!Selectors.noSuchMethod_.signatureApplies(element)) {
3013 ClassElement objectClass = commonElements.objectClass; 3014 ClassElement objectClass = commonElements.objectClass;
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after
4095 } else if (element.isSetter) { 4096 } else if (element.isSetter) {
4096 code = "# = #"; 4097 code = "# = #";
4097 } else { 4098 } else {
4098 var args = new List.filled(arguments.length, '#').join(','); 4099 var args = new List.filled(arguments.length, '#').join(',');
4099 code = element.isConstructor ? "new #($args)" : "#($args)"; 4100 code = element.isConstructor ? "new #($args)" : "#($args)";
4100 } 4101 }
4101 js.Template codeTemplate = js.js.parseForeignJS(code); 4102 js.Template codeTemplate = js.js.parseForeignJS(code);
4102 nativeBehavior.codeTemplate = codeTemplate; 4103 nativeBehavior.codeTemplate = codeTemplate;
4103 4104
4104 return new HForeignCode(codeTemplate, commonMasks.dynamicType, inputs, 4105 return new HForeignCode(codeTemplate, commonMasks.dynamicType, inputs,
4105 nativeBehavior: nativeBehavior)..sourceInformation = sourceInformation; 4106 nativeBehavior: nativeBehavior)
4107 ..sourceInformation = sourceInformation;
4106 } 4108 }
4107 4109
4108 void pushInvokeStatic( 4110 void pushInvokeStatic(
4109 ast.Node location, MethodElement element, List<HInstruction> arguments, 4111 ast.Node location, MethodElement element, List<HInstruction> arguments,
4110 {TypeMask typeMask, 4112 {TypeMask typeMask,
4111 ResolutionInterfaceType instanceType, 4113 ResolutionInterfaceType instanceType,
4112 SourceInformation sourceInformation}) { 4114 SourceInformation sourceInformation}) {
4113 assert(element.isDeclaration); 4115 assert(element.isDeclaration);
4114 // TODO(johnniwinther): Use [sourceInformation] instead of [location]. 4116 // TODO(johnniwinther): Use [sourceInformation] instead of [location].
4115 if (tryInlineMethod(element, null, null, arguments, location, 4117 if (tryInlineMethod(element, null, null, arguments, location,
(...skipping 2644 matching lines...) Expand 10 before | Expand all | Expand 10 after
6760 this.oldReturnLocal, 6762 this.oldReturnLocal,
6761 this.oldReturnType, 6763 this.oldReturnType,
6762 this.oldResolvedAst, 6764 this.oldResolvedAst,
6763 this.oldStack, 6765 this.oldStack,
6764 this.oldLocalsHandler, 6766 this.oldLocalsHandler,
6765 this.inTryStatement, 6767 this.inTryStatement,
6766 this.allFunctionsCalledOnce, 6768 this.allFunctionsCalledOnce,
6767 this.oldElementInferenceResults) 6769 this.oldElementInferenceResults)
6768 : super(function); 6770 : super(function);
6769 } 6771 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/kernel/world_builder.dart ('k') | pkg/compiler/lib/src/ssa/builder_kernel.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698