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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/builder.dart

Issue 11975049: Allowing inlining of static getters and methods in a different library. Also report an error if a g… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/ssa/builder.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/builder.dart (revision 17215)
+++ sdk/lib/_internal/compiler/implementation/ssa/builder.dart (working copy)
@@ -1165,9 +1165,6 @@
element = element.implementation;
// TODO(floitsch): we should be able to inline inside lazy initializers.
if (!currentElement.isFunction()) return false;
- // TODO(floitsch): we should be able to inline getters, setters and
- // constructor bodies.
- if (!element.isFunction()) return false;
// TODO(floitsch): find a cleaner way to know if the element is a function
// containing nodes.
// [PartialFunctionElement]s are [FunctionElement]s that have [Node]s.
@@ -1180,9 +1177,6 @@
for (int i = 0; i < inliningStack.length; i++) {
if (inliningStack[i].function == element) return false;
}
- // TODO(ngeoffray): Inlining currently does not work in the presence of
- // private calls.
- if (currentLibrary != element.getLibrary()) return false;
PartialFunctionElement function = element;
int sourceSize =
function.endToken.charOffset - function.beginToken.charOffset;
@@ -2475,6 +2469,12 @@
} else if (element.isField() && isLazilyInitialized(element)) {
push(new HLazyStatic(element));
} else {
+ if (element.isGetter()) {
+ Selector selector = elements.getSelector(send);
+ if (tryInlineMethod(element, selector, const Link<Node>())) {
+ return;
+ }
+ }
// TODO(5346): Try to avoid the need for calling [declaration] before
// creating an [HStatic].
push(new HStatic(element.declaration));

Powered by Google App Engine
This is Rietveld 408576698