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

Unified Diff: test/unittests/compiler-dispatcher/compiler-dispatcher-job-unittest.cc

Issue 2579973002: Don't compile inner functions when compiling via the dispatcher (Closed)
Patch Set: added comment Created 4 years 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
« src/compiler.h ('K') | « src/interpreter/interpreter.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/compiler-dispatcher/compiler-dispatcher-job-unittest.cc
diff --git a/test/unittests/compiler-dispatcher/compiler-dispatcher-job-unittest.cc b/test/unittests/compiler-dispatcher/compiler-dispatcher-job-unittest.cc
index d8fde2b1400b2f0cac9026c946f01c0e3bb59436..13f77ec45831da7610d50b2373312ac227769abf 100644
--- a/test/unittests/compiler-dispatcher/compiler-dispatcher-job-unittest.cc
+++ b/test/unittests/compiler-dispatcher/compiler-dispatcher-job-unittest.cc
@@ -323,5 +323,36 @@ TEST_F(IgnitionCompilerDispatcherJobTest, CompileOnBackgroundThread) {
ASSERT_TRUE(job->status() == CompileJobStatus::kInitial);
}
+TEST_F(CompilerDispatcherJobTest, LazyInnerFunctions) {
+ const char script[] =
+ "function g() {\n"
+ " f = function() {\n"
+ " e = (function() { return 42; });\n"
+ " return e;\n"
+ " };\n"
+ " return f;\n"
+ "}\n"
+ "g();";
+ Handle<JSFunction> f = Handle<JSFunction>::cast(RunJS(isolate(), script));
+
+ std::unique_ptr<CompilerDispatcherJob> job(new CompilerDispatcherJob(
+ i_isolate(), tracer(), handle(f->shared()), FLAG_stack_size));
+
+ job->PrepareToParseOnMainThread();
+ job->Parse();
+ ASSERT_TRUE(job->FinalizeParsingOnMainThread());
+ ASSERT_TRUE(job->PrepareToCompileOnMainThread());
+ job->Compile();
+ ASSERT_TRUE(job->FinalizeCompilingOnMainThread());
+ ASSERT_TRUE(job->status() == CompileJobStatus::kDone);
+
+ Handle<JSFunction> e = Handle<JSFunction>::cast(RunJS(isolate(), "f();"));
+
+ ASSERT_FALSE(e->shared()->HasBaselineCode());
+
+ job->ResetOnMainThread();
+ ASSERT_TRUE(job->status() == CompileJobStatus::kInitial);
+}
+
} // namespace internal
} // namespace v8
« src/compiler.h ('K') | « src/interpreter/interpreter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698