| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'package:kernel/ast.dart' as ir; | 5 import 'package:kernel/ast.dart' as ir; |
| 6 | 6 |
| 7 import '../closure.dart'; | 7 import '../closure.dart'; |
| 8 import '../common.dart'; | 8 import '../common.dart'; |
| 9 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; | 9 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; |
| 10 import '../common/names.dart'; | 10 import '../common/names.dart'; |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 LocalFunctionElement element = astAdapter.getElement(target); | 586 LocalFunctionElement element = astAdapter.getElement(target); |
| 587 ClosureClassMap classMap = compiler.closureToClassMapper | 587 ClosureClassMap classMap = compiler.closureToClassMapper |
| 588 .getClosureToClassMapping(element.resolvedAst); | 588 .getClosureToClassMapping(element.resolvedAst); |
| 589 return classMap.callElement; | 589 return classMap.callElement; |
| 590 } | 590 } |
| 591 Element element = astAdapter.getElement(target); | 591 Element element = astAdapter.getElement(target); |
| 592 return element; | 592 return element; |
| 593 } | 593 } |
| 594 | 594 |
| 595 @override | 595 @override |
| 596 void visitCheckLibraryIsLoaded(ir.CheckLibraryIsLoaded checkLoad) { |
| 597 HInstruction prefixConstant = graph.addConstantString( |
| 598 new DartString.literal(checkLoad.import.name), closedWorld); |
| 599 HInstruction uriConstant = graph.addConstantString( |
| 600 new DartString.literal(compiler.deferredLoadTask.getImportDeferName( |
| 601 // TODO(efortuna): Source information. |
| 602 null, |
| 603 astAdapter.getElement(checkLoad.import))), |
| 604 closedWorld); |
| 605 _pushStaticInvocation(astAdapter.checkDeferredIsLoaded, |
| 606 [prefixConstant, uriConstant], astAdapter.checkDeferredIsLoadedType); |
| 607 } |
| 608 |
| 609 @override |
| 610 void visitLoadLibrary(ir.LoadLibrary loadLibrary) { |
| 611 // TODO(efortuna): Source information! |
| 612 push(new HInvokeStatic( |
| 613 backend.helpers.loadLibraryWrapper, |
| 614 [ |
| 615 graph.addConstantString( |
| 616 new DartString.literal(loadLibrary.import.name), closedWorld) |
| 617 ], |
| 618 commonMasks.nonNullType, |
| 619 targetCanThrow: false)); |
| 620 } |
| 621 |
| 622 @override |
| 596 void visitBlock(ir.Block block) { | 623 void visitBlock(ir.Block block) { |
| 597 assert(!isAborted()); | 624 assert(!isAborted()); |
| 598 for (ir.Statement statement in block.statements) { | 625 for (ir.Statement statement in block.statements) { |
| 599 statement.accept(this); | 626 statement.accept(this); |
| 600 if (!isReachable) { | 627 if (!isReachable) { |
| 601 // The block has been aborted by a return or a throw. | 628 // The block has been aborted by a return or a throw. |
| 602 if (stack.isNotEmpty) { | 629 if (stack.isNotEmpty) { |
| 603 compiler.reporter.internalError( | 630 compiler.reporter.internalError( |
| 604 NO_LOCATION_SPANNABLE, 'Non-empty instruction stack.'); | 631 NO_LOCATION_SPANNABLE, 'Non-empty instruction stack.'); |
| 605 } | 632 } |
| (...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1823 } | 1850 } |
| 1824 | 1851 |
| 1825 @override | 1852 @override |
| 1826 void visitStaticGet(ir.StaticGet staticGet) { | 1853 void visitStaticGet(ir.StaticGet staticGet) { |
| 1827 ir.Member staticTarget = staticGet.target; | 1854 ir.Member staticTarget = staticGet.target; |
| 1828 if (staticTarget is ir.Procedure && | 1855 if (staticTarget is ir.Procedure && |
| 1829 staticTarget.kind == ir.ProcedureKind.Getter) { | 1856 staticTarget.kind == ir.ProcedureKind.Getter) { |
| 1830 // Invoke the getter | 1857 // Invoke the getter |
| 1831 _pushStaticInvocation(staticTarget, const <HInstruction>[], | 1858 _pushStaticInvocation(staticTarget, const <HInstruction>[], |
| 1832 astAdapter.returnTypeOf(staticTarget)); | 1859 astAdapter.returnTypeOf(staticTarget)); |
| 1833 } else if (staticTarget is ir.Field && staticTarget.isConst) { | 1860 } else if (staticTarget is ir.Field && |
| 1834 assert(staticTarget.initializer != null); | 1861 (staticTarget.isConst || |
| 1862 staticTarget.isFinal && !_isLazyStatic(staticTarget))) { |
| 1835 stack.add(graph.addConstant( | 1863 stack.add(graph.addConstant( |
| 1836 astAdapter.getConstantFor(staticTarget.initializer), closedWorld)); | 1864 astAdapter.getConstantFor(staticTarget.initializer), closedWorld)); |
| 1837 } else { | 1865 } else { |
| 1838 if (_isLazyStatic(staticTarget)) { | 1866 if (_isLazyStatic(staticTarget)) { |
| 1839 push(new HLazyStatic(astAdapter.getField(staticTarget), | 1867 push(new HLazyStatic(astAdapter.getField(staticTarget), |
| 1840 astAdapter.inferredTypeOf(staticTarget))); | 1868 astAdapter.inferredTypeOf(staticTarget))); |
| 1841 } else { | 1869 } else { |
| 1842 push(new HStatic(astAdapter.getMember(staticTarget), | 1870 push(new HStatic(astAdapter.getMember(staticTarget), |
| 1843 astAdapter.inferredTypeOf(staticTarget))); | 1871 astAdapter.inferredTypeOf(staticTarget))); |
| 1844 } | 1872 } |
| (...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3227 enterBlock.setBlockFlow( | 3255 enterBlock.setBlockFlow( |
| 3228 new HTryBlockInformation( | 3256 new HTryBlockInformation( |
| 3229 kernelBuilder.wrapStatementGraph(bodyGraph), | 3257 kernelBuilder.wrapStatementGraph(bodyGraph), |
| 3230 exception, | 3258 exception, |
| 3231 kernelBuilder.wrapStatementGraph(catchGraph), | 3259 kernelBuilder.wrapStatementGraph(catchGraph), |
| 3232 kernelBuilder.wrapStatementGraph(finallyGraph)), | 3260 kernelBuilder.wrapStatementGraph(finallyGraph)), |
| 3233 exitBlock); | 3261 exitBlock); |
| 3234 kernelBuilder.inTryStatement = previouslyInTryStatement; | 3262 kernelBuilder.inTryStatement = previouslyInTryStatement; |
| 3235 } | 3263 } |
| 3236 } | 3264 } |
| OLD | NEW |