Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart

Issue 12525007: Record dependency information to implement first version of dependency (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 /** 7 /**
8 * A function element that represents a closure call. The signature is copied 8 * A function element that represents a closure call. The signature is copied
9 * from the given element. 9 * from the given element.
10 */ 10 */
(...skipping 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 1587
1588 // Is it possible the primary function was inlined but the bailout was not? 1588 // Is it possible the primary function was inlined but the bailout was not?
1589 for (Element element in 1589 for (Element element in
1590 Elements.sortedByPosition(pendingElementsWithBailouts)) { 1590 Elements.sortedByPosition(pendingElementsWithBailouts)) {
1591 CodeBuffer buffer = bufferForElement(element, eagerBuffer); 1591 CodeBuffer buffer = bufferForElement(element, eagerBuffer);
1592 jsAst.Expression bailoutCode = backend.generatedBailoutCode[element]; 1592 jsAst.Expression bailoutCode = backend.generatedBailoutCode[element];
1593 emitStaticFunction(buffer, namer.getBailoutName(element), bailoutCode); 1593 emitStaticFunction(buffer, namer.getBailoutName(element), bailoutCode);
1594 } 1594 }
1595 } 1595 }
1596 1596
1597 void emitStaticFunctionGetters(CodeBuffer buffer) { 1597 void emitStaticFunctionGetters(CodeBuffer eagerBuffer) {
1598 Set<FunctionElement> functionsNeedingGetter = 1598 Set<FunctionElement> functionsNeedingGetter =
1599 compiler.codegenWorld.staticFunctionsNeedingGetter; 1599 compiler.codegenWorld.staticFunctionsNeedingGetter;
1600 for (FunctionElement element in 1600 for (FunctionElement element in
1601 Elements.sortedByPosition(functionsNeedingGetter)) { 1601 Elements.sortedByPosition(functionsNeedingGetter)) {
1602 // TODO(ahe): Defer loading of these getters. 1602 CodeBuffer buffer = bufferForElement(element, eagerBuffer);
1603 1603
1604 // The static function does not have the correct name. Since 1604 // The static function does not have the correct name. Since
1605 // [addParameterStubs] use the name to create its stubs we simply 1605 // [addParameterStubs] use the name to create its stubs we simply
1606 // create a fake element with the correct name. 1606 // create a fake element with the correct name.
1607 // Note: the callElement will not have any enclosingElement. 1607 // Note: the callElement will not have any enclosingElement.
1608 FunctionElement callElement = 1608 FunctionElement callElement =
1609 new ClosureInvocationElement(namer.closureInvocationSelectorName, 1609 new ClosureInvocationElement(namer.closureInvocationSelectorName,
1610 element); 1610 element);
1611 String staticName = namer.getName(element); 1611 String staticName = namer.getName(element);
1612 String invocationName = namer.instanceMethodName(callElement); 1612 String invocationName = namer.instanceMethodName(callElement);
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
2633 2633
2634 deferredBuffer.add('$finishClassesName(\$\$,' 2634 deferredBuffer.add('$finishClassesName(\$\$,'
2635 '$_${namer.CURRENT_ISOLATE},' 2635 '$_${namer.CURRENT_ISOLATE},'
2636 '$_$isolatePropertiesName)$N'); 2636 '$_$isolatePropertiesName)$N');
2637 // Reset the map. 2637 // Reset the map.
2638 deferredBuffer.add("\$\$$_=${_}null$N$n"); 2638 deferredBuffer.add("\$\$$_=${_}null$N$n");
2639 } 2639 }
2640 2640
2641 emitClosureClassIfNeeded(mainBuffer); 2641 emitClosureClassIfNeeded(mainBuffer);
2642 2642
2643 addComment('Bound closures', mainBuffer);
2643 // Now that we have emitted all classes, we know all the bound 2644 // Now that we have emitted all classes, we know all the bound
2644 // closures that will be needed. 2645 // closures that will be needed.
2645 for (jsAst.Node node in boundClosures) { 2646 for (jsAst.Node node in boundClosures) {
2646 // TODO(ahe): Some of these can be deferred. 2647 // TODO(ahe): Some of these can be deferred.
2647 mainBuffer.add(jsAst.prettyPrint(node, compiler)); 2648 mainBuffer.add(jsAst.prettyPrint(node, compiler));
2648 mainBuffer.add("$N$n"); 2649 mainBuffer.add("$N$n");
2649 } 2650 }
2650 2651
2651 emitFinishClassesInvocationIfNecessary(mainBuffer); 2652 emitFinishClassesInvocationIfNecessary(mainBuffer);
2652 2653
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
2758 """; 2759 """;
2759 const String HOOKS_API_USAGE = """ 2760 const String HOOKS_API_USAGE = """
2760 // The code supports the following hooks: 2761 // The code supports the following hooks:
2761 // dartPrint(message) - if this function is defined it is called 2762 // dartPrint(message) - if this function is defined it is called
2762 // instead of the Dart [print] method. 2763 // instead of the Dart [print] method.
2763 // dartMainRunner(main) - if this function is defined, the Dart [main] 2764 // dartMainRunner(main) - if this function is defined, the Dart [main]
2764 // method will not be invoked directly. 2765 // method will not be invoked directly.
2765 // Instead, a closure that will invoke [main] is 2766 // Instead, a closure that will invoke [main] is
2766 // passed to [dartMainRunner]. 2767 // passed to [dartMainRunner].
2767 """; 2768 """;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698