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/builder.dart

Issue 12779005: Read type argument from local in constructor. (Closed) Base URL: https://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/co19/co19-dart2js.status » ('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 /** 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 3148 matching lines...) Expand 10 before | Expand all | Expand 10 after
3159 } 3159 }
3160 } 3160 }
3161 3161
3162 /** 3162 /**
3163 * Generate code to extract the type arguments from the object, substitute 3163 * Generate code to extract the type arguments from the object, substitute
3164 * them as an instance of the type we are testing against (if necessary), and 3164 * them as an instance of the type we are testing against (if necessary), and
3165 * extract the type argument by the index of the variable in the list of type 3165 * extract the type argument by the index of the variable in the list of type
3166 * variables for that class. 3166 * variables for that class.
3167 */ 3167 */
3168 HInstruction readTypeVariable(ClassElement cls, 3168 HInstruction readTypeVariable(ClassElement cls,
3169 TypeVariableElement variable) { 3169 TypeVariableElement variable) {
ngeoffray 2013/03/12 13:40:49 Add assert(currentElement.isInstanceMember()).
karlklose 2013/03/12 13:44:07 Done.
3170 int index = RuntimeTypeInformation.getTypeVariableIndex(variable); 3170 int index = RuntimeTypeInformation.getTypeVariableIndex(variable);
3171 String substitutionNameString = backend.namer.substitutionName(cls); 3171 String substitutionNameString = backend.namer.substitutionName(cls);
3172 HInstruction substitutionName = graph.addConstantString( 3172 HInstruction substitutionName = graph.addConstantString(
3173 new LiteralDartString(substitutionNameString), null, constantSystem); 3173 new LiteralDartString(substitutionNameString), null, constantSystem);
3174 HInstruction target = localsHandler.readThis(); 3174 HInstruction target = localsHandler.readThis();
3175 HInstruction substitution = createForeign('#[#]', HType.UNKNOWN, 3175 HInstruction substitution = createForeign('#[#]', HType.UNKNOWN,
3176 <HInstruction>[target, substitutionName]); 3176 <HInstruction>[target, substitutionName]);
3177 add(substitution); 3177 add(substitution);
3178 pushInvokeHelper3(backend.getGetRuntimeTypeArgument(), 3178 pushInvokeHelper3(backend.getGetRuntimeTypeArgument(),
3179 target, 3179 target,
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
3422 } 3422 }
3423 3423
3424 visitTypeReferenceSend(Send node) { 3424 visitTypeReferenceSend(Send node) {
3425 Element element = elements[node]; 3425 Element element = elements[node];
3426 if (element.isClass() || element.isTypedef()) { 3426 if (element.isClass() || element.isTypedef()) {
3427 // TODO(karlklose): add type representation 3427 // TODO(karlklose): add type representation
3428 ConstantHandler handler = compiler.constantHandler; 3428 ConstantHandler handler = compiler.constantHandler;
3429 Constant constant = handler.compileNodeWithDefinitions(node, elements); 3429 Constant constant = handler.compileNodeWithDefinitions(node, elements);
3430 stack.add(graph.addConstant(constant)); 3430 stack.add(graph.addConstant(constant));
3431 } else if (element.isTypeVariable()) { 3431 } else if (element.isTypeVariable()) {
3432 HInstruction value = readTypeVariable(currentElement.getEnclosingClass(), 3432 HInstruction value =
3433 element); 3433 addTypeVariableReference(element.computeType(compiler));
3434 pushInvokeHelper1(backend.getRuntimeTypeToString(), 3434 pushInvokeHelper1(backend.getRuntimeTypeToString(),
3435 value, HType.STRING); 3435 value, HType.STRING);
3436 pushInvokeHelper1(backend.getCreateRuntimeType(), 3436 pushInvokeHelper1(backend.getCreateRuntimeType(),
3437 pop(), HType.UNKNOWN); 3437 pop(), HType.UNKNOWN);
3438 } else { 3438 } else {
3439 internalError('unexpected element kind $element', node: node); 3439 internalError('unexpected element kind $element', node: node);
3440 } 3440 }
3441 if (node.isCall) { 3441 if (node.isCall) {
3442 // This send is of the form 'e(...)', where e is resolved to a type 3442 // This send is of the form 'e(...)', where e is resolved to a type
3443 // reference. We create a regular closure call on the result of the type 3443 // reference. We create a regular closure call on the result of the type
(...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after
5109 new HSubGraphBlockInformation(elseBranch.graph)); 5109 new HSubGraphBlockInformation(elseBranch.graph));
5110 5110
5111 HBasicBlock conditionStartBlock = conditionBranch.block; 5111 HBasicBlock conditionStartBlock = conditionBranch.block;
5112 conditionStartBlock.setBlockFlow(info, joinBlock); 5112 conditionStartBlock.setBlockFlow(info, joinBlock);
5113 SubGraph conditionGraph = conditionBranch.graph; 5113 SubGraph conditionGraph = conditionBranch.graph;
5114 HIf branch = conditionGraph.end.last; 5114 HIf branch = conditionGraph.end.last;
5115 assert(branch is HIf); 5115 assert(branch is HIf);
5116 branch.blockInformation = conditionStartBlock.blockFlow; 5116 branch.blockInformation = conditionStartBlock.blockFlow;
5117 } 5117 }
5118 } 5118 }
OLDNEW
« no previous file with comments | « no previous file | tests/co19/co19-dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698