Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Unified Diff: src/runtime.cc

Issue 8240004: Runtime_NotifyDeoptimized should search for function activation in all thread stacks. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/frames-inl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index cafe46cfb84c081936a9dc9c64270e8570c3be18..e0f507e1774bbd7c7d500994f40a07e74ae8f1e6 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -8178,6 +8178,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) {
HandleScope scope(isolate);
ASSERT(args.length() == 1);
@@ -8224,17 +8249,24 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyDeoptimized) {
return isolate->heap()->undefined_value();
}
- // Count the number of optimized activations of the function.
- int activations = 0;
+ // Find other optimized activations of the function.
+ bool has_other_activations = false;
while (!it.done()) {
JavaScriptFrame* frame = it.frame();
if (frame->is_optimized() && frame->function() == *function) {
- activations++;
+ has_other_activations = true;
+ break;
}
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) {
PrintF("[removing optimized code for: ");
function->PrintName();
« no previous file with comments | « src/frames-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698