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 2212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2223 ClosureClassMap nestedClosureData = | 2223 ClosureClassMap nestedClosureData = |
2224 compiler.closureToClassMapper.getMappingForNestedFunction(node); | 2224 compiler.closureToClassMapper.getMappingForNestedFunction(node); |
2225 assert(nestedClosureData != null); | 2225 assert(nestedClosureData != null); |
2226 assert(nestedClosureData.closureClassElement != null); | 2226 assert(nestedClosureData.closureClassElement != null); |
2227 ClassElement closureClassElement = | 2227 ClassElement closureClassElement = |
2228 nestedClosureData.closureClassElement; | 2228 nestedClosureData.closureClassElement; |
2229 FunctionElement callElement = nestedClosureData.callElement; | 2229 FunctionElement callElement = nestedClosureData.callElement; |
2230 // TODO(ahe): This should be registered in codegen, not here. | 2230 // TODO(ahe): This should be registered in codegen, not here. |
2231 compiler.enqueuer.codegen.addToWorkList(callElement, elements); | 2231 compiler.enqueuer.codegen.addToWorkList(callElement, elements); |
2232 // TODO(ahe): This should be registered in codegen, not here. | 2232 // TODO(ahe): This should be registered in codegen, not here. |
2233 compiler.enqueuer.codegen.registerInstantiatedClass(closureClassElement); | 2233 compiler.enqueuer.codegen.registerInstantiatedClass( |
| 2234 closureClassElement, work.resolutionTree); |
2234 assert(!closureClassElement.hasLocalScopeMembers); | 2235 assert(!closureClassElement.hasLocalScopeMembers); |
2235 | 2236 |
2236 List<HInstruction> capturedVariables = <HInstruction>[]; | 2237 List<HInstruction> capturedVariables = <HInstruction>[]; |
2237 closureClassElement.forEachBackendMember((Element member) { | 2238 closureClassElement.forEachBackendMember((Element member) { |
2238 // The backendMembers also contains the call method(s). We are only | 2239 // The backendMembers also contains the call method(s). We are only |
2239 // interested in the fields. | 2240 // interested in the fields. |
2240 if (member.isField()) { | 2241 if (member.isField()) { |
2241 Element capturedLocal = nestedClosureData.capturedFieldMapping[member]; | 2242 Element capturedLocal = nestedClosureData.capturedFieldMapping[member]; |
2242 assert(capturedLocal != null); | 2243 assert(capturedLocal != null); |
2243 capturedVariables.add(localsHandler.readLocal(capturedLocal)); | 2244 capturedVariables.add(localsHandler.readLocal(capturedLocal)); |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2657 HInstruction instruction; | 2658 HInstruction instruction; |
2658 if (type.kind == TypeKind.TYPE_VARIABLE) { | 2659 if (type.kind == TypeKind.TYPE_VARIABLE) { |
2659 HInstruction runtimeType = addTypeVariableReference(type); | 2660 HInstruction runtimeType = addTypeVariableReference(type); |
2660 Element helper = backend.getGetObjectIsSubtype(); | 2661 Element helper = backend.getGetObjectIsSubtype(); |
2661 HInstruction helperCall = new HStatic(helper); | 2662 HInstruction helperCall = new HStatic(helper); |
2662 add(helperCall); | 2663 add(helperCall); |
2663 List<HInstruction> inputs = <HInstruction>[helperCall, expression, | 2664 List<HInstruction> inputs = <HInstruction>[helperCall, expression, |
2664 runtimeType]; | 2665 runtimeType]; |
2665 instruction = new HInvokeStatic(inputs, HType.BOOLEAN); | 2666 instruction = new HInvokeStatic(inputs, HType.BOOLEAN); |
2666 add(instruction); | 2667 add(instruction); |
2667 compiler.enqueuer.codegen.registerIsCheck(type); | 2668 compiler.enqueuer.codegen.registerIsCheck(type, elements); |
2668 | 2669 |
2669 } else if (RuntimeTypeInformation.hasTypeArguments(type)) { | 2670 } else if (RuntimeTypeInformation.hasTypeArguments(type)) { |
2670 | 2671 |
2671 void argumentsCheck() { | 2672 void argumentsCheck() { |
2672 HInstruction typeInfo = getRuntimeTypeInfo(expression); | 2673 HInstruction typeInfo = getRuntimeTypeInfo(expression); |
2673 Element helper = backend.getCheckArguments(); | 2674 Element helper = backend.getCheckArguments(); |
2674 HInstruction helperCall = new HStatic(helper); | 2675 HInstruction helperCall = new HStatic(helper); |
2675 add(helperCall); | 2676 add(helperCall); |
2676 HInstruction representations = | 2677 HInstruction representations = |
2677 buildTypeArgumentRepresentations(type); | 2678 buildTypeArgumentRepresentations(type); |
(...skipping 2419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5097 new HSubGraphBlockInformation(elseBranch.graph)); | 5098 new HSubGraphBlockInformation(elseBranch.graph)); |
5098 | 5099 |
5099 HBasicBlock conditionStartBlock = conditionBranch.block; | 5100 HBasicBlock conditionStartBlock = conditionBranch.block; |
5100 conditionStartBlock.setBlockFlow(info, joinBlock); | 5101 conditionStartBlock.setBlockFlow(info, joinBlock); |
5101 SubGraph conditionGraph = conditionBranch.graph; | 5102 SubGraph conditionGraph = conditionBranch.graph; |
5102 HIf branch = conditionGraph.end.last; | 5103 HIf branch = conditionGraph.end.last; |
5103 assert(branch is HIf); | 5104 assert(branch is HIf); |
5104 branch.blockInformation = conditionStartBlock.blockFlow; | 5105 branch.blockInformation = conditionStartBlock.blockFlow; |
5105 } | 5106 } |
5106 } | 5107 } |
OLD | NEW |