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

Side by Side Diff: src/deoptimizer.cc

Issue 17827005: Get rid of ZoneScope completely. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Suggestions from danno Created 7 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 | « src/compiler.cc ('k') | src/gdb-jit.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 int count, 277 int count,
278 BailoutType type) { 278 BailoutType type) {
279 TableEntryGenerator generator(masm, type, count); 279 TableEntryGenerator generator(masm, type, count);
280 generator.Generate(); 280 generator.Generate();
281 } 281 }
282 282
283 283
284 void Deoptimizer::VisitAllOptimizedFunctionsForContext( 284 void Deoptimizer::VisitAllOptimizedFunctionsForContext(
285 Context* context, OptimizedFunctionVisitor* visitor) { 285 Context* context, OptimizedFunctionVisitor* visitor) {
286 Isolate* isolate = context->GetIsolate(); 286 Isolate* isolate = context->GetIsolate();
287 ZoneScope zone_scope(isolate->runtime_zone(), DELETE_ON_EXIT); 287 Zone zone(isolate);
288 DisallowHeapAllocation no_allocation; 288 DisallowHeapAllocation no_allocation;
289 289
290 ASSERT(context->IsNativeContext()); 290 ASSERT(context->IsNativeContext());
291 291
292 visitor->EnterContext(context); 292 visitor->EnterContext(context);
293 293
294 // Create a snapshot of the optimized functions list. This is needed because 294 // Create a snapshot of the optimized functions list. This is needed because
295 // visitors might remove more than one link from the list at once. 295 // visitors might remove more than one link from the list at once.
296 ZoneList<JSFunction*> snapshot(1, isolate->runtime_zone()); 296 ZoneList<JSFunction*> snapshot(1, &zone);
297 Object* element = context->OptimizedFunctionsListHead(); 297 Object* element = context->OptimizedFunctionsListHead();
298 while (!element->IsUndefined()) { 298 while (!element->IsUndefined()) {
299 JSFunction* element_function = JSFunction::cast(element); 299 JSFunction* element_function = JSFunction::cast(element);
300 snapshot.Add(element_function, isolate->runtime_zone()); 300 snapshot.Add(element_function, &zone);
301 element = element_function->next_function_link(); 301 element = element_function->next_function_link();
302 } 302 }
303 303
304 // Run through the snapshot of optimized functions and visit them. 304 // Run through the snapshot of optimized functions and visit them.
305 for (int i = 0; i < snapshot.length(); ++i) { 305 for (int i = 0; i < snapshot.length(); ++i) {
306 visitor->VisitFunction(snapshot.at(i)); 306 visitor->VisitFunction(snapshot.at(i));
307 } 307 }
308 308
309 visitor->LeaveContext(context); 309 visitor->LeaveContext(context);
310 } 310 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 } 413 }
414 } 414 }
415 415
416 416
417 void Deoptimizer::DeoptimizeFunction(JSFunction* function) { 417 void Deoptimizer::DeoptimizeFunction(JSFunction* function) {
418 if (!function->IsOptimized()) return; 418 if (!function->IsOptimized()) return;
419 Code* code = function->code(); 419 Code* code = function->code();
420 Context* context = function->context()->native_context(); 420 Context* context = function->context()->native_context();
421 Isolate* isolate = context->GetIsolate(); 421 Isolate* isolate = context->GetIsolate();
422 Object* undefined = isolate->heap()->undefined_value(); 422 Object* undefined = isolate->heap()->undefined_value();
423 Zone* zone = isolate->runtime_zone(); 423 Zone zone(isolate);
424 ZoneScope zone_scope(zone, DELETE_ON_EXIT); 424 ZoneList<Code*> codes(1, &zone);
425 ZoneList<Code*> codes(1, zone);
426 DeoptimizeWithMatchingCodeFilter filter(code); 425 DeoptimizeWithMatchingCodeFilter filter(code);
427 PartitionOptimizedFunctions(context, &filter, &codes, zone, undefined); 426 PartitionOptimizedFunctions(context, &filter, &codes, &zone, undefined);
428 ASSERT_EQ(1, codes.length()); 427 ASSERT_EQ(1, codes.length());
429 DeoptimizeFunctionWithPreparedFunctionList( 428 DeoptimizeFunctionWithPreparedFunctionList(
430 JSFunction::cast(codes.at(0)->deoptimizing_functions())); 429 JSFunction::cast(codes.at(0)->deoptimizing_functions()));
431 codes.at(0)->set_deoptimizing_functions(undefined); 430 codes.at(0)->set_deoptimizing_functions(undefined);
432 } 431 }
433 432
434 433
435 void Deoptimizer::DeoptimizeAllFunctionsForContext( 434 void Deoptimizer::DeoptimizeAllFunctionsForContext(
436 Context* context, OptimizedFunctionFilter* filter) { 435 Context* context, OptimizedFunctionFilter* filter) {
437 ASSERT(context->IsNativeContext()); 436 ASSERT(context->IsNativeContext());
438 Isolate* isolate = context->GetIsolate(); 437 Isolate* isolate = context->GetIsolate();
439 Object* undefined = isolate->heap()->undefined_value(); 438 Object* undefined = isolate->heap()->undefined_value();
440 Zone* zone = isolate->runtime_zone(); 439 Zone zone(isolate);
441 ZoneScope zone_scope(zone, DELETE_ON_EXIT); 440 ZoneList<Code*> codes(1, &zone);
442 ZoneList<Code*> codes(1, zone); 441 PartitionOptimizedFunctions(context, filter, &codes, &zone, undefined);
443 PartitionOptimizedFunctions(context, filter, &codes, zone, undefined);
444 for (int i = 0; i < codes.length(); ++i) { 442 for (int i = 0; i < codes.length(); ++i) {
445 DeoptimizeFunctionWithPreparedFunctionList( 443 DeoptimizeFunctionWithPreparedFunctionList(
446 JSFunction::cast(codes.at(i)->deoptimizing_functions())); 444 JSFunction::cast(codes.at(i)->deoptimizing_functions()));
447 codes.at(i)->set_deoptimizing_functions(undefined); 445 codes.at(i)->set_deoptimizing_functions(undefined);
448 } 446 }
449 } 447 }
450 448
451 449
452 void Deoptimizer::DeoptimizeAllFunctionsWith(Isolate* isolate, 450 void Deoptimizer::DeoptimizeAllFunctionsWith(Isolate* isolate,
453 OptimizedFunctionFilter* filter) { 451 OptimizedFunctionFilter* filter) {
(...skipping 2637 matching lines...) Expand 10 before | Expand all | Expand 10 after
3091 3089
3092 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { 3090 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) {
3093 v->VisitPointer(BitCast<Object**>(&function_)); 3091 v->VisitPointer(BitCast<Object**>(&function_));
3094 v->VisitPointers(parameters_, parameters_ + parameters_count_); 3092 v->VisitPointers(parameters_, parameters_ + parameters_count_);
3095 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); 3093 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_);
3096 } 3094 }
3097 3095
3098 #endif // ENABLE_DEBUGGER_SUPPORT 3096 #endif // ENABLE_DEBUGGER_SUPPORT
3099 3097
3100 } } // namespace v8::internal 3098 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/gdb-jit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698