• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2006-2009 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_LOGGING_LOG_INL_H_
6 #define V8_LOGGING_LOG_INL_H_
7 
8 #include "src/execution/isolate.h"
9 #include "src/logging/log.h"
10 #include "src/objects/objects-inl.h"
11 #include "src/tracing/trace-event.h"
12 
13 namespace v8 {
14 namespace internal {
15 
ToNativeByScript(CodeEventListener::LogEventsAndTags tag,Script script)16 CodeEventListener::LogEventsAndTags Logger::ToNativeByScript(
17     CodeEventListener::LogEventsAndTags tag, Script script) {
18   if (script.type() != Script::TYPE_NATIVE) return tag;
19   switch (tag) {
20     case CodeEventListener::FUNCTION_TAG:
21       return CodeEventListener::NATIVE_FUNCTION_TAG;
22     case CodeEventListener::LAZY_COMPILE_TAG:
23       return CodeEventListener::NATIVE_LAZY_COMPILE_TAG;
24     case CodeEventListener::SCRIPT_TAG:
25       return CodeEventListener::NATIVE_SCRIPT_TAG;
26     default:
27       return tag;
28   }
29 }
30 
31 template <class TimerEvent>
LogTimerEvent(v8::LogEventStatus se)32 void TimerEventScope<TimerEvent>::LogTimerEvent(v8::LogEventStatus se) {
33   Logger::CallEventLogger(isolate_, TimerEvent::name(), se,
34                           TimerEvent::expose_to_api());
35 }
36 
37 }  // namespace internal
38 }  // namespace v8
39 
40 #endif  // V8_LOGGING_LOG_INL_H_
41