|
@ -8201,6 +8201,31 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_LazyRecompile) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ActivationsFinder : public ThreadVisitor { |
|
|
|
|
|
public: |
|
|
|
|
|
explicit ActivationsFinder(JSFunction* function) |
|
|
|
|
|
: function_(function), has_activations_(false) {} |
|
|
|
|
|
|
|
|
|
|
|
void VisitThread(Isolate* isolate, ThreadLocalTop* top) { |
|
|
|
|
|
if (has_activations_) return; |
|
|
|
|
|
|
|
|
|
|
|
for (JavaScriptFrameIterator it(isolate, top); !it.done(); it.Advance()) { |
|
|
|
|
|
JavaScriptFrame* frame = it.frame(); |
|
|
|
|
|
if (frame->is_optimized() && frame->function() == function_) { |
|
|
|
|
|
has_activations_ = true; |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool has_activations() { return has_activations_; } |
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
|
JSFunction* function_; |
|
|
|
|
|
bool has_activations_; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyDeoptimized) { |
|
|
RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyDeoptimized) { |
|
|
HandleScope scope(isolate); |
|
|
HandleScope scope(isolate); |
|
|
ASSERT(args.length() == 1); |
|
|
ASSERT(args.length() == 1); |
|
@ -8247,17 +8272,24 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyDeoptimized) { |
|
|
return isolate->heap()->undefined_value(); |
|
|
return isolate->heap()->undefined_value(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Count the number of optimized activations of the function.
|
|
|
// Find other optimized activations of the function.
|
|
|
int activations = 0; |
|
|
bool has_other_activations = false; |
|
|
while (!it.done()) { |
|
|
while (!it.done()) { |
|
|
JavaScriptFrame* frame = it.frame(); |
|
|
JavaScriptFrame* frame = it.frame(); |
|
|
if (frame->is_optimized() && frame->function() == *function) { |
|
|
if (frame->is_optimized() && frame->function() == *function) { |
|
|
activations++; |
|
|
has_other_activations = true; |
|
|
|
|
|
break; |
|
|
} |
|
|
} |
|
|
it.Advance(); |
|
|
it.Advance(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (activations == 0) { |
|
|
if (!has_other_activations) { |
|
|
|
|
|
ActivationsFinder activations_finder(*function); |
|
|
|
|
|
isolate->thread_manager()->IterateArchivedThreads(&activations_finder); |
|
|
|
|
|
has_other_activations = activations_finder.has_activations(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!has_other_activations) { |
|
|
if (FLAG_trace_deopt) { |
|
|
if (FLAG_trace_deopt) { |
|
|
PrintF("[removing optimized code for: "); |
|
|
PrintF("[removing optimized code for: "); |
|
|
function->PrintName(); |
|
|
function->PrintName(); |
|
|