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

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

Issue 12463012: Add a test and improve comment on generic checks. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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
« no previous file with comments | « no previous file | tests/language/generic_is_check_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 } else { 534 } else {
535 return graph.addConstantBool(false, constantSystem); 535 return graph.addConstantBool(false, constantSystem);
536 } 536 }
537 } else if (expressionType.isArray()) { 537 } else if (expressionType.isArray()) {
538 if (identical(element, compiler.listClass) 538 if (identical(element, compiler.listClass)
539 || Elements.isListSupertype(element, compiler)) { 539 || Elements.isListSupertype(element, compiler)) {
540 return graph.addConstantBool(true, constantSystem); 540 return graph.addConstantBool(true, constantSystem);
541 } else { 541 } else {
542 return graph.addConstantBool(false, constantSystem); 542 return graph.addConstantBool(false, constantSystem);
543 } 543 }
544 // TODO(karlklose): remove the hasTypeArguments check. 544 // Wee need the [:hasTypeArguments:] check because we don't have
545 // the notion of generics in the backend. For example, [:this:] in
546 // a class [:A<T>:], is currently always considered to have the
547 // raw type.
545 } else if (expressionType.isUseful() 548 } else if (expressionType.isUseful()
546 && !expressionType.canBeNull() 549 && !expressionType.canBeNull()
547 && !RuntimeTypeInformation.hasTypeArguments(type)) { 550 && !RuntimeTypeInformation.hasTypeArguments(type)) {
548 DartType receiverType = expressionType.computeType(compiler); 551 DartType receiverType = expressionType.computeType(compiler);
549 if (receiverType != null) { 552 if (receiverType != null) {
550 if (!receiverType.isMalformed && 553 if (!receiverType.isMalformed &&
551 !type.isMalformed && 554 !type.isMalformed &&
552 compiler.types.isSubtype(receiverType, type)) { 555 compiler.types.isSubtype(receiverType.element.rawType, type)) {
553 return graph.addConstantBool(true, constantSystem); 556 return graph.addConstantBool(true, constantSystem);
554 } else if (expressionType.isExact()) { 557 } else if (expressionType.isExact()) {
555 return graph.addConstantBool(false, constantSystem); 558 return graph.addConstantBool(false, constantSystem);
556 } 559 }
557 } 560 }
558 } 561 }
559 return node; 562 return node;
560 } 563 }
561 564
562 HInstruction visitTypeConversion(HTypeConversion node) { 565 HInstruction visitTypeConversion(HTypeConversion node) {
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 HBasicBlock block = user.block; 1546 HBasicBlock block = user.block;
1544 block.addAfter(user, interceptor); 1547 block.addAfter(user, interceptor);
1545 block.rewrite(user, interceptor); 1548 block.rewrite(user, interceptor);
1546 block.remove(user); 1549 block.remove(user);
1547 1550
1548 // The interceptor will be removed in the dead code elimination 1551 // The interceptor will be removed in the dead code elimination
1549 // phase. Note that removing it here would not work because of how 1552 // phase. Note that removing it here would not work because of how
1550 // the [visitBasicBlock] is implemented. 1553 // the [visitBasicBlock] is implemented.
1551 } 1554 }
1552 } 1555 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/generic_is_check_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698