Revision: 11829
Author: [email protected]
Date: Fri Jun 15 03:36:45 2012
Log: Fix list traversal of optimized functions in deoptimizer.
[email protected]
Review URL: https://chromiumcodereview.appspot.com/10546179
http://code.google.com/p/v8/source/detail?r=11829
Modified:
/branches/bleeding_edge/src/deoptimizer.cc
=======================================
--- /branches/bleeding_edge/src/deoptimizer.cc Tue Jun 12 03:22:33 2012
+++ /branches/bleeding_edge/src/deoptimizer.cc Fri Jun 15 03:36:45 2012
@@ -268,20 +268,29 @@
void Deoptimizer::VisitAllOptimizedFunctionsForContext(
Context* context, OptimizedFunctionVisitor* visitor) {
+ Isolate* isolate = context->GetIsolate();
+ ZoneScope zone_scope(isolate, DELETE_ON_EXIT);
AssertNoAllocation no_allocation;
ASSERT(context->IsGlobalContext());
visitor->EnterContext(context);
- // Run through the list of optimized functions and deoptimize them.
+
+ // Create a snapshot of the optimized functions list. This is needed
because
+ // visitors might remove more than one link from the list at once.
+ ZoneList<JSFunction*> snapshot(1, isolate->zone());
Object* element = context->OptimizedFunctionsListHead();
while (!element->IsUndefined()) {
JSFunction* element_function = JSFunction::cast(element);
- // Get the next link before deoptimizing as deoptimizing will clear the
- // next link.
+ snapshot.Add(element_function, isolate->zone());
element = element_function->next_function_link();
- visitor->VisitFunction(element_function);
- }
+ }
+
+ // Run through the snapshot of optimized functions and visit them.
+ for (int i = 0; i < snapshot.length(); ++i) {
+ visitor->VisitFunction(snapshot.at(i));
+ }
+
visitor->LeaveContext(context);
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev