Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 1 | // Copyright 2006-2009 the V8 project authors. All rights reserved. |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 4 | |
| 5 | #ifndef V8_LOG_INL_H_ |
| 6 | #define V8_LOG_INL_H_ |
| 7 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 8 | #include "src/log.h" |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame^] | 9 | #include "src/isolate.h" |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 10 | |
| 11 | namespace v8 { |
| 12 | namespace internal { |
| 13 | |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 14 | Logger::LogEventsAndTags Logger::ToNativeByScript(Logger::LogEventsAndTags tag, |
| 15 | Script* script) { |
| 16 | if ((tag == FUNCTION_TAG || tag == LAZY_COMPILE_TAG || tag == SCRIPT_TAG) |
| 17 | && script->type()->value() == Script::TYPE_NATIVE) { |
| 18 | switch (tag) { |
| 19 | case FUNCTION_TAG: return NATIVE_FUNCTION_TAG; |
| 20 | case LAZY_COMPILE_TAG: return NATIVE_LAZY_COMPILE_TAG; |
| 21 | case SCRIPT_TAG: return NATIVE_SCRIPT_TAG; |
| 22 | default: return tag; |
| 23 | } |
| 24 | } else { |
| 25 | return tag; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 26 | } |
| 27 | } |
| 28 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 29 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame^] | 30 | void Logger::CallEventLogger(Isolate* isolate, const char* name, StartEnd se, |
| 31 | bool expose_to_api) { |
| 32 | if (isolate->event_logger() != NULL) { |
| 33 | if (isolate->event_logger() == DefaultEventLoggerSentinel) { |
| 34 | LOG(isolate, TimerEvent(se, name)); |
| 35 | } else if (expose_to_api) { |
| 36 | isolate->event_logger()(name, se); |
| 37 | } |
| 38 | } |
| 39 | } |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 40 | } } // namespace v8::internal |
| 41 | |
| 42 | #endif // V8_LOG_INL_H_ |