Index: src/ia32/full-codegen-ia32.cc |
diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc |
index 7916b568f1d3153e6d755c8964e3fe82e57b43dd..5e1b42aa608f35016489129512fceda773f44c96 100644 |
--- a/src/ia32/full-codegen-ia32.cc |
+++ b/src/ia32/full-codegen-ia32.cc |
@@ -776,7 +776,10 @@ void FullCodeGenerator::VisitVariableDeclaration( |
bool hole_init = mode == CONST || mode == CONST_HARMONY || mode == LET; |
switch (variable->location()) { |
case Variable::UNALLOCATED: |
- ++global_count_; |
+ globals_.Add(variable->name()); |
+ globals_.Add(variable->binding_needs_init() |
+ ? isolate()->factory()->the_hole_value() |
+ : isolate()->factory()->undefined_value()); |
break; |
case Variable::PARAMETER: |
@@ -830,9 +833,15 @@ void FullCodeGenerator::VisitFunctionDeclaration( |
VariableProxy* proxy = declaration->proxy(); |
Variable* variable = proxy->var(); |
switch (variable->location()) { |
- case Variable::UNALLOCATED: |
- ++global_count_; |
+ case Variable::UNALLOCATED: { |
+ globals_.Add(variable->name()); |
+ Handle<SharedFunctionInfo> function = |
+ Compiler::BuildFunctionInfo(declaration->fun(), script()); |
+ // Check for stack-overflow exception. |
+ if (function.is_null()) return SetStackOverflow(); |
+ globals_.Add(function); |
break; |
+ } |
case Variable::PARAMETER: |
case Variable::LOCAL: { |
@@ -877,7 +886,7 @@ void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) { |
Variable* variable = proxy->var(); |
switch (variable->location()) { |
case Variable::UNALLOCATED: |
- ++global_count_; |
+ // TODO(rossberg): initialize module instance object |
break; |
case Variable::CONTEXT: { |
@@ -900,7 +909,7 @@ void FullCodeGenerator::VisitImportDeclaration(ImportDeclaration* declaration) { |
Variable* variable = proxy->var(); |
switch (variable->location()) { |
case Variable::UNALLOCATED: |
- ++global_count_; |
+ // TODO(rossberg) |
break; |
case Variable::CONTEXT: { |