Revision: 9588
Author: [email protected]
Date: Wed Oct 12 03:35:42 2011
Log: Runtime_NotifyDeoptimized should search for function activation
in all thread stacks.
[email protected]
BUG=v8:1763
Review URL: http://codereview.chromium.org/8240004
http://code.google.com/p/v8/source/detail?r=9588
Modified:
/branches/bleeding_edge/src/frames-inl.h
/branches/bleeding_edge/src/frames.h
/branches/bleeding_edge/src/runtime.cc
=======================================
--- /branches/bleeding_edge/src/frames-inl.h Mon Oct 3 04:13:20 2011
+++ /branches/bleeding_edge/src/frames-inl.h Wed Oct 12 03:35:42 2011
@@ -261,6 +261,15 @@
: iterator_(isolate) {
if (!done()) Advance();
}
+
+
+template<typename Iterator>
+inline JavaScriptFrameIteratorTemp<Iterator>::JavaScriptFrameIteratorTemp(
+ Isolate* isolate, ThreadLocalTop* top)
+ : iterator_(isolate, top) {
+ if (!done()) Advance();
+}
+
template<typename Iterator>
inline JavaScriptFrame* JavaScriptFrameIteratorTemp<Iterator>::frame()
const {
=======================================
--- /branches/bleeding_edge/src/frames.h Mon Oct 3 04:13:20 2011
+++ /branches/bleeding_edge/src/frames.h Wed Oct 12 03:35:42 2011
@@ -702,6 +702,8 @@
inline explicit JavaScriptFrameIteratorTemp(Isolate* isolate);
+ inline JavaScriptFrameIteratorTemp(Isolate* isolate, ThreadLocalTop*
top);
+
// Skip frames until the frame with the given id is reached.
explicit JavaScriptFrameIteratorTemp(StackFrame::Id id) {
AdvanceToId(id); }
=======================================
--- /branches/bleeding_edge/src/runtime.cc Tue Oct 11 02:33:00 2011
+++ /branches/bleeding_edge/src/runtime.cc Wed Oct 12 03:35:42 2011
@@ -8178,6 +8178,31 @@
}
+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 @@
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();
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev