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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/scalar_replacement.dart

Issue 1584543002: dart2js cps: Support inlining constructors with type arguments. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Update status files and unit tests Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library dart2js.cps_ir.scalar_replacement; 4 library dart2js.cps_ir.scalar_replacement;
5 5
6 import 'optimizers.dart'; 6 import 'optimizers.dart';
7 7
8 import 'dart:collection' show Queue; 8 import 'dart:collection' show Queue;
9 9
10 import '../common.dart'; 10 import '../common.dart';
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 _current = allocation; 68 _current = allocation;
69 tryScalarReplacement(allocation); 69 tryScalarReplacement(allocation);
70 } 70 }
71 } 71 }
72 72
73 void tryScalarReplacement(Primitive allocation) { 73 void tryScalarReplacement(Primitive allocation) {
74 74
75 // We can do scalar replacement of an aggregate if all uses of an allocation 75 // We can do scalar replacement of an aggregate if all uses of an allocation
76 // are reads or writes. 76 // are reads or writes.
77 for (Reference ref = allocation.firstRef; ref != null; ref = ref.next) { 77 for (Reference ref = allocation.firstRef; ref != null; ref = ref.next) {
78 // TODO(asgerf): Also handle ReadTypeVariable.
78 Node use = ref.parent; 79 Node use = ref.parent;
79 if (use is GetField) continue; 80 if (use is GetField) continue;
80 if (use is SetField && use.object == ref) continue; 81 if (use is SetField && use.object == ref) continue;
81 return; 82 return;
82 } 83 }
83 84
84 Set<FieldElement> reads = new Set<FieldElement>(); 85 Set<FieldElement> reads = new Set<FieldElement>();
85 Set<FieldElement> writes = new Set<FieldElement>(); 86 Set<FieldElement> writes = new Set<FieldElement>();
86 for (Reference ref = allocation.firstRef; ref != null; ref = ref.next) { 87 for (Reference ref = allocation.firstRef; ref != null; ref = ref.next) {
87 Node use = ref.parent; 88 Node use = ref.parent;
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 class ScalarReplacementRemovalVisitor extends TrampolineRecursiveVisitor { 221 class ScalarReplacementRemovalVisitor extends TrampolineRecursiveVisitor {
221 ScalarReplacementVisitor process; 222 ScalarReplacementVisitor process;
222 223
223 ScalarReplacementRemovalVisitor(this.process); 224 ScalarReplacementRemovalVisitor(this.process);
224 225
225 processReference(Reference reference) { 226 processReference(Reference reference) {
226 process.reconsider(reference.definition); 227 process.reconsider(reference.definition);
227 reference.unlink(); 228 reference.unlink();
228 } 229 }
229 } 230 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/inline.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698