Introduce support for local function declarations in Hydrogen.
authorfschneider@chromium.org <fschneider@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 29 Aug 2011 10:50:47 +0000 (10:50 +0000)
committerfschneider@chromium.org <fschneider@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 29 Aug 2011 10:50:47 +0000 (10:50 +0000)
Review URL: http://codereview.chromium.org/7782001

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9047 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/hydrogen.cc

index dd3a591..012e8b8 100644 (file)
@@ -5804,13 +5804,17 @@ void HGraphBuilder::VisitThisFunction(ThisFunction* expr) {
 void HGraphBuilder::VisitDeclaration(Declaration* decl) {
   // We support only declarations that do not require code generation.
   Variable* var = decl->proxy()->var();
-  if (!var->IsStackAllocated() || decl->fun() != NULL) {
+  if (!var->IsStackAllocated()) {
     return Bailout("unsupported declaration");
   }
 
   if (decl->mode() == Variable::CONST) {
     ASSERT(var->IsStackAllocated());
     environment()->Bind(var, graph()->GetConstantHole());
+  } else if (decl->fun() != NULL) {
+    VisitForValue(decl->fun());
+    HValue* function = Pop();
+    environment()->Bind(var, function);
   }
 }