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

Issue 22876009: Improve and simplify removal of unreachable code (Closed)

Created:
7 years, 4 months ago by danno
Modified:
7 years, 2 months ago
CC:
v8-dev
Visibility:
Public.

Description

Improve and simplify removal of unreachable code - Detect unreachable basic blocks of code either following an unconditional deopt or after a provably untaken branch of HBranch or HCompareObjectEqAndBranch instructions. - Emit dummy uses in unreachable blocks during Hydrogen -> Lithium translation. BUG=chromium:258519 R=jkummerow@chromium.org, mstarzinger@chromium.org Committed: http://code.google.com/p/v8/source/detail?r=17073

Patch Set 1 #

Patch Set 2 : Make ia32 work #

Patch Set 3 : Fix nits #

Patch Set 4 : Fix nits #

Patch Set 5 : Better names #

Patch Set 6 : Fix ia32 #

Total comments: 12

Patch Set 7 : Merge with ToT #

Patch Set 8 : Implement new strategy #

Patch Set 9 : Make OSR work #

Patch Set 10 : Latest version #

Patch Set 11 : ia32 only for now #

Patch Set 12 : Make it work again #

Patch Set 13 : Latest bits #

Patch Set 14 : Works again #

Patch Set 15 : Remove dead code #

Patch Set 16 : Remove redundant code #

Patch Set 17 : Implement x64 #

Patch Set 18 : Implement ARM #

Patch Set 19 : Fix nits #

Patch Set 20 : Add missing file #

Total comments: 32

Patch Set 21 : Rebase to bleeding_edge #

Patch Set 22 : Address review feedback #

Unified diffs Side-by-side diffs Delta from patch set Stats (+550 lines, -720 lines) Patch
M src/arm/lithium-arm.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2 chunks +5 lines, -3 lines 0 comments Download
M src/arm/lithium-arm.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 3 chunks +22 lines, -9 lines 0 comments Download
M src/arm/lithium-codegen-arm.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 8 chunks +5 lines, -47 lines 0 comments Download
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 19 20 8 chunks +7 lines, -64 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 19 20 21 1 chunk +1 line, -2 lines 0 comments Download
M src/hydrogen.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 5 chunks +13 lines, -16 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 20 21 9 chunks +22 lines, -4 lines 0 comments Download
D src/hydrogen-deoptimizing-mark.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +0 lines, -56 lines 0 comments Download
M src/hydrogen-deoptimizing-mark.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +0 lines, -126 lines 0 comments Download
M src/hydrogen-gvn.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +19 lines, -21 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 20 21 9 chunks +76 lines, -34 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 20 21 3 chunks +40 lines, -0 lines 0 comments Download
A + src/hydrogen-mark-unreachable.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2 chunks +9 lines, -7 lines 0 comments Download
A + src/hydrogen-mark-unreachable.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +37 lines, -22 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 20 21 8 chunks +7 lines, -48 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 20 7 chunks +21 lines, -72 lines 0 comments Download
M src/ia32/lithium-ia32.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +2 lines, -0 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 20 21 3 chunks +21 lines, -10 lines 0 comments Download
M src/lithium.cc View 1 2 3 4 5 6 7 1 chunk +8 lines, -0 lines 0 comments Download
A + src/lithium-codegen.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +55 lines, -61 lines 0 comments Download
A src/lithium-codegen.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +144 lines, -0 lines 0 comments Download
M src/x64/lithium-codegen-x64.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 9 chunks +5 lines, -46 lines 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 19 20 3 chunks +0 lines, -56 lines 0 comments Download
M src/x64/lithium-x64.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2 chunks +5 lines, -3 lines 0 comments Download
M src/x64/lithium-x64.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 4 chunks +22 lines, -11 lines 0 comments Download
M tools/gyp/v8.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 3 chunks +4 lines, -2 lines 0 comments Download

Messages

