OLD | NEW |
---|---|
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 Loading... | |
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. | |
Florian Schneider
2012/06/15 10:31:47
Maybe add to the comment why this was necessary: V
Michael Starzinger
2012/06/15 10:36:34
Done.
| |
280 ZoneList<JSFunction*> snapshot(1, isolate->zone()); | |
277 Object* element = context->OptimizedFunctionsListHead(); | 281 Object* element = context->OptimizedFunctionsListHead(); |
278 while (!element->IsUndefined()) { | 282 while (!element->IsUndefined()) { |
279 JSFunction* element_function = JSFunction::cast(element); | 283 JSFunction* element_function = JSFunction::cast(element); |
280 // Get the next link before deoptimizing as deoptimizing will clear the | 284 snapshot.Add(element_function, isolate->zone()); |
281 // next link. | |
282 element = element_function->next_function_link(); | 285 element = element_function->next_function_link(); |
283 visitor->VisitFunction(element_function); | |
284 } | 286 } |
287 | |
288 // Run through the snapshot of optimized functions and visit them. | |
289 for (int i = 0; i < snapshot.length(); ++i) { | |
290 visitor->VisitFunction(snapshot.at(i)); | |
291 } | |
292 | |
285 visitor->LeaveContext(context); | 293 visitor->LeaveContext(context); |
286 } | 294 } |
287 | 295 |
288 | 296 |
289 void Deoptimizer::VisitAllOptimizedFunctionsForGlobalObject( | 297 void Deoptimizer::VisitAllOptimizedFunctionsForGlobalObject( |
290 JSObject* object, OptimizedFunctionVisitor* visitor) { | 298 JSObject* object, OptimizedFunctionVisitor* visitor) { |
291 AssertNoAllocation no_allocation; | 299 AssertNoAllocation no_allocation; |
292 | 300 |
293 if (object->IsJSGlobalProxy()) { | 301 if (object->IsJSGlobalProxy()) { |
294 Object* proto = object->GetPrototype(); | 302 Object* proto = object->GetPrototype(); |
(...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1663 | 1671 |
1664 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { | 1672 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { |
1665 v->VisitPointer(BitCast<Object**>(&function_)); | 1673 v->VisitPointer(BitCast<Object**>(&function_)); |
1666 v->VisitPointers(parameters_, parameters_ + parameters_count_); | 1674 v->VisitPointers(parameters_, parameters_ + parameters_count_); |
1667 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); | 1675 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); |
1668 } | 1676 } |
1669 | 1677 |
1670 #endif // ENABLE_DEBUGGER_SUPPORT | 1678 #endif // ENABLE_DEBUGGER_SUPPORT |
1671 | 1679 |
1672 } } // namespace v8::internal | 1680 } } // namespace v8::internal |
OLD | NEW |