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

Side by Side Diff: src/deoptimizer.cc

Issue 2187693002: [Tracing] Embed V8 runtime call stats into tracing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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 <memory> 7 #include <memory>
8 8
9 #include "src/accessors.h" 9 #include "src/accessors.h"
10 #include "src/ast/prettyprinter.h" 10 #include "src/ast/prettyprinter.h"
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 // ignore all slots that might have been recorded on it. 365 // ignore all slots that might have been recorded on it.
366 isolate->heap()->mark_compact_collector()->InvalidateCode(codes[i]); 366 isolate->heap()->mark_compact_collector()->InvalidateCode(codes[i]);
367 } 367 }
368 } 368 }
369 369
370 370
371 void Deoptimizer::DeoptimizeAll(Isolate* isolate) { 371 void Deoptimizer::DeoptimizeAll(Isolate* isolate) {
372 RuntimeCallTimerScope runtimeTimer(isolate, 372 RuntimeCallTimerScope runtimeTimer(isolate,
373 &RuntimeCallStats::DeoptimizeCode); 373 &RuntimeCallStats::DeoptimizeCode);
374 TimerEventScope<TimerEventDeoptimizeCode> timer(isolate); 374 TimerEventScope<TimerEventDeoptimizeCode> timer(isolate);
375 TRACE_EVENT0("v8", "V8.DeoptimizeCode"); 375 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
376 isolate, &tracing::TraceEventStatsTable::DeoptimizeCode);
376 if (FLAG_trace_deopt) { 377 if (FLAG_trace_deopt) {
377 CodeTracer::Scope scope(isolate->GetCodeTracer()); 378 CodeTracer::Scope scope(isolate->GetCodeTracer());
378 PrintF(scope.file(), "[deoptimize all code in all contexts]\n"); 379 PrintF(scope.file(), "[deoptimize all code in all contexts]\n");
379 } 380 }
380 DisallowHeapAllocation no_allocation; 381 DisallowHeapAllocation no_allocation;
381 // For all contexts, mark all code, then deoptimize. 382 // For all contexts, mark all code, then deoptimize.
382 Object* context = isolate->heap()->native_contexts_list(); 383 Object* context = isolate->heap()->native_contexts_list();
383 while (!context->IsUndefined(isolate)) { 384 while (!context->IsUndefined(isolate)) {
384 Context* native_context = Context::cast(context); 385 Context* native_context = Context::cast(context);
385 MarkAllCodeForContext(native_context); 386 MarkAllCodeForContext(native_context);
386 DeoptimizeMarkedCodeForContext(native_context); 387 DeoptimizeMarkedCodeForContext(native_context);
387 context = native_context->next_context_link(); 388 context = native_context->next_context_link();
388 } 389 }
389 } 390 }
390 391
391 392
392 void Deoptimizer::DeoptimizeMarkedCode(Isolate* isolate) { 393 void Deoptimizer::DeoptimizeMarkedCode(Isolate* isolate) {
393 RuntimeCallTimerScope runtimeTimer(isolate, 394 RuntimeCallTimerScope runtimeTimer(isolate,
394 &RuntimeCallStats::DeoptimizeCode); 395 &RuntimeCallStats::DeoptimizeCode);
395 TimerEventScope<TimerEventDeoptimizeCode> timer(isolate); 396 TimerEventScope<TimerEventDeoptimizeCode> timer(isolate);
396 TRACE_EVENT0("v8", "V8.DeoptimizeCode"); 397 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
398 isolate, &tracing::TraceEventStatsTable::DeoptimizeCode);
397 if (FLAG_trace_deopt) { 399 if (FLAG_trace_deopt) {
398 CodeTracer::Scope scope(isolate->GetCodeTracer()); 400 CodeTracer::Scope scope(isolate->GetCodeTracer());
399 PrintF(scope.file(), "[deoptimize marked code in all contexts]\n"); 401 PrintF(scope.file(), "[deoptimize marked code in all contexts]\n");
400 } 402 }
401 DisallowHeapAllocation no_allocation; 403 DisallowHeapAllocation no_allocation;
402 // For all contexts, deoptimize code already marked. 404 // For all contexts, deoptimize code already marked.
403 Object* context = isolate->heap()->native_contexts_list(); 405 Object* context = isolate->heap()->native_contexts_list();
404 while (!context->IsUndefined(isolate)) { 406 while (!context->IsUndefined(isolate)) {
405 Context* native_context = Context::cast(context); 407 Context* native_context = Context::cast(context);
406 DeoptimizeMarkedCodeForContext(native_context); 408 DeoptimizeMarkedCodeForContext(native_context);
(...skipping 12 matching lines...) Expand all
419 element = code->next_code_link(); 421 element = code->next_code_link();
420 } 422 }
421 } 423 }
422 424
423 425
424 void Deoptimizer::DeoptimizeFunction(JSFunction* function) { 426 void Deoptimizer::DeoptimizeFunction(JSFunction* function) {
425 Isolate* isolate = function->GetIsolate(); 427 Isolate* isolate = function->GetIsolate();
426 RuntimeCallTimerScope runtimeTimer(isolate, 428 RuntimeCallTimerScope runtimeTimer(isolate,
427 &RuntimeCallStats::DeoptimizeCode); 429 &RuntimeCallStats::DeoptimizeCode);
428 TimerEventScope<TimerEventDeoptimizeCode> timer(isolate); 430 TimerEventScope<TimerEventDeoptimizeCode> timer(isolate);
429 TRACE_EVENT0("v8", "V8.DeoptimizeCode"); 431 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
432 isolate, &tracing::TraceEventStatsTable::DeoptimizeCode);
430 Code* code = function->code(); 433 Code* code = function->code();
431 if (code->kind() == Code::OPTIMIZED_FUNCTION) { 434 if (code->kind() == Code::OPTIMIZED_FUNCTION) {
432 // Mark the code for deoptimization and unlink any functions that also 435 // Mark the code for deoptimization and unlink any functions that also
433 // refer to that code. The code cannot be shared across native contexts, 436 // refer to that code. The code cannot be shared across native contexts,
434 // so we only need to search one. 437 // so we only need to search one.
435 code->set_marked_for_deoptimization(true); 438 code->set_marked_for_deoptimization(true);
436 DeoptimizeMarkedCodeForContext(function->context()->native_context()); 439 DeoptimizeMarkedCodeForContext(function->context()->native_context());
437 } 440 }
438 } 441 }
439 442
(...skipping 3558 matching lines...) Expand 10 before | Expand all | Expand 10 after
3998 CHECK(value_info->IsMaterializedObject()); 4001 CHECK(value_info->IsMaterializedObject());
3999 4002
4000 value_info->value_ = 4003 value_info->value_ =
4001 Handle<Object>(previously_materialized_objects->get(i), isolate_); 4004 Handle<Object>(previously_materialized_objects->get(i), isolate_);
4002 } 4005 }
4003 } 4006 }
4004 } 4007 }
4005 4008
4006 } // namespace internal 4009 } // namespace internal
4007 } // namespace v8 4010 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698