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

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

Issue 14783015: Fix performance regression after adding inlining support for operators, [], and []=. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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 22723)
+++ sdk/lib/_internal/compiler/implementation/ssa/builder.dart (working copy)
@@ -3652,12 +3652,20 @@
}
}
- bool isThisSend(Send send) {
- if (send.isPrefix || send.isPostfix) return false;
- Node receiver = send.receiver;
- if (receiver == null) return true;
- Identifier identifier = receiver.asIdentifier();
- return identifier != null && identifier.isThis();
+ bool isOptimizableOperation(Send node, Selector selector, Element element) {
+ ClassElement cls = element.getEnclosingClass();
+ if (isOptimizableOperationOnIndexable(selector, element)) return true;
+ if (!backend.interceptedClasses.contains(cls)) return false;
+ if (selector.isOperator()) return true;
+ if (selector.isSetter()) return true;
+ if (selector.isIndex()) return true;
+ if (selector.isIndexSet()) return true;
+ if (element == backend.jsArrayAdd
+ || element == backend.jsArrayRemoveLast
+ || element == backend.jsStringSplit) {
+ return true;
+ }
+ return false;
}
Element element = compiler.world.locateSingleElement(selector);
@@ -3666,14 +3674,7 @@
&& (node.asSend() != null)
&& !(element.isGetter() && selector.isCall())
&& !(element.isFunction() && selector.isGetter())
- // This check is to ensure we don't regress compared to our
- // previous limited inlining. We currently don't want to
- // inline methods on intercepted classes because the
- // optimizers apply their own optimizations on these methods.
- && (!backend.interceptedClasses.contains(element.getEnclosingClass())
- || isThisSend(node))
- // Avoid inlining optimizable operations on indexables.
- && !isOptimizableOperationOnIndexable(selector, element)) {
+ && !isOptimizableOperation(node, selector, element)) {
Send send = node.asSend();
Link<Node> nodes = send.isPropertyAccess ? null : send.arguments;
if (tryInlineMethod(element, selector, nodes, arguments, node)) {
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/bailout.dart ('k') | sdk/lib/_internal/compiler/implementation/ssa/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698