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

Unified Diff: src/parser.cc

Issue 7523027: Provisional implementation of stack allocated catch variables. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 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
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/prettyprinter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 5704cb805d84799981b6ebbee95bd460173bc29a..bcfb0daa081074dd80476e090e21fd3ef02398c3 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -1491,6 +1491,7 @@ Block* Parser::ParseBlock(ZoneStringList* labels, bool* ok) {
// Construct block expecting 16 statements.
Block* result = new(zone()) Block(isolate(), labels, 16, false);
Target target(&this->target_stack_, result);
+ result->SetSourceBegStatementPos(scanner().location().beg_pos);
Expect(Token::LBRACE, CHECK_OK);
InitializationBlockFinder block_finder(top_scope_, target_stack_);
while (peek() != Token::RBRACE) {
@@ -1500,6 +1501,7 @@ Block* Parser::ParseBlock(ZoneStringList* labels, bool* ok) {
block_finder.Update(stat);
}
}
+ result->SetSourceEndStatementPos(scanner().location().end_pos);
Expect(Token::RBRACE, CHECK_OK);
return result;
}
@@ -1957,8 +1959,18 @@ Block* Parser::WithHelper(Expression* obj, ZoneStringList* labels, bool* ok) {
Statement* stat;
{ Target target(&this->target_stack_, &collector);
with_nesting_level_++;
+ Scope* saved_scope = top_scope_;
+ Scope* with_scope = NewScope(top_scope_, Scope::WITH_SCOPE, true);
+ if (top_scope_->is_strict_mode()) {
+ with_scope->EnableStrictMode();
+ }
top_scope_->DeclarationScope()->RecordWithStatement();
+ top_scope_ = with_scope;
+ with_scope->SetSourceBegStatementPos(scanner().location().beg_pos);
stat = ParseStatement(labels, CHECK_OK);
+ with_scope->SetSourceEndStatementPos(scanner().location().end_pos);
+ top_scope_ = saved_scope;
+ if (with_scope->calls_eval()) top_scope_->RecordEvalCall();
with_nesting_level_--;
}
// Create resulting block with two statements.
@@ -2155,13 +2167,19 @@ TryStatement* Parser::ParseTryStatement(bool* ok) {
Scope* saved_scope = top_scope_;
top_scope_ = catch_scope;
inner_body = ParseBlock(NULL, CHECK_OK);
+ catch_scope->SetSourceBegStatementPos(
+ inner_body->SourceBegStatementPos());
+ catch_scope->SetSourceEndStatementPos(
+ inner_body->SourceEndStatementPos());
top_scope_ = saved_scope;
+ if (catch_scope->calls_eval()) top_scope_->RecordEvalCall();
}
}
// Create exit block.
Block* inner_finally = new(zone()) Block(isolate(), NULL, 1, false);
- inner_finally->AddStatement(new(zone()) ExitContextStatement());
+ inner_finally->AddStatement(new(zone())
+ ExitScopedBlockStatement(catch_scope));
// Create a try/finally statement.
TryFinallyStatement* inner_try_finally =
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/prettyprinter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698