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

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

Issue 1570353002: dart2js cps: Do not count refinement nodes when measuring size. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4
5 library cps_ir.optimization.inline; 5 library cps_ir.optimization.inline;
6 6
7 import 'cps_fragment.dart'; 7 import 'cps_fragment.dart';
8 import 'cps_ir_builder.dart' show ThisParameterLocal; 8 import 'cps_ir_builder.dart' show ThisParameterLocal;
9 import 'cps_ir_nodes.dart'; 9 import 'cps_ir_nodes.dart';
10 import 'optimizers.dart'; 10 import 'optimizers.dart';
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 visitor.countArgument(invoke.receiver, function.thisParameter); 213 visitor.countArgument(invoke.receiver, function.thisParameter);
214 for (int i = 0; i < invoke.arguments.length; ++i) { 214 for (int i = 0; i < invoke.arguments.length; ++i) {
215 visitor.countArgument(invoke.arguments[i], function.parameters[i]); 215 visitor.countArgument(invoke.arguments[i], function.parameters[i]);
216 } 216 }
217 return visitor.size; 217 return visitor.size;
218 } 218 }
219 219
220 // Inlining a function incurs a cost equal to the number of primitives and 220 // Inlining a function incurs a cost equal to the number of primitives and
221 // non-jump tail expressions. 221 // non-jump tail expressions.
222 // TODO(kmillikin): Tune the size computation and size bound. 222 // TODO(kmillikin): Tune the size computation and size bound.
223 processLetPrim(LetPrim node) => ++size; 223 processLetPrim(LetPrim node) {
224 if (node.primitive is! Refinement) {
225 ++size;
226 }
227 }
224 processLetMutable(LetMutable node) => ++size; 228 processLetMutable(LetMutable node) => ++size;
225 processBranch(Branch node) => ++size; 229 processBranch(Branch node) => ++size;
226 processThrow(Throw nose) => ++size; 230 processThrow(Throw nose) => ++size;
227 processRethrow(Rethrow node) => ++size; 231 processRethrow(Rethrow node) => ++size;
228 } 232 }
229 233
230 class InliningVisitor extends TrampolineRecursiveVisitor { 234 class InliningVisitor extends TrampolineRecursiveVisitor {
231 final Inliner _inliner; 235 final Inliner _inliner;
232 236
233 // A successful inlining attempt returns the [Primitive] that represents the 237 // A successful inlining attempt returns the [Primitive] that represents the
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 // We cannot inline a constructor invocation containing type arguments 527 // We cannot inline a constructor invocation containing type arguments
524 // because CreateInstance in the body does not know the type arguments. 528 // because CreateInstance in the body does not know the type arguments.
525 // We would incorrectly instantiate a class like A instead of A<B>. 529 // We would incorrectly instantiate a class like A instead of A<B>.
526 // TODO(kmillikin): try to fix this. 530 // TODO(kmillikin): try to fix this.
527 GenericType generic = node.dartType; 531 GenericType generic = node.dartType;
528 if (generic.typeArguments.any((DartType t) => !t.isDynamic)) return null; 532 if (generic.typeArguments.any((DartType t) => !t.isDynamic)) return null;
529 } 533 }
530 return tryInlining(node, node.target, null); 534 return tryInlining(node, node.target, null);
531 } 535 }
532 } 536 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698