Index: src/deoptimizer.cc |
diff --git a/src/deoptimizer.cc b/src/deoptimizer.cc |
index 1f645e41cc6d7c18063b623178d4fcfc197dcfc8..cf3c03da5fc17bf51ba1916d16cbac5cf710d617 100644 |
--- a/src/deoptimizer.cc |
+++ b/src/deoptimizer.cc |
@@ -392,9 +392,33 @@ void Deoptimizer::DeoptimizeMarkedCodeForContext(Context* context) { |
element = next; |
} |
+#ifdef DEBUG |
+ // Make sure all activations of optimized code can deopt at their current PC. |
+ for (StackFrameIterator it(isolate, isolate->thread_local_top()); |
+ !it.done(); it.Advance()) { |
+ StackFrame::Type type = it.frame()->type(); |
+ if (type == StackFrame::OPTIMIZED) { |
+ Code* code = it.frame()->LookupCode(); |
+ if (FLAG_trace_deopt) { |
+ JSFunction* function = |
+ static_cast<OptimizedFrame*>(it.frame())->function(); |
+ CodeTracer::Scope scope(isolate->GetCodeTracer()); |
+ PrintF(scope.file(), "[deoptimizer patches for lazy deopt: "); |
+ function->PrintName(scope.file()); |
+ PrintF(scope.file(), |
+ " / %" V8PRIxPTR "]\n", reinterpret_cast<intptr_t>(function)); |
+ } |
+ SafepointEntry safepoint = code->GetSafepointEntry(it.frame()->pc()); |
+ int deopt_index = safepoint.deoptimization_index(); |
+ CHECK(deopt_index != Safepoint::kNoDeoptimizationIndex); |
+ } |
+ } |
+#endif |
+ |
// TODO(titzer): we need a handle scope only because of the macro assembler, |
// which is only used in EnsureCodeForDeoptimizationEntry. |
HandleScope scope(isolate); |
+ |
// Now patch all the codes for deoptimization. |
for (int i = 0; i < codes.length(); i++) { |
// It is finally time to die, code object. |