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

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

Issue 15735003: Use assertSubtype for lists. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add test. Created 7 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 | 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 /** 7 /**
8 * A special element for the extra parameter taken by intercepted 8 * A special element for the extra parameter taken by intercepted
9 * methods. We need to override [Element.computeType] because our 9 * methods. We need to override [Element.computeType] because our
10 * optimizers may look at its declared type. 10 * optimizers may look at its declared type.
(...skipping 2823 matching lines...) Expand 10 before | Expand all | Expand 10 after
2834 HInstruction buildIsNode(Node node, DartType type, HInstruction expression) { 2834 HInstruction buildIsNode(Node node, DartType type, HInstruction expression) {
2835 if (type.kind == TypeKind.TYPE_VARIABLE) { 2835 if (type.kind == TypeKind.TYPE_VARIABLE) {
2836 HInstruction runtimeType = addTypeVariableReference(type); 2836 HInstruction runtimeType = addTypeVariableReference(type);
2837 Element helper = backend.getCheckSubtypeOfRuntimeType(); 2837 Element helper = backend.getCheckSubtypeOfRuntimeType();
2838 List<HInstruction> inputs = <HInstruction>[expression, runtimeType]; 2838 List<HInstruction> inputs = <HInstruction>[expression, runtimeType];
2839 pushInvokeStatic(null, helper, inputs, HType.BOOLEAN); 2839 pushInvokeStatic(null, helper, inputs, HType.BOOLEAN);
2840 HInstruction call = pop(); 2840 HInstruction call = pop();
2841 return new HIs(type, <HInstruction>[expression, call], 2841 return new HIs(type, <HInstruction>[expression, call],
2842 HIs.VARIABLE_CHECK); 2842 HIs.VARIABLE_CHECK);
2843 } else if (RuntimeTypes.hasTypeArguments(type)) { 2843 } else if (RuntimeTypes.hasTypeArguments(type)) {
2844 Element element = type.element; 2844 ClassElement element = type.element;
2845 Element helper = backend.getCheckSubtype(); 2845 Element helper = backend.getCheckSubtype();
2846 HInstruction representations = 2846 HInstruction representations =
2847 buildTypeArgumentRepresentations(type); 2847 buildTypeArgumentRepresentations(type);
2848 add(representations); 2848 add(representations);
2849 String operator = 2849 String operator =
2850 backend.namer.operatorIs(backend.getImplementationClass(element)); 2850 backend.namer.operatorIs(backend.getImplementationClass(element));
2851 HInstruction isFieldName = addConstantString(node, operator); 2851 HInstruction isFieldName = addConstantString(node, operator);
2852 // TODO(karlklose): use [:null:] for [asField] if [element] does not 2852 HInstruction asFieldName = compiler.world.hasAnySubtype(element)
2853 // have a subclass. 2853 ? addConstantString(node, backend.namer.substitutionName(element))
2854 HInstruction asFieldName = 2854 : graph.addConstantNull(constantSystem);
2855 addConstantString(node, backend.namer.substitutionName(element));
2856 List<HInstruction> inputs = <HInstruction>[expression, 2855 List<HInstruction> inputs = <HInstruction>[expression,
2857 isFieldName, 2856 isFieldName,
2858 representations, 2857 representations,
2859 asFieldName]; 2858 asFieldName];
2860 pushInvokeStatic(node, helper, inputs, HType.BOOLEAN); 2859 pushInvokeStatic(node, helper, inputs, HType.BOOLEAN);
2861 HInstruction call = pop(); 2860 HInstruction call = pop();
2862 return 2861 return
2863 new HIs(type, <HInstruction>[expression, call], HIs.COMPOUND_CHECK); 2862 new HIs(type, <HInstruction>[expression, call], HIs.COMPOUND_CHECK);
2864 } else { 2863 } else {
2865 return new HIs(type, <HInstruction>[expression], HIs.RAW_CHECK); 2864 return new HIs(type, <HInstruction>[expression], HIs.RAW_CHECK);
(...skipping 2538 matching lines...) Expand 10 before | Expand all | Expand 10 after
5404 new HSubGraphBlockInformation(elseBranch.graph)); 5403 new HSubGraphBlockInformation(elseBranch.graph));
5405 5404
5406 HBasicBlock conditionStartBlock = conditionBranch.block; 5405 HBasicBlock conditionStartBlock = conditionBranch.block;
5407 conditionStartBlock.setBlockFlow(info, joinBlock); 5406 conditionStartBlock.setBlockFlow(info, joinBlock);
5408 SubGraph conditionGraph = conditionBranch.graph; 5407 SubGraph conditionGraph = conditionBranch.graph;
5409 HIf branch = conditionGraph.end.last; 5408 HIf branch = conditionGraph.end.last;
5410 assert(branch is HIf); 5409 assert(branch is HIf);
5411 branch.blockInformation = conditionStartBlock.blockFlow; 5410 branch.blockInformation = conditionStartBlock.blockFlow;
5412 } 5411 }
5413 } 5412 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/js_backend/backend.dart ('k') | tests/language/generic_list_checked_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698