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

Side by Side Diff: src/parser.cc

Issue 7835027: Getting rid of ExitContextStatement for 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
« no previous file with comments | « src/full-codegen.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 body->AddStatement(stat); 1578 body->AddStatement(stat);
1579 block_finder.Update(stat); 1579 block_finder.Update(stat);
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 return body;
1589 if (block_scope != NULL) {
1590 // Rewrite the block { B } to a block: { { B } ExitContext; }
1591 Block* exit = new(zone()) Block(isolate(), NULL, 2, false);
1592 exit->AddStatement(body);
1593 exit->AddStatement(new(zone()) ExitContextStatement());
1594 return exit;
1595 } else {
1596 return body;
1597 }
1598 } 1589 }
1599 1590
1600 1591
1601 Block* Parser::ParseVariableStatement(VariableDeclarationContext var_context, 1592 Block* Parser::ParseVariableStatement(VariableDeclarationContext var_context,
1602 bool* ok) { 1593 bool* ok) {
1603 // VariableStatement :: 1594 // VariableStatement ::
1604 // VariableDeclarations ';' 1595 // VariableDeclarations ';'
1605 1596
1606 Handle<String> ignore; 1597 Handle<String> ignore;
1607 Block* result = ParseVariableDeclarations(var_context, 1598 Block* result = ParseVariableDeclarations(var_context,
(...skipping 3627 matching lines...) Expand 10 before | Expand all | Expand 10 after
5235 result = parser.ParseProgram(source, 5226 result = parser.ParseProgram(source,
5236 info->is_global(), 5227 info->is_global(),
5237 info->StrictMode()); 5228 info->StrictMode());
5238 } 5229 }
5239 } 5230 }
5240 info->SetFunction(result); 5231 info->SetFunction(result);
5241 return (result != NULL); 5232 return (result != NULL);
5242 } 5233 }
5243 5234
5244 } } // namespace v8::internal 5235 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/full-codegen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698