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

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

Issue 26472002: Add TypeVariable object on runtime to support reflection on type variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments. Created 7 years, 2 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 2812 matching lines...) Expand 10 before | Expand all | Expand 10 after
2823 // to the runtime type information for type variables as instructions. 2823 // to the runtime type information for type variables as instructions.
2824 if (type.kind == TypeKind.TYPE_VARIABLE) { 2824 if (type.kind == TypeKind.TYPE_VARIABLE) {
2825 return buildLiteralList(<HInstruction>[addTypeVariableReference(type)]); 2825 return buildLiteralList(<HInstruction>[addTypeVariableReference(type)]);
2826 } else { 2826 } else {
2827 assert(type.element.isClass()); 2827 assert(type.element.isClass());
2828 InterfaceType interface = type; 2828 InterfaceType interface = type;
2829 List<HInstruction> inputs = <HInstruction>[]; 2829 List<HInstruction> inputs = <HInstruction>[];
2830 bool first = true; 2830 bool first = true;
2831 List<String> templates = <String>[]; 2831 List<String> templates = <String>[];
2832 for (DartType argument in interface.typeArguments) { 2832 for (DartType argument in interface.typeArguments) {
2833 templates.add(rti.getTypeRepresentation(argument, (variable) { 2833 templates.add(rti.getTypeRepresentationWithHashes(argument, (variable) {
2834 HInstruction runtimeType = addTypeVariableReference(variable); 2834 HInstruction runtimeType = addTypeVariableReference(variable);
2835 inputs.add(runtimeType); 2835 inputs.add(runtimeType);
2836 })); 2836 }));
2837 } 2837 }
2838 String template = '[${templates.join(', ')}]'; 2838 String template = '[${templates.join(', ')}]';
2839 js.Expression code = js.js.parseForeignJS(template); 2839 js.Expression code = js.js.parseForeignJS(template);
2840 HInstruction representation = 2840 HInstruction representation =
2841 createForeign(code, backend.readableArrayType, inputs); 2841 createForeign(code, backend.readableArrayType, inputs);
2842 return representation; 2842 return representation;
2843 } 2843 }
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
3521 } 3521 }
3522 3522
3523 HInstruction analyzeTypeArgument(DartType argument) { 3523 HInstruction analyzeTypeArgument(DartType argument) {
3524 if (argument.treatAsDynamic) { 3524 if (argument.treatAsDynamic) {
3525 // Represent [dynamic] as [null]. 3525 // Represent [dynamic] as [null].
3526 return graph.addConstantNull(compiler); 3526 return graph.addConstantNull(compiler);
3527 } 3527 }
3528 3528
3529 List<HInstruction> inputs = <HInstruction>[]; 3529 List<HInstruction> inputs = <HInstruction>[];
3530 3530
3531 String template = rti.getTypeRepresentation(argument, (variable) { 3531 String template = rti.getTypeRepresentationWithHashes(argument, (variable) {
3532 inputs.add(addTypeVariableReference(variable)); 3532 inputs.add(addTypeVariableReference(variable));
3533 }); 3533 });
3534 3534
3535 js.Expression code = js.js.parseForeignJS(template); 3535 js.Expression code = js.js.parseForeignJS(template);
3536 HInstruction result = createForeign(code, backend.stringType, inputs); 3536 HInstruction result = createForeign(code, backend.stringType, inputs);
3537 add(result); 3537 add(result);
3538 return result; 3538 return result;
3539 } 3539 }
3540 3540
3541 void handleListConstructor(InterfaceType type, 3541 void handleListConstructor(InterfaceType type,
(...skipping 2077 matching lines...) Expand 10 before | Expand all | Expand 10 after
5619 new HSubGraphBlockInformation(elseBranch.graph)); 5619 new HSubGraphBlockInformation(elseBranch.graph));
5620 5620
5621 HBasicBlock conditionStartBlock = conditionBranch.block; 5621 HBasicBlock conditionStartBlock = conditionBranch.block;
5622 conditionStartBlock.setBlockFlow(info, joinBlock); 5622 conditionStartBlock.setBlockFlow(info, joinBlock);
5623 SubGraph conditionGraph = conditionBranch.graph; 5623 SubGraph conditionGraph = conditionBranch.graph;
5624 HIf branch = conditionGraph.end.last; 5624 HIf branch = conditionGraph.end.last;
5625 assert(branch is HIf); 5625 assert(branch is HIf);
5626 branch.blockInformation = conditionStartBlock.blockFlow; 5626 branch.blockInformation = conditionStartBlock.blockFlow;
5627 } 5627 }
5628 } 5628 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/resolution/members.dart ('k') | sdk/lib/_internal/lib/js_mirrors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698