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

Issue 2322853003: VM: Zero-cost try-finally with an empty finally-block. (Closed)

Created:
4 years, 3 months ago by Florian Schneider
Modified:
4 years, 3 months ago
Reviewers:
rmacnak
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Target Ref:
refs/heads/master
Visibility:
Public.

Description

VM: Zero-cost try-finally with an empty finally-block. Consider code like try { something(); } finally { assert(expr); } The compiler de-sugars this into try { something(); } catch (_) { rethrow; } finally { assert(expr); } In unchecked mode this leaves an empty finally-block, but we would still have the overhead of the try-catch. This CL avoids this unnecessary overhead by making try-finally with an empty finally zero-cost. BUG=#27274 R=rmacnak@google.com Committed: https://github.com/dart-lang/sdk/commit/60e6faa7c3357ab519fc88b3f51f39b5419eb257

Patch Set 1 #

Total comments: 5

Patch Set 2 : detect rethrow correctly #

Total comments: 2

Patch Set 3 : remove extra space #

Patch Set 4 : rebased #

Unified diffs Side-by-side diffs Delta from patch set Stats (+19 lines, -3 lines) Patch
M runtime/vm/ast.h View 1 chunk +1 line, -0 lines 0 comments Download
M runtime/vm/flow_graph_builder.cc View 1 2 2 chunks +18 lines, -3 lines 0 comments Download

Messages

Total messages: 8 (2 generated)
Florian Schneider
4 years, 3 months ago (2016-09-08 21:46:14 UTC) #2
rmacnak
https://codereview.chromium.org/2322853003/diff/1/runtime/vm/flow_graph_builder.cc File runtime/vm/flow_graph_builder.cc (right): https://codereview.chromium.org/2322853003/diff/1/runtime/vm/flow_graph_builder.cc#newcode4230 runtime/vm/flow_graph_builder.cc:4230: if ((finally_block != NULL) && (finally_block->length() == 0)) { ...
4 years, 3 months ago (2016-09-08 22:02:38 UTC) #3
Florian Schneider
https://codereview.chromium.org/2322853003/diff/1/runtime/vm/flow_graph_builder.cc File runtime/vm/flow_graph_builder.cc (right): https://codereview.chromium.org/2322853003/diff/1/runtime/vm/flow_graph_builder.cc#newcode4230 runtime/vm/flow_graph_builder.cc:4230: if ((finally_block != NULL) && (finally_block->length() == 0)) { ...
4 years, 3 months ago (2016-09-09 00:51:48 UTC) #4
rmacnak
lgtm https://chromiumcodereview.appspot.com/2322853003/diff/20001/runtime/vm/flow_graph_builder.cc File runtime/vm/flow_graph_builder.cc (right): https://chromiumcodereview.appspot.com/2322853003/diff/20001/runtime/vm/flow_graph_builder.cc#newcode4235 runtime/vm/flow_graph_builder.cc:4235: ThrowNode* throw_node = catch_sequence-> NodeAt(0)->AsThrowNode(); extra space in ...
4 years, 3 months ago (2016-09-09 20:24:35 UTC) #5
Florian Schneider
https://chromiumcodereview.appspot.com/2322853003/diff/20001/runtime/vm/flow_graph_builder.cc File runtime/vm/flow_graph_builder.cc (right): https://chromiumcodereview.appspot.com/2322853003/diff/20001/runtime/vm/flow_graph_builder.cc#newcode4235 runtime/vm/flow_graph_builder.cc:4235: ThrowNode* throw_node = catch_sequence-> NodeAt(0)->AsThrowNode(); On 2016/09/09 20:24:35, rmacnak ...
4 years, 3 months ago (2016-09-09 20:30:07 UTC) #6
Florian Schneider
4 years, 3 months ago (2016-09-09 21:00:57 UTC) #8
Message was sent while issue was closed.
Committed patchset #4 (id:60001) manually as
60e6faa7c3357ab519fc88b3f51f39b5419eb257 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698