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

Issue 11365174: A change in the way we place TransitionElementKinds in the tree. (Closed)

Created:
8 years, 1 month ago by mvstanton
Modified:
7 years, 6 months ago
CC:
v8-dev
Visibility:
Public.

Description

A change in the way we place TransitionElementKinds in the tree. I attempt to place them as close to object definition as possible, in the hopes of getting them out of loops. There is currently a weakness that the deferment isn't strongly tied to the creation of a DeferredTransition structure. There are currently some failing tests because of this. BUG=

Patch Set 1 #

Total comments: 92

Patch Set 2 : refactoring and bug fixes #

Patch Set 3 : Response to comments, much renaming. #

Patch Set 4 : Rebase, now "code complete" with chaining. #

Patch Set 5 : Finally addressed all comments from first review. #

Total comments: 13

Patch Set 6 : Change to fixed-point iteration algorithm. #

Patch Set 7 : Removed a massive commented out section #

Patch Set 8 : Now have instruction writing, map check updating. #

Total comments: 30

Patch Set 9 : Visited set needs to consider edges, not vertexes on down propagation through the network. #

Total comments: 10

Patch Set 10 : Code cleanup, and rebase for Massi #

Patch Set 11 : Partial review work, and an important update for Massi #

Patch Set 12 : Fixed bug for LoadKeyed instructions that are SITES and ROOTS #

Patch Set 13 : Fix to ignore roots in OSR blocks #

Patch Set 14 : Deal with OSR blocks by modifying placement of transition instructions #

Patch Set 15 : Response to code-comments, additional fixes and cleanup. #

Patch Set 16 : Addressed 99% of comments. #

Patch Set 17 : Now backpatching fast literal array locations to transition once. #

Patch Set 18 : Map pointers replaced with handles whereever possible #

Patch Set 19 : Rebased to include Massi's BoundsCheckElimination #

Patch Set 20 : Now includes optimization of codegen for transition elementskind instruction #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1916 lines, -476 lines) Patch
M src/arm/lithium-codegen-arm.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +37 lines, -20 lines 0 comments Download
M src/ast.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +4 lines, -0 lines 0 comments Download
M src/elements-kind.h View 1 2 1 chunk +6 lines, -0 lines 0 comments Download
M src/elements-kind.cc View 1 2 1 chunk +19 lines, -0 lines 0 comments Download
M src/flag-definitions.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +6 lines, -0 lines 0 comments Download
M src/hydrogen.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 8 chunks +44 lines, -26 lines 0 comments Download
M src/hydrogen.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 29 chunks +990 lines, -124 lines 0 comments Download
M src/hydrogen-instructions.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 13 chunks +125 lines, -100 lines 0 comments Download
M src/hydrogen-instructions.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 7 chunks +345 lines, -8 lines 0 comments Download
M src/ia32/lithium-codegen-ia32.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 3 chunks +8 lines, -0 lines 0 comments Download
M src/ia32/lithium-codegen-ia32.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 7 chunks +124 lines, -39 lines 0 comments Download
M src/ia32/lithium-ia32.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +22 lines, -16 lines 0 comments Download
M src/objects.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 3 chunks +4 lines, -1 line 0 comments Download
M src/objects.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 3 chunks +6 lines, -7 lines 0 comments Download
M src/runtime.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +5 lines, -0 lines 0 comments Download
M src/runtime.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 9 chunks +22 lines, -9 lines 0 comments Download
M src/small-pointer-list.h View 1 2 3 4 5 6 7 8 1 chunk +10 lines, -0 lines 0 comments Download
M src/v8-counters.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +4 lines, -1 line 0 comments Download
M src/x64/lithium-codegen-x64.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +37 lines, -20 lines 0 comments Download
M test/mjsunit/elements-transition.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +49 lines, -53 lines 0 comments Download
M test/mjsunit/elements-transition-hoisting.js View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
A + test/mjsunit/elements-transition-new.js View 1 2 3 4 5 1 chunk +48 lines, -52 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
mvstanton
Hi guys, This code is not ready for prime time yet, I expect to make ...
8 years, 1 month ago (2012-11-09 16:06:59 UTC) #1
danno
A first round of comments https://codereview.chromium.org/11365174/diff/1/src/compiler.cc File src/compiler.cc (right): https://codereview.chromium.org/11365174/diff/1/src/compiler.cc#newcode354 src/compiler.cc:354: // to test my ...
8 years, 1 month ago (2012-11-14 15:28:18 UTC) #2
mvstanton
Hi Danno, hi Toon and Michael, Okay here is the change. Two pieces missing: 1) ...
8 years, 1 month ago (2012-11-16 15:15:05 UTC) #3
mvstanton
Hi all, This is for Danno, who wanted to see the "fixed point iteration" algorithm ...
8 years ago (2012-11-27 16:17:28 UTC) #4
mvstanton
Restored moving transition instructions, updating map checks with the new fixed point iteration algorithm.
8 years ago (2012-11-28 05:30:15 UTC) #5
danno
Totally going in the right direction. Ignore all my comments except for the ones on ...
8 years ago (2012-11-28 14:42:10 UTC) #6
mvstanton
8 years ago (2012-12-04 11:39:58 UTC) #7
Hi guys,
Remaining work:
1) ResolutionTableValue::to_ Map* could be a handle
2) New unit test needs work
3) I'm not sure how to characterize performance at this point. Now that I've
addressed "low hanging fruit" (deopts) any gains appear to be lost in noise...

