void Isolate::SetEventLogger(LogEventCallback that) {
// Do not overwrite the event logger if we want to log explicitly.
- if (i::FLAG_log_timer_events) return;
+ if (i::FLAG_log_internal_timer_events) return;
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
isolate->set_event_logger(that);
}
#include "src/base/platform/platform.h"
#include "src/counters.h"
#include "src/isolate.h"
+#include "src/log-inl.h"
namespace v8 {
namespace internal {
if (Enabled()) {
timer_.Start();
}
- isolate()->event_logger()(name(), Logger::START);
+ Logger::CallEventLogger(isolate(), name(), Logger::START, true);
}
AddSample(static_cast<int>(timer_.Elapsed().InMilliseconds()));
timer_.Stop();
}
- isolate()->event_logger()(name(), Logger::END);
+ Logger::CallEventLogger(isolate(), name(), Logger::END, true);
}
bootstrapper_->Initialize(create_heap_objects);
builtins_.SetUp(this, create_heap_objects);
- if (FLAG_log_internal_timer_events) {
- set_event_logger(Logger::DefaultTimerEventsLogger);
- } else {
- set_event_logger(Logger::EmptyTimerEventsLogger);
- }
-
// Set default value if not yet set.
// TODO(yangguo): move this to ResourceConstraints::ConfigureDefaults
// once ResourceConstraints becomes an argument to the Isolate constructor.
#define V8_LOG_INL_H_
#include "src/log.h"
+#include "src/isolate.h"
namespace v8 {
namespace internal {
}
+void Logger::CallEventLogger(Isolate* isolate, const char* name, StartEnd se,
+ bool expose_to_api) {
+ if (isolate->event_logger() == NULL) {
+ if (FLAG_log_internal_timer_events) LOG(isolate, TimerEvent(se, name));
+ } else if (expose_to_api) {
+ isolate->event_logger()(name, se);
+ }
+}
} } // namespace v8::internal
#endif // V8_LOG_INL_H_
#include "src/cpu-profiler.h"
#include "src/deoptimizer.h"
#include "src/global-handles.h"
+#include "src/log-inl.h"
#include "src/log-utils.h"
#include "src/macro-assembler.h"
#include "src/perf-jit.h"
}
-void Logger::DefaultTimerEventsLogger(const char* name, int se) {
- Isolate* isolate = Isolate::Current();
- LOG(isolate, TimerEvent(static_cast<StartEnd>(se), name));
-}
-
-
template <class TimerEvent>
void TimerEventScope<TimerEvent>::LogTimerEvent(Logger::StartEnd se) {
- if (TimerEvent::expose_to_api() ||
- isolate_->event_logger() == Logger::DefaultTimerEventsLogger) {
- isolate_->event_logger()(TimerEvent::name(), se);
- }
+ Logger::CallEventLogger(isolate_, TimerEvent::name(), se,
+ TimerEvent::expose_to_api());
}
static void EnterExternal(Isolate* isolate);
static void LeaveExternal(Isolate* isolate);
- static void EmptyTimerEventsLogger(const char* name, int se) {}
- static void DefaultTimerEventsLogger(const char* name, int se);
+ static inline void CallEventLogger(Isolate* isolate, const char* name,
+ StartEnd se, bool expose_to_api);
// ==== Events logged by --log-regexp ====
// Regexp compilation and execution events.