Fix infinite loop in regress-opt-after-deopt.
authoryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 1 Jul 2013 09:14:15 +0000 (09:14 +0000)
committeryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 1 Jul 2013 09:14:15 +0000 (09:14 +0000)
%CompleteOptimization attempts to install optimized functions
that the parallel thread has put on the output queue, as long as
the function is marked with a builtin.  However, activating the
debugger will set all functions to the lazy recompile builtin,
without the function being on the parallel recompilation pipeline.
So we wait for the function to finish parallel recompilation
while it's marked by a builtin that's unrelated to parallel
recompilation.

R=hpayer@chromium.org
BUG=

Review URL: https://codereview.chromium.org/18129003

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

src/runtime.cc

index 081774f..484d343 100644 (file)
@@ -8314,8 +8314,13 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CompleteOptimization) {
   ASSERT(args.length() == 1);
   CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
   if (FLAG_parallel_recompilation && V8::UseCrankshaft()) {
-    // While function is in optimization pipeline, it is marked with builtins.
-    while (function->code()->kind() == Code::BUILTIN) {
+    // While function is in optimization pipeline, it is marked accordingly.
+    // Note that if the debugger is activated during parallel recompilation,
+    // the function will be marked with the lazy-recompile builtin, which is
+    // not related to parallel recompilation.
+    while (function->IsMarkedForParallelRecompilation() ||
+           function->IsInRecompileQueue() ||
+           function->IsMarkedForInstallingRecompiledCode()) {
       isolate->optimizing_compiler_thread()->InstallOptimizedFunctions();
       OS::Sleep(50);
     }