11cb0ef41Sopenharmony_ci// Copyright 2006-2009 the V8 project authors. All rights reserved.
21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
31cb0ef41Sopenharmony_ci// found in the LICENSE file.
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci#ifndef V8_LOGGING_LOG_INL_H_
61cb0ef41Sopenharmony_ci#define V8_LOGGING_LOG_INL_H_
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ci#include "src/execution/isolate.h"
91cb0ef41Sopenharmony_ci#include "src/logging/log.h"
101cb0ef41Sopenharmony_ci#include "src/objects/objects-inl.h"
111cb0ef41Sopenharmony_ci#include "src/tracing/trace-event.h"
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_cinamespace v8 {
141cb0ef41Sopenharmony_cinamespace internal {
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ciCodeEventListener::LogEventsAndTags Logger::ToNativeByScript(
171cb0ef41Sopenharmony_ci    CodeEventListener::LogEventsAndTags tag, Script script) {
181cb0ef41Sopenharmony_ci  if (script.type() != Script::TYPE_NATIVE) return tag;
191cb0ef41Sopenharmony_ci  switch (tag) {
201cb0ef41Sopenharmony_ci    case CodeEventListener::FUNCTION_TAG:
211cb0ef41Sopenharmony_ci      return CodeEventListener::NATIVE_FUNCTION_TAG;
221cb0ef41Sopenharmony_ci    case CodeEventListener::LAZY_COMPILE_TAG:
231cb0ef41Sopenharmony_ci      return CodeEventListener::NATIVE_LAZY_COMPILE_TAG;
241cb0ef41Sopenharmony_ci    case CodeEventListener::SCRIPT_TAG:
251cb0ef41Sopenharmony_ci      return CodeEventListener::NATIVE_SCRIPT_TAG;
261cb0ef41Sopenharmony_ci    default:
271cb0ef41Sopenharmony_ci      return tag;
281cb0ef41Sopenharmony_ci  }
291cb0ef41Sopenharmony_ci}
301cb0ef41Sopenharmony_ci
311cb0ef41Sopenharmony_citemplate <class TimerEvent>
321cb0ef41Sopenharmony_civoid TimerEventScope<TimerEvent>::LogTimerEvent(v8::LogEventStatus se) {
331cb0ef41Sopenharmony_ci  Logger::CallEventLogger(isolate_, TimerEvent::name(), se,
341cb0ef41Sopenharmony_ci                          TimerEvent::expose_to_api());
351cb0ef41Sopenharmony_ci}
361cb0ef41Sopenharmony_ci
371cb0ef41Sopenharmony_ci}  // namespace internal
381cb0ef41Sopenharmony_ci}  // namespace v8
391cb0ef41Sopenharmony_ci
401cb0ef41Sopenharmony_ci#endif  // V8_LOGGING_LOG_INL_H_
41