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

Side by Side Diff: src/parser.cc

Issue 13408005: Force context allocation for variables in generator scopes. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 7 years, 8 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
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/scopes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 4374 matching lines...) Expand 10 before | Expand all | Expand 10 after
4385 FunctionLiteral::IsParenthesizedFlag parenthesized = parenthesized_function_ 4385 FunctionLiteral::IsParenthesizedFlag parenthesized = parenthesized_function_
4386 ? FunctionLiteral::kIsParenthesized 4386 ? FunctionLiteral::kIsParenthesized
4387 : FunctionLiteral::kNotParenthesized; 4387 : FunctionLiteral::kNotParenthesized;
4388 FunctionLiteral::IsGeneratorFlag generator = is_generator 4388 FunctionLiteral::IsGeneratorFlag generator = is_generator
4389 ? FunctionLiteral::kIsGenerator 4389 ? FunctionLiteral::kIsGenerator
4390 : FunctionLiteral::kNotGenerator; 4390 : FunctionLiteral::kNotGenerator;
4391 AstProperties ast_properties; 4391 AstProperties ast_properties;
4392 // Parse function body. 4392 // Parse function body.
4393 { FunctionState function_state(this, scope, is_generator, isolate()); 4393 { FunctionState function_state(this, scope, is_generator, isolate());
4394 top_scope_->SetScopeName(function_name); 4394 top_scope_->SetScopeName(function_name);
4395 // For generators, allocating variables in contexts is currently a win
4396 // because it minimizes the work needed to suspend and resume an activation.
4397 if (is_generator) top_scope_->ForceContextAllocation();
4395 4398
4396 // FormalParameterList :: 4399 // FormalParameterList ::
4397 // '(' (Identifier)*[','] ')' 4400 // '(' (Identifier)*[','] ')'
4398 Expect(Token::LPAREN, CHECK_OK); 4401 Expect(Token::LPAREN, CHECK_OK);
4399 scope->set_start_position(scanner().location().beg_pos); 4402 scope->set_start_position(scanner().location().beg_pos);
4400 Scanner::Location name_loc = Scanner::Location::invalid(); 4403 Scanner::Location name_loc = Scanner::Location::invalid();
4401 Scanner::Location dupe_loc = Scanner::Location::invalid(); 4404 Scanner::Location dupe_loc = Scanner::Location::invalid();
4402 Scanner::Location reserved_loc = Scanner::Location::invalid(); 4405 Scanner::Location reserved_loc = Scanner::Location::invalid();
4403 4406
4404 bool done = (peek() == Token::RPAREN); 4407 bool done = (peek() == Token::RPAREN);
(...skipping 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after
6002 ASSERT(info->isolate()->has_pending_exception()); 6005 ASSERT(info->isolate()->has_pending_exception());
6003 } else { 6006 } else {
6004 result = parser.ParseProgram(); 6007 result = parser.ParseProgram();
6005 } 6008 }
6006 } 6009 }
6007 info->SetFunction(result); 6010 info->SetFunction(result);
6008 return (result != NULL); 6011 return (result != NULL);
6009 } 6012 }
6010 6013
6011 } } // namespace v8::internal 6014 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698