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

Issue 27200: Experimental: fix a bug in our compilation of switch statements.... (Closed)

Created:
11 years, 10 months ago by Kevin Millikin (Chromium)
Modified:
9 years, 7 months ago
Reviewers:
iposva, William Hesse
CC:
v8-dev
Visibility:
Public.

Description

Experimental: fix a bug in our compilation of switch statements. As described in issue 241 http://code.google.com/p/v8/issues/detail?id=241 we can crash when compiling switch statements if we get into a state where we are skipping comparisons (due to an unconditionally true match) and still compiling bodies (due to continued fall-through) and then hit a default case. The issue is fixed by splitting the loop over the cases so that we do not reuse the same loop code for both states (compiling comparisons and skipping comparisons). The code for the end of the switch has also been modified to avoid a jump to the next statement for the last case (at the cost of extra complexity to handle the new possible compilation states that arise). Committed: http://code.google.com/p/v8/source/detail?r=1379

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Patch Set 4 : '' #

Patch Set 5 : '' #

Patch Set 6 : '' #

Patch Set 7 : '' #

Patch Set 8 : '' #

Patch Set 9 : '' #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+119 lines, -57 lines) Patch
M src/codegen-ia32.cc View 1 2 3 4 5 6 7 8 2 chunks +119 lines, -57 lines 6 comments Download

Messages

Total messages: 3 (0 generated)
Kevin Millikin (Chromium)
11 years, 10 months ago (2009-02-26 12:03:19 UTC) #1
William Hesse
LGTM. http://codereview.chromium.org/27200/diff/16/1012 File src/codegen-ia32.cc (right): http://codereview.chromium.org/27200/diff/16/1012#newcode2168 Line 2168: Could you put a comment here, indicating ...
11 years, 10 months ago (2009-02-26 14:09:06 UTC) #2
Kevin Millikin (Chromium)
11 years, 10 months ago (2009-02-26 15:00:04 UTC) #3
http://codereview.chromium.org/27200/diff/16/1012
File src/codegen-ia32.cc (right):

http://codereview.chromium.org/27200/diff/16/1012#newcode2168
Line 2168: 
On 2009/02/26 14:09:06, William Hesse wrote:
> Could you put a comment here, indicating the possible states of (1)
fallthrough
> links to and from the default clause
> (2) fallthrough link to remaining cases, that are only reached by fallthrough
> (3) next_test link to the default clause, as bound fallthrough or as linked
> target.

Not here but I've clarified some of the other comments.

http://codereview.chromium.org/27200/diff/16/1012#newcode2174
Line 2174: VisitStatements(cases->at(index)->statements());
On 2009/02/26 14:09:06, William Hesse wrote:
> Should you break on no frame here, or is VisitStatements guarded by a
> sufficiently fast check for a valid frame?

Done.

http://codereview.chromium.org/27200/diff/16/1012#newcode2180
Line 2180: // The last clause compiled was unconditionally true.  We still
On 2009/02/26 14:09:06, William Hesse wrote:
> The last test compiled?
> Can't many fall-through clauses be compiled after this test?

Done.

Powered by Google App Engine
This is Rietveld 408576698