Total messages: 10 (0 generated)
danno
PTAL
7 years, 4 months ago (2013-08-14 14:51:44 UTC) #1
Michael Starzinger
LGTM with a couple of comments. https://codereview.chromium.org/22876009/diff/13001/src/hydrogen-instructions.h File src/hydrogen-instructions.h (right): https://codereview.chromium.org/22876009/diff/13001/src/hydrogen-instructions.h#newcode3393 src/hydrogen-instructions.h:3393: bool SameConstantObject(HConstant* other) ...
7 years, 4 months ago (2013-08-16 15:02:20 UTC) #2
Jakob Kummerow
LGTM with comments. https://codereview.chromium.org/22876009/diff/13001/src/hydrogen-instructions.h File src/hydrogen-instructions.h (right): https://codereview.chromium.org/22876009/diff/13001/src/hydrogen-instructions.h#newcode3393 src/hydrogen-instructions.h:3393: bool SameConstantObject(HConstant* other) { This seems ...
7 years, 4 months ago (2013-08-20 08:46:55 UTC) #3
Jakob Kummerow
Since the issue that's fixed by this CL has reached the stable channel (crbug.com/280333), I've ...
7 years, 3 months ago (2013-08-30 11:52:43 UTC) #4
danno
Please take another look. This is a bigger re-write that moves all the logic into ...
7 years, 2 months ago (2013-10-01 10:43:17 UTC) #5
Michael Starzinger
LMBTMN (looks much better to me now; that implies LGTM). Another round of nits. https://codereview.chromium.org/22876009/diff/71027/src/flag-definitions.h ...
7 years, 2 months ago (2013-10-01 11:17:46 UTC) #6
Jakob Kummerow
LGTM with comments. https://codereview.chromium.org/22876009/diff/71027/src/arm/lithium-arm.cc File src/arm/lithium-arm.cc (right): https://codereview.chromium.org/22876009/diff/71027/src/arm/lithium-arm.cc#newcode872 src/arm/lithium-arm.cc:872: new(zone()) LDummyUse(UseAny(current->OperandAt(1))); OperandAt(i) https://codereview.chromium.org/22876009/diff/71027/src/hydrogen-mark-unreachable.cc File src/hydrogen-mark-unreachable.cc ...
7 years, 2 months ago (2013-10-01 11:59:19 UTC) #7
Jakob Kummerow
one more nit. https://codereview.chromium.org/22876009/diff/71027/src/hydrogen-mark-unreachable.cc File src/hydrogen-mark-unreachable.cc (right): https://codereview.chromium.org/22876009/diff/71027/src/hydrogen-mark-unreachable.cc#newcode47 src/hydrogen-mark-unreachable.cc:47: // A block is reachable if ...
7 years, 2 months ago (2013-10-01 17:47:12 UTC) #8
danno
Committed patchset #22 manually as r17073 (presubmit successful).
7 years, 2 months ago (2013-10-02 11:45:48 UTC) #9
danno
7 years, 2 months ago (2013-10-23 11:46:51 UTC) #10
Message was sent while issue was closed.
Addressed and landed

https://codereview.chromium.org/22876009/diff/71027/src/arm/lithium-arm.cc
File src/arm/lithium-arm.cc (right):

https://codereview.chromium.org/22876009/diff/71027/src/arm/lithium-arm.cc#ne...
src/arm/lithium-arm.cc:872: new(zone())
LDummyUse(UseAny(current->OperandAt(1)));
On 2013/10/01 11:59:20, Jakob wrote:
> OperandAt(i)

Done.

https://codereview.chromium.org/22876009/diff/71027/src/flag-definitions.h
File src/flag-definitions.h (right):

