Reviewers: fschneider, Søren Gjesse,

Description:
Force lazy deoptimization and remove optimized code on deopt inside a
recursively invoked function.

[email protected],[email protected]
BUG=
TEST=


Please review this at http://codereview.chromium.org/7890028/

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

Affected files:
  M src/runtime.cc


Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 00999db6ee7183743bf485beb35fafbc53647954..5df1dda8857ffd8a0caec0b39054895dcd6e1a7c 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -8229,8 +8229,6 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyDeoptimized) {

   if (type == Deoptimizer::EAGER) {
     RUNTIME_ASSERT(function->IsOptimized());
-  } else {
-    RUNTIME_ASSERT(!function->IsOptimized());
   }

   // Avoid doing too much work when running with --always-opt and keep
@@ -8249,8 +8247,6 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyDeoptimized) {
     it.Advance();
   }

-  // TODO(kasperl): For now, we cannot support removing the optimized
-  // code when we have recursive invocations of the same function.
   if (activations == 0) {
     if (FLAG_trace_deopt) {
       PrintF("[removing optimized code for: ");
@@ -8258,6 +8254,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyDeoptimized) {
       PrintF("]\n");
     }
     function->ReplaceCode(function->shared()->code());
+  } else {
+    Deoptimizer::DeoptimizeFunction(*function);
   }
   return isolate->heap()->undefined_value();
 }


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to