| 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 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR"); | 9 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR"); |
| 10 | 10 |
| (...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1593 } | 1593 } |
| 1594 | 1594 |
| 1595 Element getCreateInvocationMirror() { | 1595 Element getCreateInvocationMirror() { |
| 1596 return findHelper(Compiler.CREATE_INVOCATION_MIRROR); | 1596 return findHelper(Compiler.CREATE_INVOCATION_MIRROR); |
| 1597 } | 1597 } |
| 1598 | 1598 |
| 1599 Element getCyclicThrowHelper() { | 1599 Element getCyclicThrowHelper() { |
| 1600 return findHelper("throwCyclicInit"); | 1600 return findHelper("throwCyclicInit"); |
| 1601 } | 1601 } |
| 1602 | 1602 |
| 1603 Element getThenHelper() { | 1603 Element getAsyncHelper() { |
| 1604 return findHelper("thenHelper"); | 1604 return findHelper("asyncHelper"); |
| 1605 } | 1605 } |
| 1606 | 1606 |
| 1607 Element getYieldStar() { | 1607 Element getYieldStar() { |
| 1608 ClassElement classElement = findHelper("IterationMarker"); | 1608 ClassElement classElement = findHelper("IterationMarker"); |
| 1609 classElement.ensureResolved(compiler); | 1609 classElement.ensureResolved(compiler); |
| 1610 return classElement.lookupLocalMember("yieldStar"); | 1610 return classElement.lookupLocalMember("yieldStar"); |
| 1611 } | 1611 } |
| 1612 | 1612 |
| 1613 Element getYieldSingle() { | 1613 Element getYieldSingle() { |
| 1614 ClassElement classElement = findHelper("IterationMarker"); | 1614 ClassElement classElement = findHelper("IterationMarker"); |
| 1615 classElement.ensureResolved(compiler); | 1615 classElement.ensureResolved(compiler); |
| 1616 return classElement.lookupLocalMember("yieldSingle"); | 1616 return classElement.lookupLocalMember("yieldSingle"); |
| 1617 } | 1617 } |
| 1618 | 1618 |
| 1619 Element getStreamHelper() { | 1619 Element getAsyncStarHelper() { |
| 1620 return findHelper("streamHelper"); | 1620 return findHelper("asyncStarHelper"); |
| 1621 } | 1621 } |
| 1622 | 1622 |
| 1623 Element getStreamOfController() { | 1623 Element getStreamOfController() { |
| 1624 return findHelper("streamOfController"); | 1624 return findHelper("streamOfController"); |
| 1625 } | 1625 } |
| 1626 | 1626 |
| 1627 Element getEndOfIteration() { | 1627 Element getEndOfIteration() { |
| 1628 ClassElement classElement = findHelper("IterationMarker"); | 1628 ClassElement classElement = findHelper("IterationMarker"); |
| 1629 classElement.ensureResolved(compiler); | 1629 classElement.ensureResolved(compiler); |
| 1630 return classElement.lookupLocalMember("endOfIteration"); | 1630 return classElement.lookupLocalMember("endOfIteration"); |
| (...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2398 : "out"; | 2398 : "out"; |
| 2399 String outName = outPath.substring(outPath.lastIndexOf('/') + 1); | 2399 String outName = outPath.substring(outPath.lastIndexOf('/') + 1); |
| 2400 String extension = addExtension ? ".part.js" : ""; | 2400 String extension = addExtension ? ".part.js" : ""; |
| 2401 return "${outName}_$name$extension"; | 2401 return "${outName}_$name$extension"; |
| 2402 } | 2402 } |
| 2403 | 2403 |
| 2404 void registerAsyncMarker(FunctionElement element, | 2404 void registerAsyncMarker(FunctionElement element, |
| 2405 Enqueuer enqueuer, | 2405 Enqueuer enqueuer, |
| 2406 Registry registry) { | 2406 Registry registry) { |
| 2407 if (element.asyncMarker == AsyncMarker.ASYNC) { | 2407 if (element.asyncMarker == AsyncMarker.ASYNC) { |
| 2408 enqueue(enqueuer, getThenHelper(), registry); | 2408 enqueue(enqueuer, getAsyncHelper(), registry); |
| 2409 enqueue(enqueuer, getCompleterConstructor(), registry); | 2409 enqueue(enqueuer, getCompleterConstructor(), registry); |
| 2410 enqueue(enqueuer, getStreamIteratorConstructor(), registry); | 2410 enqueue(enqueuer, getStreamIteratorConstructor(), registry); |
| 2411 } else if (element.asyncMarker == AsyncMarker.SYNC_STAR) { | 2411 } else if (element.asyncMarker == AsyncMarker.SYNC_STAR) { |
| 2412 enqueuer.registerInstantiatedClass(getSyncStarIterable(), registry); | 2412 enqueuer.registerInstantiatedClass(getSyncStarIterable(), registry); |
| 2413 enqueue(enqueuer, getSyncStarIterableConstructor(), registry); | 2413 enqueue(enqueuer, getSyncStarIterableConstructor(), registry); |
| 2414 enqueue(enqueuer, getEndOfIteration(), registry); | 2414 enqueue(enqueuer, getEndOfIteration(), registry); |
| 2415 enqueue(enqueuer, getYieldStar(), registry); | 2415 enqueue(enqueuer, getYieldStar(), registry); |
| 2416 } else if (element.asyncMarker == AsyncMarker.ASYNC_STAR) { | 2416 } else if (element.asyncMarker == AsyncMarker.ASYNC_STAR) { |
| 2417 enqueuer.registerInstantiatedClass(getASyncStarController(), registry); | 2417 enqueuer.registerInstantiatedClass(getASyncStarController(), registry); |
| 2418 enqueue(enqueuer, getStreamHelper(), registry); | 2418 enqueue(enqueuer, getAsyncStarHelper(), registry); |
| 2419 enqueue(enqueuer, getStreamOfController(), registry); | 2419 enqueue(enqueuer, getStreamOfController(), registry); |
| 2420 enqueue(enqueuer, getYieldSingle(), registry); | 2420 enqueue(enqueuer, getYieldSingle(), registry); |
| 2421 enqueue(enqueuer, getYieldStar(), registry); | 2421 enqueue(enqueuer, getYieldStar(), registry); |
| 2422 enqueue(enqueuer, getASyncStarControllerConstructor(), registry); | 2422 enqueue(enqueuer, getASyncStarControllerConstructor(), registry); |
| 2423 enqueue(enqueuer, getStreamIteratorConstructor(), registry); | 2423 enqueue(enqueuer, getStreamIteratorConstructor(), registry); |
| 2424 } | 2424 } |
| 2425 } | 2425 } |
| 2426 } | 2426 } |
| 2427 | 2427 |
| 2428 /// Handling of special annotations for tests. | 2428 /// Handling of special annotations for tests. |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2681 } | 2681 } |
| 2682 } | 2682 } |
| 2683 | 2683 |
| 2684 /// Records that [constant] is used by the element behind [registry]. | 2684 /// Records that [constant] is used by the element behind [registry]. |
| 2685 class Dependency { | 2685 class Dependency { |
| 2686 final ConstantValue constant; | 2686 final ConstantValue constant; |
| 2687 final Element annotatedElement; | 2687 final Element annotatedElement; |
| 2688 | 2688 |
| 2689 const Dependency(this.constant, this.annotatedElement); | 2689 const Dependency(this.constant, this.annotatedElement); |
| 2690 } | 2690 } |
| OLD | NEW |