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