https://chromiumcodereview.appspot.com/11365174/diff/16002/src/hydrogen-instr...
File src/hydrogen-instructions.h (right):

https://chromiumcodereview.appspot.com/11365174/diff/16002/src/hydrogen-instr...
src/hydrogen-instructions.h:4356: initialized_ = !defer_initialization;
On 2012/11/28 14:42:10, danno wrote:
> Make this transparent with a single macro in ArrayInterface? e.g like in CL
> 10701054 AstVisitor in ast.h

Done.

https://chromiumcodereview.appspot.com/11365174/diff/16002/src/hydrogen-instr...
src/hydrogen-instructions.h:4412: void
PerformDeferredInitialization(ElementsKind new_elements_kind) {
On 2012/11/28 14:42:10, danno wrote:
> Put this in the .cc

Done.

https://chromiumcodereview.appspot.com/11365174/diff/16002/src/hydrogen-instr...
src/hydrogen-instructions.h:4661: bool defer_initialization = false)
On 2012/11/28 14:42:10, danno wrote:
> can you not have to care whether this is deferred, i.e. always to
initialization
> in a deferred way and visit the "bookmark" sites later?

That didn't work because there are protections around several of the flags that
prevent them being set more than once. I figured I should respect that. Though I
did make things a bit cleaner with HArrayInstruction, I think.

https://chromiumcodereview.appspot.com/11365174/diff/11016/src/hydrogen.cc
File src/hydrogen.cc (right):

