From 949734f73adf824a5290e15a985e653c2246abb6 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Mon, 30 Oct 2017 14:18:12 +0100 Subject: [PATCH] [log] Support logging basic function events This CL contains the base implementation for logging function events. Currently only compiler events are support (compile, compile-lazy...), future CLs will enable log events for parsing and first-time exeuction of functions. Bug: chromium:757467 Change-Id: Ia705979190a3ebc1009989610483a7a141bc504b Reviewed-on: https://chromium-review.googlesource.com/743921 Reviewed-by: Igor Sheludko Commit-Queue: Camillo Bruni Cr-Commit-Position: refs/heads/master@{#49040} --- src/compiler.cc | 103 +++++++++++++++++++++++++--------------- src/compiler.h | 2 + src/flag-definitions.h | 3 ++ src/log-utils.cc | 1 + src/log-utils.h | 3 +- src/log.cc | 44 +++++++++++++++++ src/log.h | 8 ++++ test/cctest/test-log.cc | 29 +++++++++++ 8 files changed, 155 insertions(+), 38 deletions(-) diff --git a/src/compiler.cc b/src/compiler.cc index 614a88ea93..d8d6ef90f4 100644 --- a/src/compiler.cc +++ b/src/compiler.cc @@ -179,43 +179,74 @@ void CompilationJob::RecordOptimizedCompilationStats() const { } } +void CompilationJob::RecordFunctionCompilation( + CodeEventListener::LogEventsAndTags tag) const { + // Log the code generation. If source information is available include + // script name and line number. Check explicitly whether logging is + // enabled as finding the line number is not free. + CompilationInfo* compilation_info = this->compilation_info(); + Isolate* isolate = compilation_info->isolate(); + if (!isolate->logger()->is_logging_code_events() && + !isolate->is_profiling() && !FLAG_log_function_events) { + return; + } + + Handle shared = compilation_info->shared_info(); + Handle