Index: src/runtime.cc |
diff --git a/src/runtime.cc b/src/runtime.cc |
index d3baaa440cf7c49a64d1d3a5baeefa0eac4e1162..7a50cea30d604d2d539fb81f1c3c7b75c92d345a 100644 |
--- a/src/runtime.cc |
+++ b/src/runtime.cc |
@@ -7974,7 +7974,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyDeoptimized) { |
RUNTIME_ASSERT(frame->function()->IsJSFunction()); |
Handle<JSFunction> function(JSFunction::cast(frame->function()), isolate); |
Handle<Code> optimized_code(function->code()); |
- RUNTIME_ASSERT(type != Deoptimizer::EAGER || function->IsOptimized()); |
+ RUNTIME_ASSERT((type != Deoptimizer::EAGER && |
+ type != Deoptimizer::SOFT) || function->IsOptimized()); |
// Avoid doing too much work when running with --always-opt and keep |
// the optimized code around. |
@@ -8001,6 +8002,14 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyDeoptimized) { |
has_other_activations = activations_finder.has_activations(); |
} |
+ if (type == Deoptimizer::SOFT) { |
+ // Soft opts shouldn't count against the overall re-optimization count that |
Jakob Kummerow
2013/05/14 11:01:57
nit: s/opts/deopts/
danno
2013/05/14 11:29:09
Done.
|
+ // can eventually lead to disabling optimization for a function. |
+ int opt_count = function->shared()->opt_count(); |
+ if (opt_count > 0) opt_count--; |
+ function->shared()->set_opt_count(opt_count); |
+ } |
+ |
if (!has_other_activations) { |
if (FLAG_trace_deopt) { |
PrintF("[removing optimized code for: "); |