From 5fadbd9e2fd1f000b1355ef280bfd5a69c18923a Mon Sep 17 00:00:00 2001 From: "yangguo@chromium.org" Date: Wed, 5 Feb 2014 12:19:29 +0000 Subject: [PATCH] Fix %OptimizeFunctionOnNextCall wrt concurrent compilation. If a function is marked or queued for concurrent compilation, %OptimizeFunctionOnNextCall becomes a no-op. That can be wrong if concurrent recompilation does not complete at the time we expect the function to have been optimized. R=hpayer@chromium.org Review URL: https://codereview.chromium.org/151343006 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19100 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/runtime.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/runtime.cc b/src/runtime.cc index 333a2dc4b4..372d74b74a 100644 --- a/src/runtime.cc +++ b/src/runtime.cc @@ -8503,7 +8503,12 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_OptimizeFunctionOnNextCall) { RUNTIME_ASSERT(args.length() == 1 || args.length() == 2); CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); - if (!function->IsOptimizable()) return isolate->heap()->undefined_value(); + if (!function->IsOptimizable() && + !function->IsMarkedForConcurrentOptimization() && + !function->IsInOptimizationQueue()) { + return isolate->heap()->undefined_value(); + } + function->MarkForOptimization(); Code* unoptimized = function->shared()->code();