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

Side by Side Diff: src/deoptimizer.cc

Issue 1923893002: [counters] Annotate v8 with more runtime call counters. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: merging master Created 4 years, 7 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
« no previous file with comments | « src/counters.cc ('k') | src/execution.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 // 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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 367
368 // We might be in the middle of incremental marking with compaction. 368 // We might be in the middle of incremental marking with compaction.
369 // Tell collector to treat this code object in a special way and 369 // Tell collector to treat this code object in a special way and
370 // ignore all slots that might have been recorded on it. 370 // ignore all slots that might have been recorded on it.
371 isolate->heap()->mark_compact_collector()->InvalidateCode(codes[i]); 371 isolate->heap()->mark_compact_collector()->InvalidateCode(codes[i]);
372 } 372 }
373 } 373 }
374 374
375 375
376 void Deoptimizer::DeoptimizeAll(Isolate* isolate) { 376 void Deoptimizer::DeoptimizeAll(Isolate* isolate) {
377 RuntimeCallTimerScope runtimeTimer(isolate,
378 &RuntimeCallStats::DeoptimizeCode);
377 TimerEventScope<TimerEventDeoptimizeCode> timer(isolate); 379 TimerEventScope<TimerEventDeoptimizeCode> timer(isolate);
378 TRACE_EVENT0("v8", "V8.DeoptimizeCode"); 380 TRACE_EVENT0("v8", "V8.DeoptimizeCode");
379 if (FLAG_trace_deopt) { 381 if (FLAG_trace_deopt) {
380 CodeTracer::Scope scope(isolate->GetCodeTracer()); 382 CodeTracer::Scope scope(isolate->GetCodeTracer());
381 PrintF(scope.file(), "[deoptimize all code in all contexts]\n"); 383 PrintF(scope.file(), "[deoptimize all code in all contexts]\n");
382 } 384 }
383 DisallowHeapAllocation no_allocation; 385 DisallowHeapAllocation no_allocation;
384 // For all contexts, mark all code, then deoptimize. 386 // For all contexts, mark all code, then deoptimize.
385 Object* context = isolate->heap()->native_contexts_list(); 387 Object* context = isolate->heap()->native_contexts_list();
386 while (!context->IsUndefined()) { 388 while (!context->IsUndefined()) {
387 Context* native_context = Context::cast(context); 389 Context* native_context = Context::cast(context);
388 MarkAllCodeForContext(native_context); 390 MarkAllCodeForContext(native_context);
389 DeoptimizeMarkedCodeForContext(native_context); 391 DeoptimizeMarkedCodeForContext(native_context);
390 context = native_context->next_context_link(); 392 context = native_context->next_context_link();
391 } 393 }
392 } 394 }
393 395
394 396
395 void Deoptimizer::DeoptimizeMarkedCode(Isolate* isolate) { 397 void Deoptimizer::DeoptimizeMarkedCode(Isolate* isolate) {
398 RuntimeCallTimerScope runtimeTimer(isolate,
399 &RuntimeCallStats::DeoptimizeCode);
396 TimerEventScope<TimerEventDeoptimizeCode> timer(isolate); 400 TimerEventScope<TimerEventDeoptimizeCode> timer(isolate);
397 TRACE_EVENT0("v8", "V8.DeoptimizeCode"); 401 TRACE_EVENT0("v8", "V8.DeoptimizeCode");
398 if (FLAG_trace_deopt) { 402 if (FLAG_trace_deopt) {
399 CodeTracer::Scope scope(isolate->GetCodeTracer()); 403 CodeTracer::Scope scope(isolate->GetCodeTracer());
400 PrintF(scope.file(), "[deoptimize marked code in all contexts]\n"); 404 PrintF(scope.file(), "[deoptimize marked code in all contexts]\n");
401 } 405 }
402 DisallowHeapAllocation no_allocation; 406 DisallowHeapAllocation no_allocation;
403 // For all contexts, deoptimize code already marked. 407 // For all contexts, deoptimize code already marked.
404 Object* context = isolate->heap()->native_contexts_list(); 408 Object* context = isolate->heap()->native_contexts_list();
405 while (!context->IsUndefined()) { 409 while (!context->IsUndefined()) {
406 Context* native_context = Context::cast(context); 410 Context* native_context = Context::cast(context);
407 DeoptimizeMarkedCodeForContext(native_context); 411 DeoptimizeMarkedCodeForContext(native_context);
408 context = native_context->next_context_link(); 412 context = native_context->next_context_link();
409 } 413 }
410 } 414 }
411 415
412 416
413 void Deoptimizer::MarkAllCodeForContext(Context* context) { 417 void Deoptimizer::MarkAllCodeForContext(Context* context) {
414 Object* element = context->OptimizedCodeListHead(); 418 Object* element = context->OptimizedCodeListHead();
415 while (!element->IsUndefined()) { 419 while (!element->IsUndefined()) {
416 Code* code = Code::cast(element); 420 Code* code = Code::cast(element);
417 CHECK_EQ(code->kind(), Code::OPTIMIZED_FUNCTION); 421 CHECK_EQ(code->kind(), Code::OPTIMIZED_FUNCTION);
418 code->set_marked_for_deoptimization(true); 422 code->set_marked_for_deoptimization(true);
419 element = code->next_code_link(); 423 element = code->next_code_link();
420 } 424 }
421 } 425 }
422 426
423 427
424 void Deoptimizer::DeoptimizeFunction(JSFunction* function) { 428 void Deoptimizer::DeoptimizeFunction(JSFunction* function) {
425 TimerEventScope<TimerEventDeoptimizeCode> timer(function->GetIsolate()); 429 Isolate* isolate = function->GetIsolate();
430 RuntimeCallTimerScope runtimeTimer(isolate,
431 &RuntimeCallStats::DeoptimizeCode);
432 TimerEventScope<TimerEventDeoptimizeCode> timer(isolate);
426 TRACE_EVENT0("v8", "V8.DeoptimizeCode"); 433 TRACE_EVENT0("v8", "V8.DeoptimizeCode");
427 Code* code = function->code(); 434 Code* code = function->code();
428 if (code->kind() == Code::OPTIMIZED_FUNCTION) { 435 if (code->kind() == Code::OPTIMIZED_FUNCTION) {
429 // Mark the code for deoptimization and unlink any functions that also 436 // Mark the code for deoptimization and unlink any functions that also
430 // refer to that code. The code cannot be shared across native contexts, 437 // refer to that code. The code cannot be shared across native contexts,
431 // so we only need to search one. 438 // so we only need to search one.
432 code->set_marked_for_deoptimization(true); 439 code->set_marked_for_deoptimization(true);
433 DeoptimizeMarkedCodeForContext(function->context()->native_context()); 440 DeoptimizeMarkedCodeForContext(function->context()->native_context());
434 } 441 }
435 } 442 }
(...skipping 3487 matching lines...) Expand 10 before | Expand all | Expand 10 after
3923 CHECK(value_info->IsMaterializedObject()); 3930 CHECK(value_info->IsMaterializedObject());
3924 3931
3925 value_info->value_ = 3932 value_info->value_ =
3926 Handle<Object>(previously_materialized_objects->get(i), isolate_); 3933 Handle<Object>(previously_materialized_objects->get(i), isolate_);
3927 } 3934 }
3928 } 3935 }
3929 } 3936 }
3930 3937
3931 } // namespace internal 3938 } // namespace internal
3932 } // namespace v8 3939 } // namespace v8
OLDNEW
« no previous file with comments | « src/counters.cc ('k') | src/execution.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698