Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1184 "Parameters and arguments didn't match for super/redirect call", | 1184 "Parameters and arguments didn't match for super/redirect call", |
| 1185 element: constructor); | 1185 element: constructor); |
| 1186 } | 1186 } |
| 1187 | 1187 |
| 1188 ClassElement superclass = constructor.getEnclosingClass(); | 1188 ClassElement superclass = constructor.getEnclosingClass(); |
| 1189 if (compiler.world.needsRti(superclass)) { | 1189 if (compiler.world.needsRti(superclass)) { |
| 1190 // If [superclass] needs RTI, we have to give a value to its | 1190 // If [superclass] needs RTI, we have to give a value to its |
| 1191 // type parameters. Those values are in the [supertype] | 1191 // type parameters. Those values are in the [supertype] |
| 1192 // declaration of [subclass]. | 1192 // declaration of [subclass]. |
| 1193 ClassElement subclass = inlinedFromElement.getEnclosingClass(); | 1193 ClassElement subclass = inlinedFromElement.getEnclosingClass(); |
| 1194 DartType supertype = subclass.supertype; | 1194 GenericType supertype = subclass.supertype; |
|
kasperl
2013/03/06 20:39:43
Already changed to InterfaceType. Should go away w
| |
| 1195 Link<DartType> typeVariables = superclass.typeVariables; | 1195 Link<DartType> typeVariables = superclass.typeVariables; |
| 1196 supertype.typeArguments.forEach((DartType argument) { | 1196 supertype.typeArguments.forEach((DartType argument) { |
| 1197 localsHandler.updateLocal(typeVariables.head.element, | 1197 localsHandler.updateLocal(typeVariables.head.element, |
| 1198 analyzeTypeArgument(argument, callNode)); | 1198 analyzeTypeArgument(argument, callNode)); |
| 1199 typeVariables = typeVariables.tail; | 1199 typeVariables = typeVariables.tail; |
| 1200 }); | 1200 }); |
| 1201 // If the supertype is a raw type, we need to set to null the | 1201 // If the supertype is a raw type, we need to set to null the |
| 1202 // type variables. | 1202 // type variables. |
| 1203 assert(typeVariables.isEmpty | 1203 assert(typeVariables.isEmpty |
| 1204 || superclass.typeVariables == typeVariables); | 1204 || superclass.typeVariables == typeVariables); |
| (...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2205 ClosureClassMap nestedClosureData = | 2205 ClosureClassMap nestedClosureData = |
| 2206 compiler.closureToClassMapper.getMappingForNestedFunction(node); | 2206 compiler.closureToClassMapper.getMappingForNestedFunction(node); |
| 2207 assert(nestedClosureData != null); | 2207 assert(nestedClosureData != null); |
| 2208 assert(nestedClosureData.closureClassElement != null); | 2208 assert(nestedClosureData.closureClassElement != null); |
| 2209 ClassElement closureClassElement = | 2209 ClassElement closureClassElement = |
| 2210 nestedClosureData.closureClassElement; | 2210 nestedClosureData.closureClassElement; |
| 2211 FunctionElement callElement = nestedClosureData.callElement; | 2211 FunctionElement callElement = nestedClosureData.callElement; |
| 2212 // TODO(ahe): This should be registered in codegen, not here. | 2212 // TODO(ahe): This should be registered in codegen, not here. |
| 2213 compiler.enqueuer.codegen.addToWorkList(callElement, elements); | 2213 compiler.enqueuer.codegen.addToWorkList(callElement, elements); |
| 2214 // TODO(ahe): This should be registered in codegen, not here. | 2214 // TODO(ahe): This should be registered in codegen, not here. |
| 2215 compiler.enqueuer.codegen.registerInstantiatedClass(closureClassElement); | 2215 compiler.enqueuer.codegen.registerInstantiatedClass( |
| 2216 closureClassElement, work.resolutionTree); | |
| 2216 assert(!closureClassElement.hasLocalScopeMembers); | 2217 assert(!closureClassElement.hasLocalScopeMembers); |
| 2217 | 2218 |
| 2218 List<HInstruction> capturedVariables = <HInstruction>[]; | 2219 List<HInstruction> capturedVariables = <HInstruction>[]; |
| 2219 closureClassElement.forEachBackendMember((Element member) { | 2220 closureClassElement.forEachBackendMember((Element member) { |
| 2220 // The backendMembers also contains the call method(s). We are only | 2221 // The backendMembers also contains the call method(s). We are only |
| 2221 // interested in the fields. | 2222 // interested in the fields. |
| 2222 if (member.isField()) { | 2223 if (member.isField()) { |
| 2223 Element capturedLocal = nestedClosureData.capturedFieldMapping[member]; | 2224 Element capturedLocal = nestedClosureData.capturedFieldMapping[member]; |
| 2224 assert(capturedLocal != null); | 2225 assert(capturedLocal != null); |
| 2225 capturedVariables.add(localsHandler.readLocal(capturedLocal)); | 2226 capturedVariables.add(localsHandler.readLocal(capturedLocal)); |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2643 buildTypeArgumentRepresentations(type); | 2644 buildTypeArgumentRepresentations(type); |
| 2644 assert(representations.length == 1); | 2645 assert(representations.length == 1); |
| 2645 HInstruction runtimeType = addTypeVariableReference(type); | 2646 HInstruction runtimeType = addTypeVariableReference(type); |
| 2646 Element helper = backend.getGetObjectIsSubtype(); | 2647 Element helper = backend.getGetObjectIsSubtype(); |
| 2647 HInstruction helperCall = new HStatic(helper); | 2648 HInstruction helperCall = new HStatic(helper); |
| 2648 add(helperCall); | 2649 add(helperCall); |
| 2649 List<HInstruction> inputs = <HInstruction>[helperCall, expression, | 2650 List<HInstruction> inputs = <HInstruction>[helperCall, expression, |
| 2650 runtimeType]; | 2651 runtimeType]; |
| 2651 instruction = new HInvokeStatic(inputs, HType.BOOLEAN); | 2652 instruction = new HInvokeStatic(inputs, HType.BOOLEAN); |
| 2652 add(instruction); | 2653 add(instruction); |
| 2653 compiler.enqueuer.codegen.registerIsCheck(type); | 2654 compiler.enqueuer.codegen.registerIsCheck(type, elements); |
| 2654 | 2655 |
| 2655 } else if (RuntimeTypeInformation.hasTypeArguments(type)) { | 2656 } else if (RuntimeTypeInformation.hasTypeArguments(type)) { |
| 2656 | 2657 |
| 2657 void argumentsCheck() { | 2658 void argumentsCheck() { |
| 2658 HInstruction typeInfo = getRuntimeTypeInfo(expression); | 2659 HInstruction typeInfo = getRuntimeTypeInfo(expression); |
| 2659 Element helper = backend.getCheckArguments(); | 2660 Element helper = backend.getCheckArguments(); |
| 2660 HInstruction helperCall = new HStatic(helper); | 2661 HInstruction helperCall = new HStatic(helper); |
| 2661 add(helperCall); | 2662 add(helperCall); |
| 2662 List<HInstruction> representations = | 2663 List<HInstruction> representations = |
| 2663 buildTypeArgumentRepresentations(type); | 2664 buildTypeArgumentRepresentations(type); |
| (...skipping 2371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5035 new HSubGraphBlockInformation(elseBranch.graph)); | 5036 new HSubGraphBlockInformation(elseBranch.graph)); |
| 5036 | 5037 |
| 5037 HBasicBlock conditionStartBlock = conditionBranch.block; | 5038 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 5038 conditionStartBlock.setBlockFlow(info, joinBlock); | 5039 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 5039 SubGraph conditionGraph = conditionBranch.graph; | 5040 SubGraph conditionGraph = conditionBranch.graph; |
| 5040 HIf branch = conditionGraph.end.last; | 5041 HIf branch = conditionGraph.end.last; |
| 5041 assert(branch is HIf); | 5042 assert(branch is HIf); |
| 5042 branch.blockInformation = conditionStartBlock.blockFlow; | 5043 branch.blockInformation = conditionStartBlock.blockFlow; |
| 5043 } | 5044 } |
| 5044 } | 5045 } |
| OLD | NEW |