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

Issue 6526016: Properly process try/finally blocks. (Closed)

Created:
9 years, 10 months ago by antonm
Modified:
9 years, 4 months ago
CC:
v8-dev
Visibility:
Public.

Description

Properly process try/finally blocks. In some circumstances, try/finally block can actually catch the exception: function f() { try { throw 42; } finally { return 0; } } Therefore when propagating exception to v8::TryCatch, we must be sure there is no try/finally blocks as well. When bulding the messages we should be more conservative and expect that any v8::TryCatch with no JS try/catch in between can potentionally be the right exception handler. Plus various minor refactorings. BUG=1147 TEST=cctest/test-api/TryCatchAndFinallyHidingException, cctest/test-api/TryCatchAndFinally Committed: http://code.google.com/p/v8/source/detail?r=6809

Patch Set 1 #

Patch Set 2 : Some more asserts #

Total comments: 6

Patch Set 3 : Addressing Mads' comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+113 lines, -28 lines) Patch
M samples/shell.cc View 1 2 chunks +3 lines, -0 lines 0 comments Download
M src/d8.cc View 1 1 chunk +2 lines, -0 lines 0 comments Download
M src/top.h View 1 2 3 chunks +7 lines, -7 lines 0 comments Download
M src/top.cc View 1 2 9 chunks +66 lines, -21 lines 0 comments Download
M test/cctest/test-api.cc View 1 2 1 chunk +35 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
antonm
Mads, may you have a look? I was considering refactoring and renaming ShouldReportException (make explicit ...
9 years, 10 months ago (2011-02-15 17:48:32 UTC) #1
Mads Ager (chromium)
LGTM http://codereview.chromium.org/6526016/diff/1006/src/top.cc File src/top.cc (right): http://codereview.chromium.org/6526016/diff/1006/src/top.cc#newcode938 src/top.cc:938: // When throwing the exception, we found no ...
9 years, 10 months ago (2011-02-16 09:17:49 UTC) #2
antonm
9 years, 10 months ago (2011-02-16 11:40:44 UTC) #3
Thanks a lot for review, Mads.  Submitting.

http://codereview.chromium.org/6526016/diff/1006/src/top.cc
File src/top.cc (right):

http://codereview.chromium.org/6526016/diff/1006/src/top.cc#newcode938
src/top.cc:938: // When throwing the exception, we found no or another
v8::TryCatch
On 2011/02/16 09:17:49, Mads Ager wrote:
> no or another -> no

Done.

http://codereview.chromium.org/6526016/diff/1006/src/top.cc#newcode961
src/top.cc:961: if (handler->is_try_finally()) return false;
On 2011/02/16 09:17:49, Mads Ager wrote:
> In cases where the exception is propagated from the try-finally is that
handled
> as a separate implicit throw at the end of the finally block?
> 
> In that case, please add a comment explaining that if the finally clause does
> not eat the exception (by returning for instance) it is rethrown at the end of
> the finally block.

Done.

http://codereview.chromium.org/6526016/diff/1006/src/top.h
File src/top.h (right):

http://codereview.chromium.org/6526016/diff/1006/src/top.h#newcode264
src/top.h:264: return
I find it more aesthetically pleasing to have this parallel structures, but
let's do it your way.

On 2011/02/16 09:17:49, Mads Ager wrote:
> Why the extra line? I would probably do:
> 
> return ((exception != Failure::...) &&
>         (exception != Heap::...));

Powered by Google App Engine
This is Rietveld 408576698