Reviewers: Yang,

Message:
Hi Yang, here is a fix for the function name inferrer.

Recent changes in scoping caused functions that were lazily parsed to be eagerly parsed. It appears that the eager parse case didn't even have the possibility
for the function name inferrer to work. I've added what seems to be the
appropriate infrastructure, copying from the lazy parser.
Thanks,
--Michael


Description:
Bugfix: CCTest test-func-name-inference/InConstructor is broken

BUG=v8:4331
LOG=N

Please review this at https://codereview.chromium.org/1263763002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+7, -4 lines):
  M src/parser.cc
  M test/cctest/cctest.status


Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 027880cd0504454cd8f53e1947f89407fbb4671c..ae1a8c14c7d6e0e16def6f0e99897519c7afefdf 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -2199,6 +2199,11 @@ Statement* Parser::ParseFunctionDeclaration(
   bool is_strict_reserved = false;
   const AstRawString* name = ParseIdentifierOrStrictReservedWord(
       &is_strict_reserved, CHECK_OK);
+
+  if (fni_ != NULL) {
+    fni_->Enter();
+    fni_->PushEnclosingName(name);
+  }
   FunctionLiteral* fun = ParseFunctionLiteral(
       name, scanner()->location(),
       is_strict_reserved ? kFunctionNameIsStrictReserved
@@ -2207,6 +2212,8 @@ Statement* Parser::ParseFunctionDeclaration(
                    : FunctionKind::kNormalFunction,
       pos, FunctionLiteral::DECLARATION, FunctionLiteral::NORMAL_ARITY,
       language_mode(), CHECK_OK);
+  if (fni_ != NULL) fni_->Leave();
+
   // Even if we're not at the top-level of the global or a function
   // scope, we treat it as such and introduce the function with its
   // initial value upon entering the corresponding scope.
Index: test/cctest/cctest.status
diff --git a/test/cctest/cctest.status b/test/cctest/cctest.status
index dc712a3c55b8fdfefcb868b5613b9229d7ba0508..68bdac9c5d6f1112ee2164aa1694d90c2fe791ed 100644
--- a/test/cctest/cctest.status
+++ b/test/cctest/cctest.status
@@ -71,10 +71,6 @@
   # This tests API threading, no point in running several variants.
   'test-api/Threading*': [PASS, NO_VARIANTS],

-  # Parser fixes break the function name inference in the constructor.
-  # BUG(4331)
-  'test-func-name-inference/InConstructor': [SKIP],
-
   # The cpu profiler tests are notoriously flaky.
   # BUG(2999). (test/cpu-profiler/CollectCpuProfile)
   # BUG(3287). (test-cpu-profiler/SampleWhenFrameIsNotSetup)


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to