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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/optimize.dart

Issue 11299009: Support type literals as compile-time constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 1 month 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 abstract class OptimizationPhase { 7 abstract class OptimizationPhase {
8 String get name; 8 String get name;
9 void visitGraph(HGraph graph); 9 void visitGraph(HGraph graph);
10 } 10 }
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 } else if (expressionType.isArray()) { 548 } else if (expressionType.isArray()) {
549 if (identical(element, compiler.listClass) 549 if (identical(element, compiler.listClass)
550 || Elements.isListSupertype(element, compiler)) { 550 || Elements.isListSupertype(element, compiler)) {
551 return graph.addConstantBool(true, constantSystem); 551 return graph.addConstantBool(true, constantSystem);
552 } else { 552 } else {
553 return graph.addConstantBool(false, constantSystem); 553 return graph.addConstantBool(false, constantSystem);
554 } 554 }
555 // TODO(karlklose): remove the hasTypeArguments check. 555 // TODO(karlklose): remove the hasTypeArguments check.
556 } else if (expressionType.isUseful() 556 } else if (expressionType.isUseful()
557 && !expressionType.canBeNull() 557 && !expressionType.canBeNull()
558 && !compiler.codegenWorld.rti.hasTypeArguments(type)) { 558 && !backend.rti.hasTypeArguments(type)) {
559 DartType receiverType = expressionType.computeType(compiler); 559 DartType receiverType = expressionType.computeType(compiler);
560 if (receiverType != null) { 560 if (receiverType != null) {
561 if (compiler.types.isSubtype(receiverType, type)) { 561 if (compiler.types.isSubtype(receiverType, type)) {
562 return graph.addConstantBool(true, constantSystem); 562 return graph.addConstantBool(true, constantSystem);
563 } else if (expressionType.isExact()) { 563 } else if (expressionType.isExact()) {
564 return graph.addConstantBool(false, constantSystem); 564 return graph.addConstantBool(false, constantSystem);
565 } 565 }
566 } 566 }
567 } 567 }
568 return node; 568 return node;
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 } 1354 }
1355 1355
1356 // For other fields having setters in the generative constructor body, set 1356 // For other fields having setters in the generative constructor body, set
1357 // the type to UNKNOWN to avoid relying on the type set in the initializer 1357 // the type to UNKNOWN to avoid relying on the type set in the initializer
1358 // list. 1358 // list.
1359 allSetters.forEach((Element element) { 1359 allSetters.forEach((Element element) {
1360 backend.registerFieldConstructor(element, HType.UNKNOWN); 1360 backend.registerFieldConstructor(element, HType.UNKNOWN);
1361 }); 1361 });
1362 } 1362 }
1363 } 1363 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698