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

Unified Diff: src/parser.cc

Issue 7792100: Simplfy handling of exits from scoped blocks. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index abd06591c4057e6c91e130ccee7f7d43821544da..4371093e8669768686fd80418b886b35f6fa4494 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -1587,19 +1587,11 @@ Block* Parser::ParseScopedBlock(ZoneStringList* labels, bool* ok) {
body->set_block_scope(block_scope);
if (block_scope != NULL) {
- // Create exit block.
- Block* exit = new(zone()) Block(isolate(), NULL, 1, false);
+ // Rewrite the block { B } to a block: { { B } ExitContext; }
+ Block* exit = new(zone()) Block(isolate(), NULL, 2, false);
+ exit->AddStatement(body);
exit->AddStatement(new(zone()) ExitContextStatement());
Kevin Millikin (Chromium) 2011/09/02 15:17:44 Now we're no longer making essential use of ExitCo
Steven 2011/09/05 08:54:50 Will do it. On 2011/09/02 15:17:44, Kevin Millikin
-
- // Create a try-finally statement.
- TryFinallyStatement* try_finally =
- new(zone()) TryFinallyStatement(body, exit);
- try_finally->set_escaping_targets(collector.targets());
-
- // Create a result block.
- Block* result = new(zone()) Block(isolate(), NULL, 1, false);
- result->AddStatement(try_finally);
- return result;
+ return exit;
} else {
return body;
}

Powered by Google App Engine
This is Rietveld 408576698