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

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

Issue 794933004: Remove tracking of factories used with type arguments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update test expectation. Created 5 years, 11 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 | Annotate | Revision Log
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 part of ssa; 5 part of ssa;
6 6
7 class SsaFunctionCompiler implements FunctionCompiler { 7 class SsaFunctionCompiler implements FunctionCompiler {
8 SsaCodeGeneratorTask generator; 8 SsaCodeGeneratorTask generator;
9 SsaBuilderTask builder; 9 SsaBuilderTask builder;
10 SsaOptimizerTask optimizer; 10 SsaOptimizerTask optimizer;
(...skipping 4287 matching lines...) Expand 10 before | Expand all | Expand 10 after
4298 // TODO(5347): Try to avoid the need for calling [implementation] before 4298 // TODO(5347): Try to avoid the need for calling [implementation] before
4299 // calling [makeStaticArgumentList]. 4299 // calling [makeStaticArgumentList].
4300 if (!selector.applies(constructor.implementation, compiler.world)) { 4300 if (!selector.applies(constructor.implementation, compiler.world)) {
4301 generateWrongArgumentCountError(send, constructor, send.arguments); 4301 generateWrongArgumentCountError(send, constructor, send.arguments);
4302 return; 4302 return;
4303 } 4303 }
4304 inputs.addAll(makeStaticArgumentList(selector, 4304 inputs.addAll(makeStaticArgumentList(selector,
4305 send.arguments, 4305 send.arguments,
4306 constructor.implementation)); 4306 constructor.implementation));
4307 4307
4308 if (constructor.isFactoryConstructor &&
4309 !expectedType.typeArguments.isEmpty) {
4310 registry.registerFactoryWithTypeArguments();
4311 }
4312
4313 TypeMask elementType = computeType(constructor); 4308 TypeMask elementType = computeType(constructor);
4314 if (isFixedListConstructorCall) { 4309 if (isFixedListConstructorCall) {
4315 if (!inputs[0].isNumber(compiler)) { 4310 if (!inputs[0].isNumber(compiler)) {
4316 HTypeConversion conversion = new HTypeConversion( 4311 HTypeConversion conversion = new HTypeConversion(
4317 null, HTypeConversion.ARGUMENT_TYPE_CHECK, backend.numType, 4312 null, HTypeConversion.ARGUMENT_TYPE_CHECK, backend.numType,
4318 inputs[0], null); 4313 inputs[0], null);
4319 add(conversion); 4314 add(conversion);
4320 inputs[0] = conversion; 4315 inputs[0] = conversion;
4321 } 4316 }
4322 js.Template code = js.js.parseForeignJS('Array(#)'); 4317 js.Template code = js.js.parseForeignJS('Array(#)');
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after
5411 assert(constructor.isFactoryConstructor); 5406 assert(constructor.isFactoryConstructor);
5412 5407
5413 ConstructorElement functionElement = constructor; 5408 ConstructorElement functionElement = constructor;
5414 constructor = functionElement.effectiveTarget; 5409 constructor = functionElement.effectiveTarget;
5415 5410
5416 InterfaceType type = elements.getType(node); 5411 InterfaceType type = elements.getType(node);
5417 InterfaceType expectedType = 5412 InterfaceType expectedType =
5418 functionElement.computeEffectiveTargetType(type); 5413 functionElement.computeEffectiveTargetType(type);
5419 expectedType = localsHandler.substInContext(expectedType); 5414 expectedType = localsHandler.substInContext(expectedType);
5420 5415
5421 if (constructor.isFactoryConstructor) {
5422 registry.registerFactoryWithTypeArguments();
5423 }
5424
5425 ClassElement cls = constructor.enclosingClass; 5416 ClassElement cls = constructor.enclosingClass;
5426 5417
5427 if (backend.classNeedsRti(cls)) { 5418 if (backend.classNeedsRti(cls)) {
5428 List<DartType> typeVariable = cls.typeVariables; 5419 List<DartType> typeVariable = cls.typeVariables;
5429 expectedType.typeArguments.forEach((DartType argument) { 5420 expectedType.typeArguments.forEach((DartType argument) {
5430 inputs.add(analyzeTypeArgument(argument)); 5421 inputs.add(analyzeTypeArgument(argument));
5431 }); 5422 });
5432 } 5423 }
5433 5424
5434 // The instruction type will always be a subtype of the mapLiteralClass, but 5425 // The instruction type will always be a subtype of the mapLiteralClass, but
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after
6644 if (unaliased is TypedefType) throw 'unable to unalias $type'; 6635 if (unaliased is TypedefType) throw 'unable to unalias $type';
6645 unaliased.accept(this, builder); 6636 unaliased.accept(this, builder);
6646 } 6637 }
6647 6638
6648 void visitDynamicType(DynamicType type, SsaBuilder builder) { 6639 void visitDynamicType(DynamicType type, SsaBuilder builder) {
6649 JavaScriptBackend backend = builder.compiler.backend; 6640 JavaScriptBackend backend = builder.compiler.backend;
6650 ClassElement cls = backend.findHelper('DynamicRuntimeType'); 6641 ClassElement cls = backend.findHelper('DynamicRuntimeType');
6651 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); 6642 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld)));
6652 } 6643 }
6653 } 6644 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/registry.dart ('k') | pkg/compiler/lib/src/universe/universe.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698