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

Issue 16128004: Reorder switch clauses using newly-introduced execution counters in (Closed)

Created:
7 years, 6 months ago by indutny
Modified:
7 years, 6 months ago
Reviewers:
Sven Panne, danno
CC:
v8-dev
Base URL:
gh:v8/v8.git@master
Visibility:
Public.

Description

Reorder switch clauses using newly-introduced execution counters in unoptimized clause bodies. R=danno@chromium.org BUG=

Patch Set 1 #

Patch Set 2 : handle counter overflow, do not reorder if counters are equal #

Patch Set 3 : DeoptCounter #

Patch Set 4 : fix #

Patch Set 5 : simplify logic #

Patch Set 6 : comments #

Patch Set 7 : unbreak x64 #

Total comments: 7

Patch Set 8 : less gvn changes #

Total comments: 2

Patch Set 9 : do not let GC trash my cells #

Patch Set 10 : tweak heuristic #

Unified diffs Side-by-side diffs Delta from patch set Stats (+819 lines, -12 lines) Patch
M src/arm/full-codegen-arm.cc View 1 2 3 4 1 chunk +24 lines, -1 line 0 comments Download
M src/arm/lithium-arm.h View 1 2 3 4 5 2 chunks +47 lines, -0 lines 0 comments Download
M src/arm/lithium-arm.cc View 1 2 3 4 1 chunk +17 lines, -0 lines 0 comments Download
M src/arm/lithium-codegen-arm.h View 1 2 3 chunks +3 lines, -0 lines 0 comments Download
M src/arm/lithium-codegen-arm.cc View 1 2 3 4 2 chunks +49 lines, -0 lines 0 comments Download
M src/ast.h View 3 4 3 chunks +4 lines, -0 lines 0 comments Download
M src/ast.cc View 3 4 2 chunks +4 lines, -0 lines 0 comments Download
M src/hydrogen.h View 1 2 3 4 3 chunks +18 lines, -0 lines 0 comments Download
M src/hydrogen.cc View 1 2 3 4 5 6 7 8 9 7 chunks +85 lines, -3 lines 0 comments Download
M src/hydrogen-gvn.cc View 1 2 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M src/hydrogen-instructions.h View 1 2 3 4 5 2 chunks +61 lines, -0 lines 0 comments Download
M src/hydrogen-instructions.cc View 1 2 1 chunk +10 lines, -0 lines 0 comments Download
M src/ia32/full-codegen-ia32.cc View 1 2 3 4 1 chunk +25 lines, -1 line 0 comments Download
M src/ia32/lithium-codegen-ia32.h View 1 2 3 chunks +3 lines, -0 lines 0 comments Download
M src/ia32/lithium-codegen-ia32.cc View 1 2 3 4 2 chunks +47 lines, -0 lines 0 comments Download
M src/ia32/lithium-ia32.h View 1 2 3 4 2 chunks +47 lines, -0 lines 0 comments Download
M src/ia32/lithium-ia32.cc View 1 2 3 4 1 chunk +17 lines, -0 lines 0 comments Download
M src/lithium.h View 1 2 3 4 1 chunk +18 lines, -0 lines 0 comments Download
M src/lithium.cc View 1 2 1 chunk +15 lines, -0 lines 0 comments Download
M src/mips/full-codegen-mips.cc View 1 2 1 chunk +26 lines, -1 line 0 comments Download
M src/mips/lithium-codegen-mips.h View 1 2 3 chunks +3 lines, -0 lines 0 comments Download
M src/mips/lithium-codegen-mips.cc View 1 2 3 4 2 chunks +51 lines, -0 lines 0 comments Download
M src/mips/lithium-mips.h View 1 2 3 4 5 2 chunks +47 lines, -0 lines 0 comments Download
M src/mips/lithium-mips.cc View 1 2 3 4 1 chunk +17 lines, -0 lines 0 comments Download
M src/objects.h View 1 2 2 chunks +6 lines, -1 line 0 comments Download
M src/objects.cc View 1 2 3 4 5 6 7 8 1 chunk +3 lines, -1 line 0 comments Download
M src/objects-inl.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M src/type-info.h View 2 chunks +2 lines, -0 lines 0 comments Download
M src/type-info.cc View 1 2 3 4 5 6 7 8 2 chunks +27 lines, -1 line 0 comments Download
M src/typing.cc View 1 chunk +2 lines, -1 line 0 comments Download
M src/x64/full-codegen-x64.cc View 1 2 3 4 5 6 1 chunk +25 lines, -1 line 0 comments Download
M src/x64/lithium-codegen-x64.h View 1 2 3 chunks +3 lines, -0 lines 0 comments Download
M src/x64/lithium-codegen-x64.cc View 1 2 3 4 2 chunks +47 lines, -0 lines 0 comments Download
M src/x64/lithium-x64.h View 1 2 3 4 2 chunks +47 lines, -0 lines 0 comments Download
M src/x64/lithium-x64.cc View 1 2 3 4 1 chunk +17 lines, -0 lines 0 comments Download

Messages