https://chromiumcodereview.appspot.com/11365174/diff/11016/src/hydrogen.cc#ne...
src/hydrogen.cc:2457: class MapHandleMap BASE_EMBEDDED {
On 2012/11/28 14:42:10, danno wrote:
> How about this idea. Just have a single table that maps {Map*, ElementsKind}
->
> Handle<Map>. 
> 
> If you want the handle for the map itself, you add
> {map, elements()->kind()} -> the map's handle
> to the table.
> If you want the "transitioned from family", you add 
> {family_map, transitioned_kind} -> the transitioned_kind's handle
> to the table. 
> 
> Probably reduces the code by about half. Then better name might be
> TransitionedMapHandlesMap. 

Done.

https://chromiumcodereview.appspot.com/11365174/diff/11016/src/hydrogen.cc#ne...
src/hydrogen.cc:2487: void Populate(ArrayInstruction* instruction) {
On 2012/11/28 14:42:10, danno wrote:
> I kind of think that the methods to handle ArrayInstructions (this one and
Add)
> should logically live outside this class, since it would be great if the
> MapHandleMap class only needs to know about the implementation of types it
> directly contains.

Done.

https://chromiumcodereview.appspot.com/11365174/diff/11016/src/hydrogen.cc#ne...
src/hydrogen.cc:2530: MapHandleTable::Iterator i =
map_.find(*(handle->location()), true,
On 2012/11/28 14:42:10, danno wrote:
> here and below: doesn't *handle return a Map°, you don't have to do
> *(handle->location().

Done.

https://chromiumcodereview.appspot.com/11365174/diff/11016/src/hydrogen.cc#ne...
src/hydrogen.cc:2580: if (addafter == NULL) {
On 2012/11/28 14:42:10, danno wrote:
> add_after

Done.

https://chromiumcodereview.appspot.com/11365174/diff/11016/src/hydrogen.cc#ne...
src/hydrogen.cc:2611: if (use != HValue::cast(transition)) {
On 2012/11/28 14:42:10, danno wrote:
> Wow. How can this happen? Don't you just visit each use once, and since the
> transition is brand new, when would they ever be equal?

Note that the iterator starts at last_in_chain_->uses(), not
transition_input_->uses(), so indeed, our newly added HTransitionElementsKind is
going to be a usage. Ugh!

https://chromiumcodereview.appspot.com/11365174/diff/11016/src/hydrogen.cc#ne...
src/hydrogen.cc:2626: if (!use->block()->IsStartBlock()) {
On 2012/11/28 14:42:10, danno wrote:
> You mentioned that you copied this magic from somewhere else. Any chance that
> you could pack that in a shared method that gets called from both sites?

Done.

https://chromiumcodereview.appspot.com/11365174/diff/11016/src/hydrogen.cc#ne...
src/hydrogen.cc:2710: Map* unified_map =
to()->LookupElementsTransitionMap(unified_elements_kind);
On 2012/11/28 14:42:10, danno wrote:
> This won't be GC-safe if we're running concurrent compilation. you'll have to
> use the MapHandleMap in some way.

Done.

https://chromiumcodereview.appspot.com/11365174/diff/11016/src/hydrogen.cc#ne...
src/hydrogen.cc:2711: Map* unified_from_value_map =
from_value->to()->LookupElementsTransitionMap(unified_elements_kind);
On 2012/11/28 14:42:10, danno wrote:
> Same here.

Done.

https://chromiumcodereview.appspot.com/11365174/diff/11016/src/hydrogen.cc#ne...
src/hydrogen.cc:2812: void
HoistTransitionsFromArrayInstructionSites(ArrayInstruction* load_or_store,
On 2012/11/28 14:42:10, danno wrote:
> If you make all of these methods inside of a HInsertElementsTransitions
> optimization phase, then you probably can avoid passing MapHandleMap* and
Zone*

I solved it a little differently, moving the method as a member of new class
HTransitionHoister.

https://chromiumcodereview.appspot.com/11365174/diff/11016/src/hydrogen.cc#ne...
src/hydrogen.cc:2824: }
On 2012/11/28 14:42:10, danno wrote:
> if (load_or_store->bookmarks() == 0) return;
> 
> avoid the loop if there are no bookmarks.

Done.

https://chromiumcodereview.appspot.com/11365174/diff/11016/src/hydrogen.cc#ne...
src/hydrogen.cc:2929: // Walk the graph looking for store and load keyed
instructions.
On 2012/11/28 14:42:10, danno wrote:
> I think it would be better if you build the list of ArrayInstructions
explicitly
> from HKeyedLoad/HKeyedStore's constructors, avoiding iterating over all
> instructions.

Done.

https://chromiumcodereview.appspot.com/11365174/diff/11016/src/hydrogen.cc#ne...
src/hydrogen.cc:2989: if (!current_value->IsPhi() &&
!current_value->IsLoadKeyed() &&
On 2012/11/28 14:42:10, danno wrote:
> Would things get easier if you had a up_worklist and a down_worklist? That way
> you could initialize the down_worklist when you found roots during the
> up_worklist iteration, avoiding having to go hunting for them in the table in
a
> separate step.

Done.

https://chromiumcodereview.appspot.com/11365174/diff/11016/src/hydrogen.cc#ne...
src/hydrogen.cc:3008: worklist.Add(WorkItem(current_value, value,
current_value), zone());
On 2012/11/28 14:42:10, danno wrote:
> Is it wrong to call UpdateMapCheck here directly?

We could get away with that. I was thinking though, that the logic around
calling UpdateMapCheck is a bit careful and I'd rather do all the "actual
operations" in one place.

https://chromiumcodereview.appspot.com/11365174/diff/11016/src/hydrogen.cc#ne...
src/hydrogen.cc:3050: if (to_value->to() != NULL) {
On 2012/11/28 14:42:10, danno wrote:
> Can you move this and the Finalize in the NULL case into
> HoistTransitionsFromArrayInstructionSites, which maybe could be be just just
> called PlaceArrayInstructionTransitions

Done.

https://chromiumcodereview.appspot.com/11365174/diff/11026/src/hydrogen-instr...
File src/hydrogen-instructions.h (right):

https://chromiumcodereview.appspot.com/11365174/diff/11026/src/hydrogen-instr...
src/hydrogen-instructions.h:4363: HTransitionElementsKind* transition_;
On 2012/11/28 14:42:10, danno wrote:
> Here's a radical idea. Since you need to allocate one of these for every
> HTransitionElementsKind, why not just add all this functionality to
> HTransitionElementsKind itself? You could remove the from_ and to_, since they
> are already recorded in the TransitionElementsKind instruction. 

Done.

https://chromiumcodereview.appspot.com/11365174/diff/11026/src/hydrogen-instr...
src/hydrogen-instructions.h:4371: class ArrayInstruction: public
HTemplateInstruction<3> {
On 2012/11/28 14:42:10, danno wrote:
> Maybe HArrayInstruction, it's more consistent.

Done.

https://chromiumcodereview.appspot.com/11365174/diff/11026/src/hydrogen-instr...
src/hydrogen-instructions.h:4375: bookmarks_(new(zone)
ZoneList<TransitionElementsBookmark>(10, zone)),
On 2012/11/28 14:42:10, danno wrote:
> Maybe TransitionElementsBookmark*, and allocate the bookmarks from the zone
when
> they're added. Also, 10 seems like a lot, might cause a lot of extra space to
be
> allocated that is never used.

Got rid of the Bookmarks entirely.

https://chromiumcodereview.appspot.com/11365174/diff/11026/src/hydrogen-instr...
src/hydrogen-instructions.h:4410: // ElementsKind elements_kind =
most_general_map()->elements_kind();
On 2012/11/28 14:42:10, danno wrote:
> Is this comment stale?

Done.

Powered by Google App Engine
This is Rietveld 408576698