[presubmit] Enable readability/namespace linter checking.
[platform/upstream/v8.git] / src / log-inl.h
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_LOG_INL_H_
6 #define V8_LOG_INL_H_
7
8 #include "src/log.h"
9 #include "src/isolate.h"
10 #include "src/objects-inl.h"
11
12 namespace v8 {
13 namespace internal {
14
15 Logger::LogEventsAndTags Logger::ToNativeByScript(Logger::LogEventsAndTags tag,
16                                                   Script* script) {
17   if ((tag == FUNCTION_TAG || tag == LAZY_COMPILE_TAG || tag == SCRIPT_TAG) &&
18       script->type() == Script::TYPE_NATIVE) {
19     switch (tag) {
20       case FUNCTION_TAG: return NATIVE_FUNCTION_TAG;
21       case LAZY_COMPILE_TAG: return NATIVE_LAZY_COMPILE_TAG;
22       case SCRIPT_TAG: return NATIVE_SCRIPT_TAG;
23       default: return tag;
24     }
25   } else {
26     return tag;
27   }
28 }
29
30
31 void Logger::CallEventLogger(Isolate* isolate, const char* name, StartEnd se,
32                              bool expose_to_api) {
33   if (isolate->event_logger() != NULL) {
34     if (isolate->event_logger() == DefaultEventLoggerSentinel) {
35       LOG(isolate, TimerEvent(se, name));
36     } else if (expose_to_api) {
37       isolate->event_logger()(name, se);
38     }
39   }
40 }
41 }  // namespace internal
42 }  // namespace v8
43
44 #endif  // V8_LOG_INL_H_