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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(); | 271 Isolate* isolate = context->GetIsolate(); |
272 ZoneScope zone_scope(isolate->runtime_zone(), DELETE_ON_EXIT); | 272 ZoneScope zone_scope(isolate->runtime_zone(), DELETE_ON_EXIT); |
273 AssertNoAllocation no_allocation; | 273 AssertNoAllocation no_allocation; |
274 | 274 |
275 ASSERT(context->IsGlobalContext()); | 275 ASSERT(context->IsNativeContext()); |
276 | 276 |
277 visitor->EnterContext(context); | 277 visitor->EnterContext(context); |
278 | 278 |
279 // Create a snapshot of the optimized functions list. This is needed because | 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. | 280 // visitors might remove more than one link from the list at once. |
281 ZoneList<JSFunction*> snapshot(1, isolate->runtime_zone()); | 281 ZoneList<JSFunction*> snapshot(1, isolate->runtime_zone()); |
282 Object* element = context->OptimizedFunctionsListHead(); | 282 Object* element = context->OptimizedFunctionsListHead(); |
283 while (!element->IsUndefined()) { | 283 while (!element->IsUndefined()) { |
284 JSFunction* element_function = JSFunction::cast(element); | 284 JSFunction* element_function = JSFunction::cast(element); |
285 snapshot.Add(element_function, isolate->runtime_zone()); | 285 snapshot.Add(element_function, isolate->runtime_zone()); |
(...skipping 10 matching lines...) Expand all Loading... |
296 | 296 |
297 | 297 |
298 void Deoptimizer::VisitAllOptimizedFunctionsForGlobalObject( | 298 void Deoptimizer::VisitAllOptimizedFunctionsForGlobalObject( |
299 JSObject* object, OptimizedFunctionVisitor* visitor) { | 299 JSObject* object, OptimizedFunctionVisitor* visitor) { |
300 AssertNoAllocation no_allocation; | 300 AssertNoAllocation no_allocation; |
301 | 301 |
302 if (object->IsJSGlobalProxy()) { | 302 if (object->IsJSGlobalProxy()) { |
303 Object* proto = object->GetPrototype(); | 303 Object* proto = object->GetPrototype(); |
304 ASSERT(proto->IsJSGlobalObject()); | 304 ASSERT(proto->IsJSGlobalObject()); |
305 VisitAllOptimizedFunctionsForContext( | 305 VisitAllOptimizedFunctionsForContext( |
306 GlobalObject::cast(proto)->global_context(), visitor); | 306 GlobalObject::cast(proto)->native_context(), visitor); |
307 } else if (object->IsGlobalObject()) { | 307 } else if (object->IsGlobalObject()) { |
308 VisitAllOptimizedFunctionsForContext( | 308 VisitAllOptimizedFunctionsForContext( |
309 GlobalObject::cast(object)->global_context(), visitor); | 309 GlobalObject::cast(object)->native_context(), visitor); |
310 } | 310 } |
311 } | 311 } |
312 | 312 |
313 | 313 |
314 void Deoptimizer::VisitAllOptimizedFunctions( | 314 void Deoptimizer::VisitAllOptimizedFunctions( |
315 OptimizedFunctionVisitor* visitor) { | 315 OptimizedFunctionVisitor* visitor) { |
316 AssertNoAllocation no_allocation; | 316 AssertNoAllocation no_allocation; |
317 | 317 |
318 // Run through the list of all global contexts and deoptimize. | 318 // Run through the list of all native contexts and deoptimize. |
319 Object* context = Isolate::Current()->heap()->global_contexts_list(); | 319 Object* context = Isolate::Current()->heap()->native_contexts_list(); |
320 while (!context->IsUndefined()) { | 320 while (!context->IsUndefined()) { |
321 // GC can happen when the context is not fully initialized, | 321 // GC can happen when the context is not fully initialized, |
322 // so the global field of the context can be undefined. | 322 // so the global field of the context can be undefined. |
323 Object* global = Context::cast(context)->get(Context::GLOBAL_INDEX); | 323 Object* global = Context::cast(context)->get(Context::GLOBAL_INDEX); |
324 if (!global->IsUndefined()) { | 324 if (!global->IsUndefined()) { |
325 VisitAllOptimizedFunctionsForGlobalObject(JSObject::cast(global), | 325 VisitAllOptimizedFunctionsForGlobalObject(JSObject::cast(global), |
326 visitor); | 326 visitor); |
327 } | 327 } |
328 context = Context::cast(context)->get(Context::NEXT_CONTEXT_LINK); | 328 context = Context::cast(context)->get(Context::NEXT_CONTEXT_LINK); |
329 } | 329 } |
(...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1673 | 1673 |
1674 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { | 1674 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { |
1675 v->VisitPointer(BitCast<Object**>(&function_)); | 1675 v->VisitPointer(BitCast<Object**>(&function_)); |
1676 v->VisitPointers(parameters_, parameters_ + parameters_count_); | 1676 v->VisitPointers(parameters_, parameters_ + parameters_count_); |
1677 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); | 1677 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); |
1678 } | 1678 } |
1679 | 1679 |
1680 #endif // ENABLE_DEBUGGER_SUPPORT | 1680 #endif // ENABLE_DEBUGGER_SUPPORT |
1681 | 1681 |
1682 } } // namespace v8::internal | 1682 } } // namespace v8::internal |
OLD | NEW |