| 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 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 ConstructorBodyElement body = backendMember; | 1063 ConstructorBodyElement body = backendMember; |
| 1064 if (body.constructor == constructor) { | 1064 if (body.constructor == constructor) { |
| 1065 // TODO(kasperl): Find a way of stopping the iteration | 1065 // TODO(kasperl): Find a way of stopping the iteration |
| 1066 // through the backend members. | 1066 // through the backend members. |
| 1067 bodyElement = backendMember; | 1067 bodyElement = backendMember; |
| 1068 } | 1068 } |
| 1069 } | 1069 } |
| 1070 }); | 1070 }); |
| 1071 if (bodyElement == null) { | 1071 if (bodyElement == null) { |
| 1072 bodyElement = new ConstructorBodyElementX(constructor); | 1072 bodyElement = new ConstructorBodyElementX(constructor); |
| 1073 // [:resolveMethodElement:] require the passed element to be a | |
| 1074 // declaration. | |
| 1075 TreeElements treeElements = | |
| 1076 compiler.enqueuer.resolution.getCachedElements( | |
| 1077 constructor.declaration); | |
| 1078 classElement.addBackendMember(bodyElement); | 1073 classElement.addBackendMember(bodyElement); |
| 1079 | 1074 |
| 1080 if (constructor.isPatch) { | 1075 if (constructor.isPatch) { |
| 1081 // Create origin body element for patched constructors. | 1076 // Create origin body element for patched constructors. |
| 1082 bodyElement.origin = new ConstructorBodyElementX(constructor.origin); | 1077 bodyElement.origin = new ConstructorBodyElementX(constructor.origin); |
| 1083 bodyElement.origin.patch = bodyElement; | 1078 bodyElement.origin.patch = bodyElement; |
| 1084 classElement.origin.addBackendMember(bodyElement.origin); | 1079 classElement.origin.addBackendMember(bodyElement.origin); |
| 1085 } | 1080 } |
| 1086 // Set the [TreeElements] of the generative constructor body to | |
| 1087 // be the same as the generative constructor. | |
| 1088 compiler.enqueuer.resolution.ensureCachedElements( | |
| 1089 bodyElement.declaration, | |
| 1090 treeElements); | |
| 1091 } | 1081 } |
| 1092 assert(bodyElement.isGenerativeConstructorBody()); | 1082 assert(bodyElement.isGenerativeConstructorBody()); |
| 1093 return bodyElement; | 1083 return bodyElement; |
| 1094 } | 1084 } |
| 1095 | 1085 |
| 1096 HParameterValue addParameter(Element element) { | 1086 HParameterValue addParameter(Element element) { |
| 1097 assert(inliningStack.isEmpty); | 1087 assert(inliningStack.isEmpty); |
| 1098 HParameterValue result = new HParameterValue(element); | 1088 HParameterValue result = new HParameterValue(element); |
| 1099 if (lastAddedParameter == null) { | 1089 if (lastAddedParameter == null) { |
| 1100 graph.entry.addBefore(graph.entry.first, result); | 1090 graph.entry.addBefore(graph.entry.first, result); |
| (...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2419 | 2409 |
| 2420 visitFunctionExpression(FunctionExpression node) { | 2410 visitFunctionExpression(FunctionExpression node) { |
| 2421 ClosureClassMap nestedClosureData = | 2411 ClosureClassMap nestedClosureData = |
| 2422 compiler.closureToClassMapper.getMappingForNestedFunction(node); | 2412 compiler.closureToClassMapper.getMappingForNestedFunction(node); |
| 2423 assert(nestedClosureData != null); | 2413 assert(nestedClosureData != null); |
| 2424 assert(nestedClosureData.closureClassElement != null); | 2414 assert(nestedClosureData.closureClassElement != null); |
| 2425 ClassElement closureClassElement = | 2415 ClassElement closureClassElement = |
| 2426 nestedClosureData.closureClassElement; | 2416 nestedClosureData.closureClassElement; |
| 2427 FunctionElement callElement = nestedClosureData.callElement; | 2417 FunctionElement callElement = nestedClosureData.callElement; |
| 2428 // TODO(ahe): This should be registered in codegen, not here. | 2418 // TODO(ahe): This should be registered in codegen, not here. |
| 2429 compiler.enqueuer.codegen.addToWorkList(callElement, elements); | 2419 compiler.enqueuer.codegen.addToWorkList(callElement); |
| 2430 // TODO(ahe): This should be registered in codegen, not here. | 2420 // TODO(ahe): This should be registered in codegen, not here. |
| 2431 compiler.enqueuer.codegen.registerInstantiatedClass( | 2421 compiler.enqueuer.codegen.registerInstantiatedClass( |
| 2432 closureClassElement, work.resolutionTree); | 2422 closureClassElement, work.resolutionTree); |
| 2433 | 2423 |
| 2434 List<HInstruction> capturedVariables = <HInstruction>[]; | 2424 List<HInstruction> capturedVariables = <HInstruction>[]; |
| 2435 closureClassElement.forEachMember((_, Element member) { | 2425 closureClassElement.forEachMember((_, Element member) { |
| 2436 // The backendMembers also contains the call method(s). We are only | 2426 // The backendMembers also contains the call method(s). We are only |
| 2437 // interested in the fields. | 2427 // interested in the fields. |
| 2438 if (member.isField()) { | 2428 if (member.isField()) { |
| 2439 Element capturedLocal = nestedClosureData.capturedFieldMapping[member]; | 2429 Element capturedLocal = nestedClosureData.capturedFieldMapping[member]; |
| (...skipping 2943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5383 new HSubGraphBlockInformation(elseBranch.graph)); | 5373 new HSubGraphBlockInformation(elseBranch.graph)); |
| 5384 | 5374 |
| 5385 HBasicBlock conditionStartBlock = conditionBranch.block; | 5375 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 5386 conditionStartBlock.setBlockFlow(info, joinBlock); | 5376 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 5387 SubGraph conditionGraph = conditionBranch.graph; | 5377 SubGraph conditionGraph = conditionBranch.graph; |
| 5388 HIf branch = conditionGraph.end.last; | 5378 HIf branch = conditionGraph.end.last; |
| 5389 assert(branch is HIf); | 5379 assert(branch is HIf); |
| 5390 branch.blockInformation = conditionStartBlock.blockFlow; | 5380 branch.blockInformation = conditionStartBlock.blockFlow; |
| 5391 } | 5381 } |
| 5392 } | 5382 } |
| OLD | NEW |