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

Issue 2558633007: Improve inlining heuristics. (Closed)

Created:
4 years ago by floitsch
Modified:
3 years, 9 months ago
CC:
reviews_dartlang.org
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Improve inlining heuristics.

Patch Set 1 #

Total comments: 11
Unified diffs Side-by-side diffs Delta from patch set Stats (+42 lines, -7 lines) Patch
M pkg/compiler/lib/src/ssa/builder.dart View 7 chunks +42 lines, -7 lines 11 comments Download

Messages

Total messages: 9 (1 generated)
Siggi Cherem (dart-lang)
+sra cool Florian. I really like the simplicity of this. I'll test this out on ...
4 years ago (2016-12-21 00:55:19 UTC) #2
floitsch
https://codereview.chromium.org/2558633007/diff/1/pkg/compiler/lib/src/ssa/builder.dart File pkg/compiler/lib/src/ssa/builder.dart (right): https://codereview.chromium.org/2558633007/diff/1/pkg/compiler/lib/src/ssa/builder.dart#newcode6692 pkg/compiler/lib/src/ssa/builder.dart:6692: /* Enabling this, slightly increases the output size. I ...
4 years ago (2016-12-21 10:36:24 UTC) #3
sra1
I'm a little wary about changing the inlining heuristics. If there is a specific library ...
3 years, 11 months ago (2017-01-04 00:29:00 UTC) #4
floitsch
On 2017/01/04 00:29:00, sra1 wrote: > I'm a little wary about changing the inlining heuristics. ...
3 years, 11 months ago (2017-01-04 12:26:46 UTC) #5
sra1
I can't patch, so can you rebase? https://codereview.chromium.org/2558633007/diff/1/pkg/compiler/lib/src/ssa/builder.dart File pkg/compiler/lib/src/ssa/builder.dart (right): https://codereview.chromium.org/2558633007/diff/1/pkg/compiler/lib/src/ssa/builder.dart#newcode6696 pkg/compiler/lib/src/ssa/builder.dart:6696: // argument ...
3 years, 9 months ago (2017-02-28 19:36:15 UTC) #6
sra1
I get this on a certain large app: The compiler crashed: Unsupported operation: ResolvedAstKind.DEFAULT_CONSTRUCTOR:generative_constructor(BrowserDomAdapter#) does ...
3 years, 9 months ago (2017-02-28 20:31:20 UTC) #7
sra1
https://codereview.chromium.org/2558633007/diff/1/pkg/compiler/lib/src/ssa/builder.dart File pkg/compiler/lib/src/ssa/builder.dart (right): https://codereview.chromium.org/2558633007/diff/1/pkg/compiler/lib/src/ssa/builder.dart#newcode6631 pkg/compiler/lib/src/ssa/builder.dart:6631: if (resolvedAst.elements.containsTryStatement) return false; elements does not need to ...
3 years, 9 months ago (2017-02-28 22:48:28 UTC) #8
floitsch
3 years, 9 months ago (2017-03-01 08:50:45 UTC) #9
Thanks.
Stephen took over this CL here: https://codereview.chromium.org/2724473004/

https://codereview.chromium.org/2558633007/diff/1/pkg/compiler/lib/src/ssa/bu...
File pkg/compiler/lib/src/ssa/builder.dart (right):

https://codereview.chromium.org/2558633007/diff/1/pkg/compiler/lib/src/ssa/bu...
pkg/compiler/lib/src/ssa/builder.dart:6631: if
(resolvedAst.elements.containsTryStatement) return false;
On 2017/02/28 22:48:28, sra1 wrote:
> elements does not need to be passed in, since it it resolvedAst.elements

even better.

https://codereview.chromium.org/2558633007/diff/1/pkg/compiler/lib/src/ssa/bu...
pkg/compiler/lib/src/ssa/builder.dart:6696: // argument would cost us as much
space as we inline.
On 2017/02/28 19:36:15, sra1 wrote:
> It will cost a temporary if it is used twice.
> Can we count uses?

That's true, unless the parameter is a constant or already in a temporary.
I do agree that we shouldn't just ignore sends to arguments, *but* they should
be counted less than other variables. Lots of chances of optimizations when one
can inline declarations to their uses.

https://codereview.chromium.org/2558633007/diff/1/pkg/compiler/lib/src/ssa/bu...
pkg/compiler/lib/src/ssa/builder.dart:6719: int oldCount = nodeCount;
On 2017/02/28 19:36:15, sra1 wrote:
> I think this code would be easier to understand if this was called
> commonPrefixCount, and the then/else were explicitly computed.

Acknowledged.

https://codereview.chromium.org/2558633007/diff/1/pkg/compiler/lib/src/ssa/bu...
pkg/compiler/lib/src/ssa/builder.dart:6722: int thenCount = nodeCount;
On 2017/02/28 19:36:15, sra1 wrote:
> int thenCount = nodeCount - commonPrefixCount
> ...
> int elseCount = nodeCount - commonPrefixCount
> 
> 
> nodeCount = commonPrefixCount + max(thenCount, elseCount);
> ...
> nodeCount = commonPrefixCount + thenCount + elseCount;

Acknowledged.

https://codereview.chromium.org/2558633007/diff/1/pkg/compiler/lib/src/ssa/bu...
pkg/compiler/lib/src/ssa/builder.dart:6726: if (node.condition.asSend() != null
&&
On 2017/02/28 19:36:15, sra1 wrote:
> Add a comment that this is a heuristic - a parameter directly used in a
> conditional is likely to be a constant, so count only the biggest arm.

Acknowledged.

Powered by Google App Engine
This is Rietveld 408576698