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

Issue 2325943002: [turbofan] Initial support for polymorphic inlining. (Closed)

Created:
4 years, 3 months ago by Benedikt Meurer
Modified:
4 years, 3 months ago
Reviewers:
mvstanton, brucedawson
CC:
v8-reviews_googlegroups.com
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

[turbofan] Initial support for polymorphic inlining. For call sites where the target is not a known constant, but potentially a list of known constants (i.e. a Phi with all HeapConstant inputs), we still record the call site as a potential candidate for inlining. In case the heuristic picks that candidate for inlining, we expand the call site to a dispatched call site and invoke the actual inlining logic for all the nested call sites. Like Crankshaft, we currently allow up to 4 targets for polymorphic inlining, although we might want to refine that later. This approach is different from what Crankshaft does in that we don't duplicate the evaluation of the parameters per polymorphic case. Instead we first perform the load of the target (which usually dispatches based on the receiver map), then we evaluate all the parameters, and then we dispatch again based on the known targets. This might generate better or worse code compared to what Crankshaft does, and for the cases where we generate worse code (i.e. because we have only trivial parameters or no parameters at all), we might want to investigate optimizing away the double dispatch in the future. R=mvstanton@chromium.org BUG=v8:5267, v8:5365 Committed: https://crrev.com/7d4ab7d43e335f36b0f91eb36e231dc7bea048ea Cr-Commit-Position: refs/heads/master@{#39302}

Patch Set 1 #

Total comments: 4

Patch Set 2 : Addressed feedback. #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+236 lines, -62 lines) Patch
M src/compilation-info.cc View 1 chunk +0 lines, -1 line 0 comments Download
M src/compiler/js-inlining-heuristic.h View 3 chunks +16 lines, -5 lines 0 comments Download
M src/compiler/js-inlining-heuristic.cc View 1 4 chunks +217 lines, -56 lines 1 comment Download
M src/compiler/pipeline.cc View 1 chunk +3 lines, -0 lines 0 comments Download

Messages

Total messages: 19 (12 generated)
Benedikt Meurer
Hey Michael, Here's the polymorphic inlining. Please take a look. greets, Benedikt
4 years, 3 months ago (2016-09-09 07:02:10 UTC) #7
mvstanton
LGTM with nits. https://codereview.chromium.org/2325943002/diff/1/src/compiler/js-inlining-heuristic.cc File src/compiler/js-inlining-heuristic.cc (right): https://codereview.chromium.org/2325943002/diff/1/src/compiler/js-inlining-heuristic.cc#newcode212 src/compiler/js-inlining-heuristic.cc:212: if (i != num_calls - 1) ...
4 years, 3 months ago (2016-09-09 07:55:39 UTC) #9
Benedikt Meurer
Addressed comments, thanks. https://codereview.chromium.org/2325943002/diff/1/src/compiler/js-inlining-heuristic.cc File src/compiler/js-inlining-heuristic.cc (right): https://codereview.chromium.org/2325943002/diff/1/src/compiler/js-inlining-heuristic.cc#newcode212 src/compiler/js-inlining-heuristic.cc:212: if (i != num_calls - 1) ...
4 years, 3 months ago (2016-09-09 08:20:52 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2325943002/20001
4 years, 3 months ago (2016-09-09 08:21:17 UTC) #13
commit-bot: I haz the power
Committed patchset #2 (id:20001)
4 years, 3 months ago (2016-09-09 08:44:09 UTC) #15
commit-bot: I haz the power
Patchset 2 (id:??) landed as https://crrev.com/7d4ab7d43e335f36b0f91eb36e231dc7bea048ea Cr-Commit-Position: refs/heads/master@{#39302}
4 years, 3 months ago (2016-09-09 08:44:30 UTC) #17
brucedawson
4 years, 3 months ago (2016-09-12 18:08:00 UTC) #19
Message was sent while issue was closed.
https://codereview.chromium.org/2325943002/diff/20001/src/compiler/js-inlinin...
File src/compiler/js-inlining-heuristic.cc (right):

https://codereview.chromium.org/2325943002/diff/20001/src/compiler/js-inlinin...
src/compiler/js-inlining-heuristic.cc:247:
graph()->NewNode(common()->Merge(num_calls), num_calls, if_exceptions);
Probably not a bug, but this declaration of 'control' is confusing because there
is an identically named variable in the outer scope which is used before and
after this scope. Consider renaming?

The full set of new variable shadowing warnings from the experimental VC++
/analyze (static code analysis) run for this file is:

v8\src\compiler\js-inlining-heuristic.cc(246) : warning C6246: Local declaration
of 'control' hides declaration of the same name in outer scope. For additional
information, see previous declaration at line '200' of
'c:\src\analyze_chromium\src\v8\src\compiler\js-inlining-heuristic.cc'.
v8\src\compiler\js-inlining-heuristic.cc(271) : warning C6246: Local declaration
of 'node' hides declaration of the same name in outer scope. For additional
information, see previous declaration at line '184' of
'c:\src\analyze_chromium\src\v8\src\compiler\js-inlining-heuristic.cc'.
v8\src\compiler\js-inlining-heuristic.cc(36) : warning C6246: Local declaration
of 'm' hides declaration of the same name in outer scope. For additional
information, see previous declaration at line '27' of
'c:\src\analyze_chromium\src\v8\src\compiler\js-inlining-heuristic.cc'.

Fixing is not required - do what makes sense.

Powered by Google App Engine
This is Rietveld 408576698