Total messages: 14 (0 generated)
indutny
Probable improvements and things to done: * Improve resetting counters by dictionary of references to ...
7 years, 6 months ago (2013-06-02 08:21:15 UTC) #1
indutny
On 2013/06/02 08:21:15, indutny wrote: > Probable improvements and things to done: > > * ...
7 years, 6 months ago (2013-06-02 09:12:48 UTC) #2
indutny
On 2013/06/02 09:12:48, indutny wrote: > On 2013/06/02 08:21:15, indutny wrote: > > Probable improvements ...
7 years, 6 months ago (2013-06-02 09:21:37 UTC) #3
indutny
On 2013/06/02 09:21:37, indutny wrote: > On 2013/06/02 09:12:48, indutny wrote: > > On 2013/06/02 ...
7 years, 6 months ago (2013-06-02 20:57:26 UTC) #4
indutny
On 2013/06/02 20:57:26, indutny wrote: > On 2013/06/02 09:21:37, indutny wrote: > > On 2013/06/02 ...
7 years, 6 months ago (2013-06-03 06:51:49 UTC) #5
Sven Panne
A few drive-by comments: I don't really like this approach, it is a really heavy ...
7 years, 6 months ago (2013-06-03 07:30:44 UTC) #6
indutny
Just FYI to consider, benchmarks seems to be running a little bit faster after applying ...
7 years, 6 months ago (2013-06-03 07:50:53 UTC) #7
Sven Panne
https://codereview.chromium.org/16128004/diff/15001/src/objects.h File src/objects.h (right): https://codereview.chromium.org/16128004/diff/15001/src/objects.h#newcode4496 src/objects.h:4496: DECL_ACCESSORS(deopt_counter_cells, FixedArray) On 2013/06/03 07:50:53, indutny wrote: > On ...
7 years, 6 months ago (2013-06-03 09:22:02 UTC) #8
Jakob Kummerow
More DBC: I think it's fundamentally wrong to trigger soft deopts based on hit counts ...
7 years, 6 months ago (2013-06-03 10:04:15 UTC) #9
danno
Now the non-DBC :-) I don't think using deoptimization and type feedback is the right ...
7 years, 6 months ago (2013-06-03 10:47:59 UTC) #10
indutny
Thank you for reviewing, sad that it won't get in, but that's ok. I'll look ...
7 years, 6 months ago (2013-06-03 10:56:11 UTC) #11
indutny
On 2013/06/03 10:56:11, indutny wrote: > Thank you for reviewing, sad that it won't get ...
7 years, 6 months ago (2013-06-03 19:37:18 UTC) #12
indutny
On 2013/06/03 19:37:18, indutny wrote: > On 2013/06/03 10:56:11, indutny wrote: > > Thank you ...
7 years, 6 months ago (2013-06-03 20:04:04 UTC) #13
indutny
7 years, 6 months ago (2013-06-03 21:13:50 UTC) #14
On 2013/06/03 20:04:04, indutny wrote:
> On 2013/06/03 19:37:18, indutny wrote:
> > On 2013/06/03 10:56:11, indutny wrote:
> > > Thank you for reviewing, sad that it won't get in, but that's ok. I'll
look
> > into
> > > proposed optimization techniques and will share results with you (if I'll
> have
> > > any).
> > > 
> > >
> >
>
https://codereview.chromium.org/16128004/diff/22001/src/hydrogen-instructions.h
> > > File src/hydrogen-instructions.h (right):
> > > 
> > >
> >
>
https://codereview.chromium.org/16128004/diff/22001/src/hydrogen-instructions...
> > > src/hydrogen-instructions.h:107: V(DeoptCounter)                          
 
> 
> > \
> > > On 2013/06/03 10:48:00, danno wrote:
> > > > In addition to my general feedback to your approach, here's some
feedback
> > > about
> > > > the implementation: We are generally trying to reduce the number of
> hydrogen
> > > > instructions, not increase them. If you want to manipulate data counters
> > form
> > > > Hydrogen code and then trigger a deoptimization, then you should use
> > > > HLoad/HStore/HAdd instructions followed by a "normal" deopt or a call to
a
> > > > runtime function that does the necessary bookkeeping and then does a
lazy
> > > > deopt... both approaches don't require any new platform-specific code. 
> > > 
> > > Hm... you're right, but even this case I would need to patch lithium to
> store
> > > this cells in Code object.
> > 
> > Just pushed small update to code that I'd like you to consider merging
> > regardless of this CL approval (let me know if I need to open separate CL
for
> > it):
https://codereview.chromium.org/16128004/diff2/22001:26001/src/objects.cc
> > 
> > Basically, right now all code type feedback cells are reset on GC to fight
> > useless heap references and memory leaks (right?), and doing so with smis
> isn't
> > really important and breaks my code :)
> 
> And another note, octane benchmark results over 10 runs seems to be mostly
equal
> for this CL and bleeding edge. So, while not introducing any performance
> improvement in benchmark, it, at least, doesn't make things worse.

Attaching here the code that I'm aiming to optimize
https://gist.github.com/indutny/6073202c100f4df2599a , after applying this patch
it's performance improves by 10%. And the difference could be bigger if it'll
spend less time concatenating strings and doing other stuff.

Powered by Google App Engine
This is Rietveld 408576698