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

Unified Diff: pkg/compiler/lib/src/ssa/codegen.dart

Issue 2430683003: Property extraction getters (tear-offs) are effect-free (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/nodes.dart » ('j') | pkg/compiler/lib/src/ssa/nodes.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ssa/codegen.dart
diff --git a/pkg/compiler/lib/src/ssa/codegen.dart b/pkg/compiler/lib/src/ssa/codegen.dart
index 697f99e315588dd1eb418b5998e01cf7e73fb934..a50cffe917f140279e31034cff91773381a878e2 100644
--- a/pkg/compiler/lib/src/ssa/codegen.dart
+++ b/pkg/compiler/lib/src/ssa/codegen.dart
@@ -1718,11 +1718,13 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
}
void registerGetter(HInvokeDynamic node) {
- if (node.element != null) {
- // This is a dynamic read which we have found to have a single
- // target but for some reason haven't inlined. We are _still_ accessing
- // the target dynamically but we don't need to enqueue more than target
- // for this to work.
+ if (node.element != null &&
+ (node.element.isGetter || node.element.isField)) {
+ // This is a dynamic read which we have found to have a single target but
+ // for some reason haven't inlined. We are _still_ accessing the target
+ // dynamically but we don't need to enqueue more than target for this to
+ // work. The test above excludes non-getter functions since the element
+ // represents two targets - a tearoff getter and the torn-off method.
sra1 2016/10/18 23:18:22 johnni: is this the right way to handle this?
Johnni Winther 2016/10/19 12:04:50 Yes.
registry.registerStaticUse(new StaticUse.directGet(node.element));
} else {
Selector selector = node.selector;
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/nodes.dart » ('j') | pkg/compiler/lib/src/ssa/nodes.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698