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

Side by Side 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, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after
1580 } 1580 }
1581 } 1581 }
1582 } 1582 }
1583 Expect(Token::RBRACE, CHECK_OK); 1583 Expect(Token::RBRACE, CHECK_OK);
1584 top_scope_ = saved_scope; 1584 top_scope_ = saved_scope;
1585 1585
1586 block_scope = block_scope->FinalizeBlockScope(); 1586 block_scope = block_scope->FinalizeBlockScope();
1587 body->set_block_scope(block_scope); 1587 body->set_block_scope(block_scope);
1588 1588
1589 if (block_scope != NULL) { 1589 if (block_scope != NULL) {
1590 // Create exit block. 1590 // Rewrite the block { B } to a block: { { B } ExitContext; }
1591 Block* exit = new(zone()) Block(isolate(), NULL, 1, false); 1591 Block* exit = new(zone()) Block(isolate(), NULL, 2, false);
1592 exit->AddStatement(body);
1592 exit->AddStatement(new(zone()) ExitContextStatement()); 1593 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
1593 1594 return exit;
1594 // Create a try-finally statement.
1595 TryFinallyStatement* try_finally =
1596 new(zone()) TryFinallyStatement(body, exit);
1597 try_finally->set_escaping_targets(collector.targets());
1598
1599 // Create a result block.
1600 Block* result = new(zone()) Block(isolate(), NULL, 1, false);
1601 result->AddStatement(try_finally);
1602 return result;
1603 } else { 1595 } else {
1604 return body; 1596 return body;
1605 } 1597 }
1606 } 1598 }
1607 1599
1608 1600
1609 Block* Parser::ParseVariableStatement(VariableDeclarationContext var_context, 1601 Block* Parser::ParseVariableStatement(VariableDeclarationContext var_context,
1610 bool* ok) { 1602 bool* ok) {
1611 // VariableStatement :: 1603 // VariableStatement ::
1612 // VariableDeclarations ';' 1604 // VariableDeclarations ';'
(...skipping 3630 matching lines...) Expand 10 before | Expand all | Expand 10 after
5243 result = parser.ParseProgram(source, 5235 result = parser.ParseProgram(source,
5244 info->is_global(), 5236 info->is_global(),
5245 info->StrictMode()); 5237 info->StrictMode());
5246 } 5238 }
5247 } 5239 }
5248 info->SetFunction(result); 5240 info->SetFunction(result);
5249 return (result != NULL); 5241 return (result != NULL);
5250 } 5242 }
5251 5243
5252 } } // namespace v8::internal 5244 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698