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

Issue 285543002: Recognize List constructor and turn it into CreateArray ... (Closed)

Created:
6 years, 7 months ago by srdjan
Modified:
6 years, 7 months ago
CC:
reviews_dartlang.org, vm-dev_dartlang.org, Vyacheslav Egorov (Google)
Visibility:
Public.

Description

Recognize List. constructor and turn it inot CreateArray. R=johnmccutchan@google.com, zra@google.com Committed: https://code.google.com/p/dart/source/detail?r=36138

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Patch Set 5 : #

Patch Set 6 : #

Patch Set 7 : #

Total comments: 7

Patch Set 8 : #

Patch Set 9 : #

Patch Set 10 : #

Patch Set 11 : #

Patch Set 12 : #

Patch Set 13 : #

Patch Set 14 : #

Patch Set 15 : #

Patch Set 16 : #

Patch Set 17 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+103 lines, -22 lines) Patch
M runtime/vm/code_generator.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +16 lines, -2 lines 0 comments Download
M runtime/vm/flow_graph_optimizer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 3 chunks +8 lines, -3 lines 0 comments Download
M runtime/vm/intermediate_language.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +6 lines, -3 lines 0 comments Download
M runtime/vm/intermediate_language.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +15 lines, -4 lines 0 comments Download
M runtime/vm/stub_code_arm.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +11 lines, -1 line 0 comments Download
M runtime/vm/stub_code_arm64.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +7 lines, -1 line 0 comments Download
M runtime/vm/stub_code_ia32.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +13 lines, -1 line 0 comments Download
M runtime/vm/stub_code_mips.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +9 lines, -1 line 0 comments Download
M runtime/vm/stub_code_x64.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +11 lines, -1 line 0 comments Download
M runtime/vm/symbols.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +4 lines, -1 line 0 comments Download
M runtime/vm/symbols.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +3 lines, -4 lines 0 comments Download

Messages

Total messages: 11 (0 generated)
srdjan
6 years, 7 months ago (2014-05-12 19:46:53 UTC) #1
Cutch
lgtm
6 years, 7 months ago (2014-05-12 19:50:02 UTC) #2
Vyacheslav Egorov (Google)
Constants can start flowing into the constructor after other phases as well, e.g. store to ...
6 years, 7 months ago (2014-05-13 08:10:38 UTC) #3
Florian Schneider
I also think that we don't need a separate pass for this. https://codereview.chromium.org/285543002/diff/100001/runtime/vm/flow_graph_optimizer.cc File runtime/vm/flow_graph_optimizer.cc ...
6 years, 7 months ago (2014-05-13 11:17:31 UTC) #4
srdjan
Thanks for feedback. Adapted CreateArrayInstr to accept any input. https://codereview.chromium.org/285543002/diff/100001/runtime/vm/flow_graph_optimizer.cc File runtime/vm/flow_graph_optimizer.cc (right): https://codereview.chromium.org/285543002/diff/100001/runtime/vm/flow_graph_optimizer.cc#newcode4253 runtime/vm/flow_graph_optimizer.cc:4253: ...
6 years, 7 months ago (2014-05-13 18:07:18 UTC) #5
Cutch
lgtm
6 years, 7 months ago (2014-05-13 18:20:03 UTC) #6
srdjan
https://codereview.chromium.org/285543002/diff/100001/runtime/vm/flow_graph_optimizer.cc File runtime/vm/flow_graph_optimizer.cc (right): https://codereview.chromium.org/285543002/diff/100001/runtime/vm/flow_graph_optimizer.cc#newcode4256 runtime/vm/flow_graph_optimizer.cc:4256: CreateArrayInstr* create_array = On 2014/05/13 18:07:18, srdjan wrote: > ...
6 years, 7 months ago (2014-05-13 18:24:43 UTC) #7
zra
arm/mips changes lgtm
6 years, 7 months ago (2014-05-13 21:45:53 UTC) #8
srdjan
Committed patchset #17 manually as r36138 (presubmit successful).
6 years, 7 months ago (2014-05-13 23:09:29 UTC) #9
Florian Schneider
https://codereview.chromium.org/285543002/diff/100001/runtime/vm/flow_graph_optimizer.cc File runtime/vm/flow_graph_optimizer.cc (right): https://codereview.chromium.org/285543002/diff/100001/runtime/vm/flow_graph_optimizer.cc#newcode4253 runtime/vm/flow_graph_optimizer.cc:4253: num_elements->BoundConstant().IsSmi()) { On 2014/05/13 18:07:18, srdjan wrote: > On ...
6 years, 7 months ago (2014-05-14 08:23:27 UTC) #10
srdjan
6 years, 7 months ago (2014-05-14 15:21:01 UTC) #11
Message was sent while issue was closed.
https://codereview.chromium.org/285543002/diff/100001/runtime/vm/flow_graph_o...
File runtime/vm/flow_graph_optimizer.cc (right):

https://codereview.chromium.org/285543002/diff/100001/runtime/vm/flow_graph_o...
runtime/vm/flow_graph_optimizer.cc:4253: num_elements->BoundConstant().IsSmi())
{
On 2014/05/14 08:23:28, Florian Schneider wrote:
> On 2014/05/13 18:07:18, srdjan wrote:
> > On 2014/05/13 11:17:32, Florian Schneider wrote:
> > > Why does num_elements need to be constant? CreateArrayInstr takes an
> arbitrary
> > > length operand as input.
> > 
> > CreateArrayInstr expects a positive integer. Added code to handle
exceptions.
> 
> Sorry to be not precise enough: I meant checking for the correct length here:
> You can use CheckArrayBoundInstr for that. It will deoptmize in case of a
> negative length.
> 
> Inserting the check in the allocation stub is not ideal: it can't be
eliminated
> there in case we actually have a constant, so it will always cost extra.
> 

This code is just the first step for optimized allocation in case of constants:
inline allocation code skipping all kind of checks and object tag computations.
This especially visible in case of frequent growable array allocations
(allocates List(4)). Experimental code showed 4% improvement on Havlak.

Powered by Google App Engine
This is Rietveld 408576698