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

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

Issue 1681953002: dart2js cps: Do not count no-check bounds checks in size visitor. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 visitor.countArgument(invoke.receiver, function.thisParameter); 239 visitor.countArgument(invoke.receiver, function.thisParameter);
240 for (int i = 0; i < invoke.arguments.length; ++i) { 240 for (int i = 0; i < invoke.arguments.length; ++i) {
241 visitor.countArgument(invoke.arguments[i], function.parameters[i]); 241 visitor.countArgument(invoke.arguments[i], function.parameters[i]);
242 } 242 }
243 return visitor.size; 243 return visitor.size;
244 } 244 }
245 245
246 // Inlining a function incurs a cost equal to the number of primitives and 246 // Inlining a function incurs a cost equal to the number of primitives and
247 // non-jump tail expressions. 247 // non-jump tail expressions.
248 // TODO(kmillikin): Tune the size computation and size bound. 248 // TODO(kmillikin): Tune the size computation and size bound.
249 processLetPrim(LetPrim node) { 249 processLetPrim(LetPrim node) => ++size;
250 if (node.primitive is! Refinement) {
251 ++size;
252 }
253 }
254 processLetMutable(LetMutable node) => ++size; 250 processLetMutable(LetMutable node) => ++size;
255 processBranch(Branch node) => ++size; 251 processBranch(Branch node) => ++size;
256 processThrow(Throw nose) => ++size; 252 processThrow(Throw nose) => ++size;
257 processRethrow(Rethrow node) => ++size; 253 processRethrow(Rethrow node) => ++size;
254
255 // Discount primitives that do not generate code.
256 processRefinement(Refinement node) => --size;
257 processBoundsCheck(BoundsCheck node) {
258 if (node.hasNoChecks) {
259 --size;
260 }
261 }
258 } 262 }
259 263
260 class InliningVisitor extends TrampolineRecursiveVisitor { 264 class InliningVisitor extends TrampolineRecursiveVisitor {
261 final Inliner _inliner; 265 final Inliner _inliner;
262 266
263 // A successful inlining attempt returns the [Primitive] that represents the 267 // A successful inlining attempt returns the [Primitive] that represents the
264 // result of the inlined call or null. If the result is non-null, the body 268 // result of the inlined call or null. If the result is non-null, the body
265 // of the inlined function is available in this field. 269 // of the inlined function is available in this field.
266 CpsFragment _fragment; 270 CpsFragment _fragment;
267 271
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 if (target.isOperator && 592 if (target.isOperator &&
589 (enclosingClass == backend.helpers.jsNumberClass || 593 (enclosingClass == backend.helpers.jsNumberClass ||
590 enclosingClass == backend.helpers.jsDoubleClass || 594 enclosingClass == backend.helpers.jsDoubleClass ||
591 enclosingClass == backend.helpers.jsIntClass)) { 595 enclosingClass == backend.helpers.jsIntClass)) {
592 // These should be handled by operator specialization. 596 // These should be handled by operator specialization.
593 return true; 597 return true;
594 } 598 }
595 return false; 599 return false;
596 } 600 }
597 } 601 }
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