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 class SsaFunctionCompiler implements FunctionCompiler { | 7 class SsaFunctionCompiler implements FunctionCompiler { |
8 SsaCodeGeneratorTask generator; | 8 SsaCodeGeneratorTask generator; |
9 SsaBuilderTask builder; | 9 SsaBuilderTask builder; |
10 SsaOptimizerTask optimizer; | 10 SsaOptimizerTask optimizer; |
(...skipping 15 matching lines...) Expand all Loading... |
26 JavaScriptBackend backend = builder.backend; | 26 JavaScriptBackend backend = builder.backend; |
27 | 27 |
28 AsyncRewriterBase rewriter = null; | 28 AsyncRewriterBase rewriter = null; |
29 String name = backend.namer.methodPropertyName(element); | 29 String name = backend.namer.methodPropertyName(element); |
30 if (element.asyncMarker == AsyncMarker.ASYNC) { | 30 if (element.asyncMarker == AsyncMarker.ASYNC) { |
31 rewriter = new AsyncRewriter( | 31 rewriter = new AsyncRewriter( |
32 backend.compiler, | 32 backend.compiler, |
33 backend.compiler.currentElement, | 33 backend.compiler.currentElement, |
34 asyncHelper: | 34 asyncHelper: |
35 backend.emitter.staticFunctionAccess(backend.getAsyncHelper()), | 35 backend.emitter.staticFunctionAccess(backend.getAsyncHelper()), |
| 36 wrapBody: |
| 37 backend.emitter.staticFunctionAccess(backend.getWrapBody()), |
36 newCompleter: backend.emitter.staticFunctionAccess( | 38 newCompleter: backend.emitter.staticFunctionAccess( |
37 backend.getCompleterConstructor()), | 39 backend.getCompleterConstructor()), |
38 safeVariableName: backend.namer.safeVariableName, | 40 safeVariableName: backend.namer.safeVariableName, |
39 bodyName: name); | 41 bodyName: name); |
40 } else if (element.asyncMarker == AsyncMarker.SYNC_STAR) { | 42 } else if (element.asyncMarker == AsyncMarker.SYNC_STAR) { |
41 rewriter = new SyncStarRewriter( | 43 rewriter = new SyncStarRewriter( |
42 backend.compiler, | 44 backend.compiler, |
43 backend.compiler.currentElement, | 45 backend.compiler.currentElement, |
44 endOfIteration: backend.emitter.staticFunctionAccess( | 46 endOfIteration: backend.emitter.staticFunctionAccess( |
45 backend.getEndOfIteration()), | 47 backend.getEndOfIteration()), |
46 newIterable: backend.emitter.staticFunctionAccess( | 48 newIterable: backend.emitter.staticFunctionAccess( |
47 backend.getSyncStarIterableConstructor()), | 49 backend.getSyncStarIterableConstructor()), |
48 yieldStarExpression: backend.emitter.staticFunctionAccess( | 50 yieldStarExpression: backend.emitter.staticFunctionAccess( |
49 backend.getYieldStar()), | 51 backend.getYieldStar()), |
50 uncaughtErrorExpression: backend.emitter.staticFunctionAccess( | 52 uncaughtErrorExpression: backend.emitter.staticFunctionAccess( |
51 backend.getSyncStarUncaughtError()), | 53 backend.getSyncStarUncaughtError()), |
52 safeVariableName: backend.namer.safeVariableName, | 54 safeVariableName: backend.namer.safeVariableName, |
53 bodyName: name); | 55 bodyName: name); |
54 } | 56 } |
55 else if (element.asyncMarker == AsyncMarker.ASYNC_STAR) { | 57 else if (element.asyncMarker == AsyncMarker.ASYNC_STAR) { |
56 rewriter = new AsyncStarRewriter( | 58 rewriter = new AsyncStarRewriter( |
57 backend.compiler, | 59 backend.compiler, |
58 backend.compiler.currentElement, | 60 backend.compiler.currentElement, |
59 asyncStarHelper: backend.emitter.staticFunctionAccess( | 61 asyncStarHelper: backend.emitter.staticFunctionAccess( |
60 backend.getAsyncStarHelper()), | 62 backend.getAsyncStarHelper()), |
61 streamOfController: backend.emitter.staticFunctionAccess( | 63 streamOfController: backend.emitter.staticFunctionAccess( |
62 backend.getStreamOfController()), | 64 backend.getStreamOfController()), |
| 65 wrapBody: |
| 66 backend.emitter.staticFunctionAccess(backend.getWrapBody()), |
63 newController: backend.emitter.staticFunctionAccess( | 67 newController: backend.emitter.staticFunctionAccess( |
64 backend.getASyncStarControllerConstructor()), | 68 backend.getASyncStarControllerConstructor()), |
65 safeVariableName: backend.namer.safeVariableName, | 69 safeVariableName: backend.namer.safeVariableName, |
66 yieldExpression: backend.emitter.staticFunctionAccess( | 70 yieldExpression: backend.emitter.staticFunctionAccess( |
67 backend.getYieldSingle()), | 71 backend.getYieldSingle()), |
68 yieldStarExpression: backend.emitter.staticFunctionAccess( | 72 yieldStarExpression: backend.emitter.staticFunctionAccess( |
69 backend.getYieldStar()), | 73 backend.getYieldStar()), |
70 bodyName: name); | 74 bodyName: name); |
71 } | 75 } |
72 if (rewriter != null) { | 76 if (rewriter != null) { |
(...skipping 7771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7844 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 7848 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
7845 unaliased.accept(this, builder); | 7849 unaliased.accept(this, builder); |
7846 } | 7850 } |
7847 | 7851 |
7848 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 7852 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
7849 JavaScriptBackend backend = builder.compiler.backend; | 7853 JavaScriptBackend backend = builder.compiler.backend; |
7850 ClassElement cls = backend.findHelper('DynamicRuntimeType'); | 7854 ClassElement cls = backend.findHelper('DynamicRuntimeType'); |
7851 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); | 7855 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); |
7852 } | 7856 } |
7853 } | 7857 } |
OLD | NEW |