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

Unified Diff: src/parser.cc

Issue 8423005: Remove some unnecessary binding initialization checks. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 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/objects.h ('k') | src/scopeinfo.h » ('j') | src/scopes.h » ('J')
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 b09607ff1850a63f4d405ae27cc796985b327cb6..67bae43be155899c8736e4752c8c07e0d7c3a934 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -1385,7 +1385,9 @@ VariableProxy* Parser::Declare(Handle<String> name,
var = declaration_scope->LocalLookup(name);
if (var == NULL) {
// Declare the name.
- var = declaration_scope->DeclareLocal(name, mode);
+ InitializationFlag init_flag = (fun != NULL || mode == VAR)
+ ? CREATED_INITIALIZED : NEEDS_INITIALIZATION;
+ var = declaration_scope->DeclareLocal(name, mode, init_flag);
} else {
// The name was declared in this scope before; check for conflicting
// re-declarations. We have a conflict if either of the declarations is
@@ -1452,7 +1454,12 @@ VariableProxy* Parser::Declare(Handle<String> name,
declaration_scope->is_global_scope()) {
ASSERT(resolve); // should be set by all callers
Variable::Kind kind = Variable::NORMAL;
- var = new(zone()) Variable(declaration_scope, name, CONST, true, kind);
+ var = new(zone()) Variable(declaration_scope,
+ name,
+ CONST,
+ true,
+ kind,
+ NEEDS_INITIALIZATION);
}
// If requested and we have a local variable, bind the proxy to the variable
@@ -2283,7 +2290,8 @@ TryStatement* Parser::ParseTryStatement(bool* ok) {
if (peek() == Token::LBRACE) {
Target target(&this->target_stack_, &catch_collector);
VariableMode mode = harmony_scoping_ ? LET : VAR;
- catch_variable = catch_scope->DeclareLocal(name, mode);
+ catch_variable =
+ catch_scope->DeclareLocal(name, mode, CREATED_INITIALIZED);
SaveScope save_scope(this, catch_scope);
catch_block = ParseBlock(NULL, CHECK_OK);
« no previous file with comments | « src/objects.h ('k') | src/scopeinfo.h » ('j') | src/scopes.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698