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

Side by Side Diff: src/deoptimizer.cc

Issue 1661883003: [counters] adding more counters and log-events (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/deoptimizer.h" 5 #include "src/deoptimizer.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/ast/prettyprinter.h" 8 #include "src/ast/prettyprinter.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/disasm.h" 10 #include "src/disasm.h"
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 419
420 // We might be in the middle of incremental marking with compaction. 420 // We might be in the middle of incremental marking with compaction.
421 // Tell collector to treat this code object in a special way and 421 // Tell collector to treat this code object in a special way and
422 // ignore all slots that might have been recorded on it. 422 // ignore all slots that might have been recorded on it.
423 isolate->heap()->mark_compact_collector()->InvalidateCode(codes[i]); 423 isolate->heap()->mark_compact_collector()->InvalidateCode(codes[i]);
424 } 424 }
425 } 425 }
426 426
427 427
428 void Deoptimizer::DeoptimizeAll(Isolate* isolate) { 428 void Deoptimizer::DeoptimizeAll(Isolate* isolate) {
429 TimerEventScope<TimerEventDeoptimizeCode> timer(isolate);
429 if (FLAG_trace_deopt) { 430 if (FLAG_trace_deopt) {
430 CodeTracer::Scope scope(isolate->GetCodeTracer()); 431 CodeTracer::Scope scope(isolate->GetCodeTracer());
431 PrintF(scope.file(), "[deoptimize all code in all contexts]\n"); 432 PrintF(scope.file(), "[deoptimize all code in all contexts]\n");
432 } 433 }
433 DisallowHeapAllocation no_allocation; 434 DisallowHeapAllocation no_allocation;
434 // For all contexts, mark all code, then deoptimize. 435 // For all contexts, mark all code, then deoptimize.
435 Object* context = isolate->heap()->native_contexts_list(); 436 Object* context = isolate->heap()->native_contexts_list();
436 while (!context->IsUndefined()) { 437 while (!context->IsUndefined()) {
437 Context* native_context = Context::cast(context); 438 Context* native_context = Context::cast(context);
438 MarkAllCodeForContext(native_context); 439 MarkAllCodeForContext(native_context);
439 DeoptimizeMarkedCodeForContext(native_context); 440 DeoptimizeMarkedCodeForContext(native_context);
440 context = native_context->get(Context::NEXT_CONTEXT_LINK); 441 context = native_context->get(Context::NEXT_CONTEXT_LINK);
441 } 442 }
442 } 443 }
443 444
444 445
445 void Deoptimizer::DeoptimizeMarkedCode(Isolate* isolate) { 446 void Deoptimizer::DeoptimizeMarkedCode(Isolate* isolate) {
447 TimerEventScope<TimerEventDeoptimizeCode> timer(isolate);
446 if (FLAG_trace_deopt) { 448 if (FLAG_trace_deopt) {
447 CodeTracer::Scope scope(isolate->GetCodeTracer()); 449 CodeTracer::Scope scope(isolate->GetCodeTracer());
448 PrintF(scope.file(), "[deoptimize marked code in all contexts]\n"); 450 PrintF(scope.file(), "[deoptimize marked code in all contexts]\n");
449 } 451 }
450 DisallowHeapAllocation no_allocation; 452 DisallowHeapAllocation no_allocation;
451 // For all contexts, deoptimize code already marked. 453 // For all contexts, deoptimize code already marked.
452 Object* context = isolate->heap()->native_contexts_list(); 454 Object* context = isolate->heap()->native_contexts_list();
453 while (!context->IsUndefined()) { 455 while (!context->IsUndefined()) {
454 Context* native_context = Context::cast(context); 456 Context* native_context = Context::cast(context);
455 DeoptimizeMarkedCodeForContext(native_context); 457 DeoptimizeMarkedCodeForContext(native_context);
456 context = native_context->get(Context::NEXT_CONTEXT_LINK); 458 context = native_context->get(Context::NEXT_CONTEXT_LINK);
457 } 459 }
458 } 460 }
459 461
460 462
461 void Deoptimizer::MarkAllCodeForContext(Context* context) { 463 void Deoptimizer::MarkAllCodeForContext(Context* context) {
462 Object* element = context->OptimizedCodeListHead(); 464 Object* element = context->OptimizedCodeListHead();
463 while (!element->IsUndefined()) { 465 while (!element->IsUndefined()) {
464 Code* code = Code::cast(element); 466 Code* code = Code::cast(element);
465 CHECK_EQ(code->kind(), Code::OPTIMIZED_FUNCTION); 467 CHECK_EQ(code->kind(), Code::OPTIMIZED_FUNCTION);
466 code->set_marked_for_deoptimization(true); 468 code->set_marked_for_deoptimization(true);
467 element = code->next_code_link(); 469 element = code->next_code_link();
468 } 470 }
469 } 471 }
470 472
471 473
472 void Deoptimizer::DeoptimizeFunction(JSFunction* function) { 474 void Deoptimizer::DeoptimizeFunction(JSFunction* function) {
Michael Starzinger 2016/02/03 15:36:26 nit: What about this entry point?
473 Code* code = function->code(); 475 Code* code = function->code();
474 if (code->kind() == Code::OPTIMIZED_FUNCTION) { 476 if (code->kind() == Code::OPTIMIZED_FUNCTION) {
475 // Mark the code for deoptimization and unlink any functions that also 477 // Mark the code for deoptimization and unlink any functions that also
476 // refer to that code. The code cannot be shared across native contexts, 478 // refer to that code. The code cannot be shared across native contexts,
477 // so we only need to search one. 479 // so we only need to search one.
478 code->set_marked_for_deoptimization(true); 480 code->set_marked_for_deoptimization(true);
479 DeoptimizeMarkedCodeForContext(function->context()->native_context()); 481 DeoptimizeMarkedCodeForContext(function->context()->native_context());
480 } 482 }
481 } 483 }
482 484
(...skipping 3228 matching lines...) Expand 10 before | Expand all | Expand 10 after
3711 DCHECK(value_info->IsMaterializedObject()); 3713 DCHECK(value_info->IsMaterializedObject());
3712 3714
3713 value_info->value_ = 3715 value_info->value_ =
3714 Handle<Object>(previously_materialized_objects->get(i), isolate_); 3716 Handle<Object>(previously_materialized_objects->get(i), isolate_);
3715 } 3717 }
3716 } 3718 }
3717 } 3719 }
3718 3720
3719 } // namespace internal 3721 } // namespace internal
3720 } // namespace v8 3722 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698