| 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 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1557 // In case the field initializer uses closures, run the | 1557 // In case the field initializer uses closures, run the |
| 1558 // closure to class mapper. | 1558 // closure to class mapper. |
| 1559 compiler.closureToClassMapper.computeClosureToClassMapping( | 1559 compiler.closureToClassMapper.computeClosureToClassMapping( |
| 1560 member, node, elements); | 1560 member, node, elements); |
| 1561 inlinedFrom(member, () => right.accept(this)); | 1561 inlinedFrom(member, () => right.accept(this)); |
| 1562 elements = savedElements; | 1562 elements = savedElements; |
| 1563 value = pop(); | 1563 value = pop(); |
| 1564 } | 1564 } |
| 1565 fieldValues[member] = value; | 1565 fieldValues[member] = value; |
| 1566 }); | 1566 }); |
| 1567 }, | 1567 }); |
| 1568 includeBackendMembers: true, | |
| 1569 includeSuperMembers: false); | |
| 1570 } | 1568 } |
| 1571 | 1569 |
| 1572 | 1570 |
| 1573 /** | 1571 /** |
| 1574 * Build the factory function corresponding to the constructor | 1572 * Build the factory function corresponding to the constructor |
| 1575 * [functionElement]: | 1573 * [functionElement]: |
| 1576 * - Initialize fields with the values of the field initializers of the | 1574 * - Initialize fields with the values of the field initializers of the |
| 1577 * current constructor and super constructors or constructors redirected | 1575 * current constructor and super constructors or constructors redirected |
| 1578 * to, starting from the current constructor. | 1576 * to, starting from the current constructor. |
| 1579 * - Call the the constructor bodies, starting from the constructor(s) in the | 1577 * - Call the the constructor bodies, starting from the constructor(s) in the |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1617 List<FunctionElement> constructors = <FunctionElement>[functionElement]; | 1615 List<FunctionElement> constructors = <FunctionElement>[functionElement]; |
| 1618 buildInitializers(functionElement, constructors, fieldValues); | 1616 buildInitializers(functionElement, constructors, fieldValues); |
| 1619 | 1617 |
| 1620 // Call the JavaScript constructor with the fields as argument. | 1618 // Call the JavaScript constructor with the fields as argument. |
| 1621 List<HInstruction> constructorArguments = <HInstruction>[]; | 1619 List<HInstruction> constructorArguments = <HInstruction>[]; |
| 1622 classElement.forEachInstanceField( | 1620 classElement.forEachInstanceField( |
| 1623 (ClassElement enclosingClass, Element member) { | 1621 (ClassElement enclosingClass, Element member) { |
| 1624 constructorArguments.add(potentiallyCheckType( | 1622 constructorArguments.add(potentiallyCheckType( |
| 1625 fieldValues[member], member.computeType(compiler))); | 1623 fieldValues[member], member.computeType(compiler))); |
| 1626 }, | 1624 }, |
| 1627 includeBackendMembers: true, | 1625 includeSuperAndInjectedMembers: true); |
| 1628 includeSuperMembers: true); | |
| 1629 | 1626 |
| 1630 InterfaceType type = classElement.computeType(compiler); | 1627 InterfaceType type = classElement.computeType(compiler); |
| 1631 HType ssaType = new HType.nonNullExact(type, compiler); | 1628 HType ssaType = new HType.nonNullExact(type, compiler); |
| 1632 HForeignNew newObject = new HForeignNew(classElement, | 1629 HForeignNew newObject = new HForeignNew(classElement, |
| 1633 ssaType, | 1630 ssaType, |
| 1634 constructorArguments); | 1631 constructorArguments); |
| 1635 add(newObject); | 1632 add(newObject); |
| 1636 | 1633 |
| 1637 // Create the runtime type information, if needed. | 1634 // Create the runtime type information, if needed. |
| 1638 if (backend.needsRti(classElement)) { | 1635 if (backend.needsRti(classElement)) { |
| (...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2480 assert(nestedClosureData != null); | 2477 assert(nestedClosureData != null); |
| 2481 assert(nestedClosureData.closureClassElement != null); | 2478 assert(nestedClosureData.closureClassElement != null); |
| 2482 ClassElement closureClassElement = | 2479 ClassElement closureClassElement = |
| 2483 nestedClosureData.closureClassElement; | 2480 nestedClosureData.closureClassElement; |
| 2484 FunctionElement callElement = nestedClosureData.callElement; | 2481 FunctionElement callElement = nestedClosureData.callElement; |
| 2485 // TODO(ahe): This should be registered in codegen, not here. | 2482 // TODO(ahe): This should be registered in codegen, not here. |
| 2486 compiler.enqueuer.codegen.addToWorkList(callElement, elements); | 2483 compiler.enqueuer.codegen.addToWorkList(callElement, elements); |
| 2487 // TODO(ahe): This should be registered in codegen, not here. | 2484 // TODO(ahe): This should be registered in codegen, not here. |
| 2488 compiler.enqueuer.codegen.registerInstantiatedClass( | 2485 compiler.enqueuer.codegen.registerInstantiatedClass( |
| 2489 closureClassElement, work.resolutionTree); | 2486 closureClassElement, work.resolutionTree); |
| 2490 assert(!closureClassElement.hasLocalScopeMembers); | |
| 2491 | 2487 |
| 2492 List<HInstruction> capturedVariables = <HInstruction>[]; | 2488 List<HInstruction> capturedVariables = <HInstruction>[]; |
| 2493 closureClassElement.forEachBackendMember((Element member) { | 2489 closureClassElement.forEachMember((_, Element member) { |
| 2494 // The backendMembers also contains the call method(s). We are only | 2490 // The backendMembers also contains the call method(s). We are only |
| 2495 // interested in the fields. | 2491 // interested in the fields. |
| 2496 if (member.isField()) { | 2492 if (member.isField()) { |
| 2497 Element capturedLocal = nestedClosureData.capturedFieldMapping[member]; | 2493 Element capturedLocal = nestedClosureData.capturedFieldMapping[member]; |
| 2498 assert(capturedLocal != null); | 2494 assert(capturedLocal != null); |
| 2499 capturedVariables.add(localsHandler.readLocal(capturedLocal)); | 2495 capturedVariables.add(localsHandler.readLocal(capturedLocal)); |
| 2500 } | 2496 } |
| 2501 }); | 2497 }); |
| 2502 | 2498 |
| 2503 HType type = new HType.nonNullExact( | 2499 HType type = new HType.nonNullExact( |
| (...skipping 2906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5410 new HSubGraphBlockInformation(elseBranch.graph)); | 5406 new HSubGraphBlockInformation(elseBranch.graph)); |
| 5411 | 5407 |
| 5412 HBasicBlock conditionStartBlock = conditionBranch.block; | 5408 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 5413 conditionStartBlock.setBlockFlow(info, joinBlock); | 5409 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 5414 SubGraph conditionGraph = conditionBranch.graph; | 5410 SubGraph conditionGraph = conditionBranch.graph; |
| 5415 HIf branch = conditionGraph.end.last; | 5411 HIf branch = conditionGraph.end.last; |
| 5416 assert(branch is HIf); | 5412 assert(branch is HIf); |
| 5417 branch.blockInformation = conditionStartBlock.blockFlow; | 5413 branch.blockInformation = conditionStartBlock.blockFlow; |
| 5418 } | 5414 } |
| 5419 } | 5415 } |
| OLD | NEW |