https://codereview.chromium.org/22876009/diff/71027/src/flag-definitions.h#ne...
src/flag-definitions.h:297: DEFINE_bool(unreachable_code_elimination, true,
On 2013/10/01 11:17:47, Michael Starzinger wrote:
> nit: Looks like it fits into one line now.

Done.

https://codereview.chromium.org/22876009/diff/71027/src/hydrogen-instructions.cc
File src/hydrogen-instructions.cc (right):

https://codereview.chromium.org/22876009/diff/71027/src/hydrogen-instructions...
src/hydrogen-instructions.cc:2889:
HConstant::cast(left())->DataEquals(HConstant::cast(right()));
On 2013/10/01 11:17:47, Michael Starzinger wrote:
> suggestion: We could use Equals() instead of DataEquals() here. Admittedly
that
> performs some redundant checks, but would allow us to keep
> HConstant::DataEquals() protected and not break abstraction. I am fine either
> way, your choice.

Done.

https://codereview.chromium.org/22876009/diff/71027/src/hydrogen-mark-unreach...
File src/hydrogen-mark-unreachable.cc (right):

https://codereview.chromium.org/22876009/diff/71027/src/hydrogen-mark-unreach...
src/hydrogen-mark-unreachable.cc:43: if (block->IsReachable()) {
On 2013/10/01 11:59:20, Jakob wrote:
> nit: you can avoid one level of indentation by turning this into an early
> return:
>       if (block->IsUnreachable()) continue;

Done.

https://codereview.chromium.org/22876009/diff/71027/src/hydrogen-mark-unreach...
src/hydrogen-mark-unreachable.cc:47: // A block is reachable if one of it's
predecessor is reachable,
On 2013/10/01 17:47:13, Jakob wrote:
> nit: s/it's predecessor/its predecessors/

Done.

https://codereview.chromium.org/22876009/diff/71027/src/hydrogen-mark-unreach...
File src/hydrogen-mark-unreachable.h (right):

https://codereview.chromium.org/22876009/diff/71027/src/hydrogen-mark-unreach...
src/hydrogen-mark-unreachable.h:40: : HPhase("H_Propagate unrechable mark",
graph) { }
On 2013/10/01 11:17:47, Michael Starzinger wrote:
> nit: s/H_Propagate unrechable mark/H_Mark unreachable/

Done.

https://codereview.chromium.org/22876009/diff/71027/src/hydrogen.cc
File src/hydrogen.cc (right):

https://codereview.chromium.org/22876009/diff/71027/src/hydrogen.cc#newcode3635
src/hydrogen.cc:3635: // If the current test block is deoptimizing due to an
unhandle clause
On 2013/10/01 11:59:20, Jakob wrote:
> nit: unhandled

Done.

https://codereview.chromium.org/22876009/diff/71027/src/hydrogen.cc#newcode3636
src/hydrogen.cc:3636: // of the switch, the test instruction is in the next
block since (the
On 2013/10/01 11:59:20, Jakob wrote:
> nit: no ()

Done.

https://codereview.chromium.org/22876009/diff/71027/src/ia32/lithium-codegen-...
File src/ia32/lithium-codegen-ia32.h (right):

https://codereview.chromium.org/22876009/diff/71027/src/ia32/lithium-codegen-...
src/ia32/lithium-codegen-ia32.h:35: #include "lithium-codegen.h"
On 2013/10/01 11:17:47, Michael Starzinger wrote:
> nit: Can we alpha-sort the includes.

Done.

https://codereview.chromium.org/22876009/diff/71027/src/ia32/lithium-ia32.cc
File src/ia32/lithium-ia32.cc (right):

https://codereview.chromium.org/22876009/diff/71027/src/ia32/lithium-ia32.cc#...
src/ia32/lithium-ia32.cc:916: ? graph()->GetConstant1() :
On 2013/10/01 11:59:20, Jakob wrote:
> nit: please put the ':' in the next line, under the '?'. Or move the next line
> up here, right behind the ':'.

Done.

https://codereview.chromium.org/22876009/diff/71027/src/ia32/lithium-ia32.cc#...
src/ia32/lithium-ia32.cc:921: new(zone())
LDummyUse(UseAny(current->OperandAt(1)));
On 2013/10/01 11:59:20, Jakob wrote:
> bug: OperandAt(i)!

Done.

https://codereview.chromium.org/22876009/diff/71027/src/lithium-codegen.cc
File src/lithium-codegen.cc (right):

https://codereview.chromium.org/22876009/diff/71027/src/lithium-codegen.cc#ne...
src/lithium-codegen.cc:144: #undef __
On 2013/10/01 11:17:47, Michael Starzinger wrote:
> nit: Looks obsolete, let's drop it.

Done.

https://codereview.chromium.org/22876009/diff/71027/src/lithium-codegen.h
File src/lithium-codegen.h (right):

https://codereview.chromium.org/22876009/diff/71027/src/lithium-codegen.h#new...
src/lithium-codegen.h:41: class LCodeGenBase V8_FINAL BASE_EMBEDDED {
On 2013/10/01 11:17:47, Michael Starzinger wrote:
> This V8_FINAL looks wrong because we actually inherit from this class. Doesn't
> actually speak for the usefulness off these macros in the first place. :)

Done.

https://codereview.chromium.org/22876009/diff/71027/src/lithium-codegen.h#new...
src/lithium-codegen.h:94: #undef __
On 2013/10/01 11:17:47, Michael Starzinger wrote:
> nit: Looks obsolete, let's drop it.

Done.

https://codereview.chromium.org/22876009/diff/71027/src/x64/lithium-x64.cc
File src/x64/lithium-x64.cc (right):

https://codereview.chromium.org/22876009/diff/71027/src/x64/lithium-x64.cc#ne...
src/x64/lithium-x64.cc:872: new(zone())
LDummyUse(UseAny(current->OperandAt(1)));
On 2013/10/01 11:59:20, Jakob wrote:
> OperandAt(i)!

Done.

https://codereview.chromium.org/22876009/diff/71027/test/mjsunit/constant-bra...
File test/mjsunit/constant-branch-folding-liveness.js (right):

https://codereview.chromium.org/22876009/diff/71027/test/mjsunit/constant-bra...
test/mjsunit/constant-branch-folding-liveness.js:1: // Copyright 2013 the V8
project authors. All rights reserved.
On 2013/10/01 11:59:20, Jakob wrote:
> You can drop this file; it is already present as
> test/mjsunit/regress/regress-crbug-280333.js.

Done.

Powered by Google App Engine
This is Rietveld 408576698