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

Side by Side Diff: src/deoptimizer.cc

Issue 10546179: Fix list traversal of optimized functions in deoptimizer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Florian Schneider. Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 void Deoptimizer::DeoptimizeGlobalObject(JSObject* object) { 261 void Deoptimizer::DeoptimizeGlobalObject(JSObject* object) {
262 AssertNoAllocation no_allocation; 262 AssertNoAllocation no_allocation;
263 263
264 DeoptimizingVisitor visitor; 264 DeoptimizingVisitor visitor;
265 VisitAllOptimizedFunctionsForGlobalObject(object, &visitor); 265 VisitAllOptimizedFunctionsForGlobalObject(object, &visitor);
266 } 266 }
267 267
268 268
269 void Deoptimizer::VisitAllOptimizedFunctionsForContext( 269 void Deoptimizer::VisitAllOptimizedFunctionsForContext(
270 Context* context, OptimizedFunctionVisitor* visitor) { 270 Context* context, OptimizedFunctionVisitor* visitor) {
271 Isolate* isolate = context->GetIsolate();
272 ZoneScope zone_scope(isolate, DELETE_ON_EXIT);
271 AssertNoAllocation no_allocation; 273 AssertNoAllocation no_allocation;
272 274
273 ASSERT(context->IsGlobalContext()); 275 ASSERT(context->IsGlobalContext());
274 276
275 visitor->EnterContext(context); 277 visitor->EnterContext(context);
276 // Run through the list of optimized functions and deoptimize them. 278
279 // Create a snapshot of the optimized functions list. This is needed because
280 // visitors might remove more than one link from the list at once.
281 ZoneList<JSFunction*> snapshot(1, isolate->zone());
277 Object* element = context->OptimizedFunctionsListHead(); 282 Object* element = context->OptimizedFunctionsListHead();
278 while (!element->IsUndefined()) { 283 while (!element->IsUndefined()) {
279 JSFunction* element_function = JSFunction::cast(element); 284 JSFunction* element_function = JSFunction::cast(element);
280 // Get the next link before deoptimizing as deoptimizing will clear the 285 snapshot.Add(element_function, isolate->zone());
281 // next link.
282 element = element_function->next_function_link(); 286 element = element_function->next_function_link();
283 visitor->VisitFunction(element_function);
284 } 287 }
288
289 // Run through the snapshot of optimized functions and visit them.
290 for (int i = 0; i < snapshot.length(); ++i) {
291 visitor->VisitFunction(snapshot.at(i));
292 }
293
285 visitor->LeaveContext(context); 294 visitor->LeaveContext(context);
286 } 295 }
287 296
288 297
289 void Deoptimizer::VisitAllOptimizedFunctionsForGlobalObject( 298 void Deoptimizer::VisitAllOptimizedFunctionsForGlobalObject(
290 JSObject* object, OptimizedFunctionVisitor* visitor) { 299 JSObject* object, OptimizedFunctionVisitor* visitor) {
291 AssertNoAllocation no_allocation; 300 AssertNoAllocation no_allocation;
292 301
293 if (object->IsJSGlobalProxy()) { 302 if (object->IsJSGlobalProxy()) {
294 Object* proto = object->GetPrototype(); 303 Object* proto = object->GetPrototype();
(...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after
1663 1672
1664 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { 1673 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) {
1665 v->VisitPointer(BitCast<Object**>(&function_)); 1674 v->VisitPointer(BitCast<Object**>(&function_));
1666 v->VisitPointers(parameters_, parameters_ + parameters_count_); 1675 v->VisitPointers(parameters_, parameters_ + parameters_count_);
1667 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); 1676 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_);
1668 } 1677 }
1669 1678
1670 #endif // ENABLE_DEBUGGER_SUPPORT 1679 #endif // ENABLE_DEBUGGER_SUPPORT
1671 1680
1672 } } // namespace v8::internal 1681 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698