Reviewers: ulan,

Description:
Do not overwrite already optimized code.

[email protected]

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

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+10, -4 lines):
  src/optimizing-compiler-thread.cc
  src/runtime.cc


Index: src/optimizing-compiler-thread.cc
diff --git a/src/optimizing-compiler-thread.cc b/src/optimizing-compiler-thread.cc index d21507084c5f9d0de5d3eba72831f0f464665329..fb3eac5d503c1afd47be21cdc587c9f3ec097438 100644
--- a/src/optimizing-compiler-thread.cc
+++ b/src/optimizing-compiler-thread.cc
@@ -258,9 +258,13 @@ void OptimizingCompilerThread::InstallOptimizedFunctions() {
       uint32_t offset = code->TranslateAstIdToPcOffset(info->osr_ast_id());
       BackEdgeTable::RemoveStackCheck(code, offset);
     } else {
-      Handle<Code> code = Compiler::GetConcurrentlyOptimizedCode(job);
-      function->ReplaceCode(
-          code.is_null() ? function->shared()->code() : *code);
+      if (function->IsOptimized()) {
+        DisposeOptimizedCompileJob(job, false);
+      } else {
+        Handle<Code> code = Compiler::GetConcurrentlyOptimizedCode(job);
+        function->ReplaceCode(
+            code.is_null() ? function->shared()->code() : *code);
+      }
     }
   }
 }
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index c0c87a457d3ad870d701f6747d23a13e644fd741..8bccd6b4ce690961aa8d57f54cd41c3752d432f6 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -8763,7 +8763,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileForOnStackReplacement) {
     PrintF(" at AST id %d]\n", ast_id.ToInt());
   }

-  function->ReplaceCode(function->shared()->code());
+  if (!function->IsOptimized()) {
+    function->ReplaceCode(function->shared()->code());
+  }
   return NULL;
 }



--
--
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