| 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 js_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 const VERBOSE_OPTIMIZER_HINTS = false; | 7 const VERBOSE_OPTIMIZER_HINTS = false; |
| 8 | 8 |
| 9 class JavaScriptItemCompilationContext extends ItemCompilationContext { | 9 class JavaScriptItemCompilationContext extends ItemCompilationContext { |
| 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); | 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); |
| (...skipping 1879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1890 classElement.ensureResolved(compiler); | 1890 classElement.ensureResolved(compiler); |
| 1891 return classElement; | 1891 return classElement; |
| 1892 } | 1892 } |
| 1893 | 1893 |
| 1894 Element getSyncStarIterableConstructor() { | 1894 Element getSyncStarIterableConstructor() { |
| 1895 ClassElement classElement = getSyncStarIterable(); | 1895 ClassElement classElement = getSyncStarIterable(); |
| 1896 classElement.ensureResolved(compiler); | 1896 classElement.ensureResolved(compiler); |
| 1897 return classElement.lookupConstructor(""); | 1897 return classElement.lookupConstructor(""); |
| 1898 } | 1898 } |
| 1899 | 1899 |
| 1900 Element getCompleterConstructor() { | 1900 Element getSyncCompleterConstructor() { |
| 1901 ClassElement classElement = find(compiler.asyncLibrary, "Completer"); | 1901 ClassElement classElement = find(compiler.asyncLibrary, "Completer"); |
| 1902 classElement.ensureResolved(compiler); | 1902 classElement.ensureResolved(compiler); |
| 1903 return classElement.lookupConstructor(""); | 1903 return classElement.lookupConstructor("sync"); |
| 1904 } | 1904 } |
| 1905 | 1905 |
| 1906 Element getASyncStarController() { | 1906 Element getASyncStarController() { |
| 1907 ClassElement classElement = findHelper("AsyncStarStreamController"); | 1907 ClassElement classElement = findHelper("AsyncStarStreamController"); |
| 1908 classElement.ensureResolved(compiler); | 1908 classElement.ensureResolved(compiler); |
| 1909 return classElement; | 1909 return classElement; |
| 1910 } | 1910 } |
| 1911 | 1911 |
| 1912 Element getASyncStarControllerConstructor() { | 1912 Element getASyncStarControllerConstructor() { |
| 1913 ClassElement classElement = getASyncStarController(); | 1913 ClassElement classElement = getASyncStarController(); |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2682 String outName = outPath.substring(outPath.lastIndexOf('/') + 1); | 2682 String outName = outPath.substring(outPath.lastIndexOf('/') + 1); |
| 2683 String extension = addExtension ? ".part.js" : ""; | 2683 String extension = addExtension ? ".part.js" : ""; |
| 2684 return "${outName}_$name$extension"; | 2684 return "${outName}_$name$extension"; |
| 2685 } | 2685 } |
| 2686 | 2686 |
| 2687 void registerAsyncMarker(FunctionElement element, | 2687 void registerAsyncMarker(FunctionElement element, |
| 2688 Enqueuer enqueuer, | 2688 Enqueuer enqueuer, |
| 2689 Registry registry) { | 2689 Registry registry) { |
| 2690 if (element.asyncMarker == AsyncMarker.ASYNC) { | 2690 if (element.asyncMarker == AsyncMarker.ASYNC) { |
| 2691 enqueue(enqueuer, getAsyncHelper(), registry); | 2691 enqueue(enqueuer, getAsyncHelper(), registry); |
| 2692 enqueue(enqueuer, getCompleterConstructor(), registry); | 2692 enqueue(enqueuer, getSyncCompleterConstructor(), registry); |
| 2693 enqueue(enqueuer, getStreamIteratorConstructor(), registry); | 2693 enqueue(enqueuer, getStreamIteratorConstructor(), registry); |
| 2694 } else if (element.asyncMarker == AsyncMarker.SYNC_STAR) { | 2694 } else if (element.asyncMarker == AsyncMarker.SYNC_STAR) { |
| 2695 ClassElement clsSyncStarIterable = getSyncStarIterable(); | 2695 ClassElement clsSyncStarIterable = getSyncStarIterable(); |
| 2696 clsSyncStarIterable.ensureResolved(compiler); | 2696 clsSyncStarIterable.ensureResolved(compiler); |
| 2697 enqueuer.registerInstantiatedType(clsSyncStarIterable.rawType, registry); | 2697 enqueuer.registerInstantiatedType(clsSyncStarIterable.rawType, registry); |
| 2698 enqueue(enqueuer, getSyncStarIterableConstructor(), registry); | 2698 enqueue(enqueuer, getSyncStarIterableConstructor(), registry); |
| 2699 enqueue(enqueuer, getEndOfIteration(), registry); | 2699 enqueue(enqueuer, getEndOfIteration(), registry); |
| 2700 enqueue(enqueuer, getYieldStar(), registry); | 2700 enqueue(enqueuer, getYieldStar(), registry); |
| 2701 enqueue(enqueuer, getSyncStarUncaughtError(), registry); | 2701 enqueue(enqueuer, getSyncStarUncaughtError(), registry); |
| 2702 } else if (element.asyncMarker == AsyncMarker.ASYNC_STAR) { | 2702 } else if (element.asyncMarker == AsyncMarker.ASYNC_STAR) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2737 AsyncRewriterBase rewriter = null; | 2737 AsyncRewriterBase rewriter = null; |
| 2738 jsAst.Name name = namer.methodPropertyName(element); | 2738 jsAst.Name name = namer.methodPropertyName(element); |
| 2739 switch (element.asyncMarker) { | 2739 switch (element.asyncMarker) { |
| 2740 case AsyncMarker.ASYNC: | 2740 case AsyncMarker.ASYNC: |
| 2741 rewriter = new AsyncRewriter( | 2741 rewriter = new AsyncRewriter( |
| 2742 compiler, | 2742 compiler, |
| 2743 compiler.currentElement, | 2743 compiler.currentElement, |
| 2744 asyncHelper: | 2744 asyncHelper: |
| 2745 emitter.staticFunctionAccess(getAsyncHelper()), | 2745 emitter.staticFunctionAccess(getAsyncHelper()), |
| 2746 newCompleter: emitter.staticFunctionAccess( | 2746 newCompleter: emitter.staticFunctionAccess( |
| 2747 getCompleterConstructor()), | 2747 getSyncCompleterConstructor()), |
| 2748 safeVariableName: namer.safeVariablePrefixForAsyncRewrite, | 2748 safeVariableName: namer.safeVariablePrefixForAsyncRewrite, |
| 2749 bodyName: namer.deriveAsyncBodyName(name)); | 2749 bodyName: namer.deriveAsyncBodyName(name)); |
| 2750 break; | 2750 break; |
| 2751 case AsyncMarker.SYNC_STAR: | 2751 case AsyncMarker.SYNC_STAR: |
| 2752 rewriter = new SyncStarRewriter( | 2752 rewriter = new SyncStarRewriter( |
| 2753 compiler, | 2753 compiler, |
| 2754 compiler.currentElement, | 2754 compiler.currentElement, |
| 2755 endOfIteration: emitter.staticFunctionAccess( | 2755 endOfIteration: emitter.staticFunctionAccess( |
| 2756 getEndOfIteration()), | 2756 getEndOfIteration()), |
| 2757 newIterable: emitter.staticFunctionAccess( | 2757 newIterable: emitter.staticFunctionAccess( |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3069 } | 3069 } |
| 3070 } | 3070 } |
| 3071 | 3071 |
| 3072 /// Records that [constant] is used by the element behind [registry]. | 3072 /// Records that [constant] is used by the element behind [registry]. |
| 3073 class Dependency { | 3073 class Dependency { |
| 3074 final ConstantValue constant; | 3074 final ConstantValue constant; |
| 3075 final Element annotatedElement; | 3075 final Element annotatedElement; |
| 3076 | 3076 |
| 3077 const Dependency(this.constant, this.annotatedElement); | 3077 const Dependency(this.constant, this.annotatedElement); |
| 3078 } | 3078 } |
| OLD | NEW |