| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_LOG_INL_H_ | 5 #ifndef V8_LOG_INL_H_ |
| 6 #define V8_LOG_INL_H_ | 6 #define V8_LOG_INL_H_ |
| 7 | 7 |
| 8 #include "src/log.h" | 8 #include "src/log.h" |
| 9 #include "src/isolate.h" | 9 #include "src/isolate.h" |
| 10 #include "src/objects-inl.h" | 10 #include "src/objects-inl.h" |
| 11 #include "src/tracing/trace-event.h" | 11 #include "src/tracing/trace-event.h" |
| 12 | 12 |
| 13 namespace v8 { | 13 namespace v8 { |
| 14 namespace internal { | 14 namespace internal { |
| 15 | 15 |
| 16 Logger::LogEventsAndTags Logger::ToNativeByScript(Logger::LogEventsAndTags tag, | 16 CodeEventListener::LogEventsAndTags Logger::ToNativeByScript( |
| 17 Script* script) { | 17 CodeEventListener::LogEventsAndTags tag, Script* script) { |
| 18 if ((tag == FUNCTION_TAG || tag == LAZY_COMPILE_TAG || tag == SCRIPT_TAG) && | 18 if (script->type() != Script::TYPE_NATIVE) return tag; |
| 19 script->type() == Script::TYPE_NATIVE) { | 19 switch (tag) { |
| 20 switch (tag) { | 20 case CodeEventListener::FUNCTION_TAG: |
| 21 case FUNCTION_TAG: return NATIVE_FUNCTION_TAG; | 21 return CodeEventListener::NATIVE_FUNCTION_TAG; |
| 22 case LAZY_COMPILE_TAG: return NATIVE_LAZY_COMPILE_TAG; | 22 case CodeEventListener::LAZY_COMPILE_TAG: |
| 23 case SCRIPT_TAG: return NATIVE_SCRIPT_TAG; | 23 return CodeEventListener::NATIVE_LAZY_COMPILE_TAG; |
| 24 default: return tag; | 24 case CodeEventListener::SCRIPT_TAG: |
| 25 } | 25 return CodeEventListener::NATIVE_SCRIPT_TAG; |
| 26 } else { | 26 default: |
| 27 return tag; | 27 return tag; |
| 28 } | 28 } |
| 29 } | 29 } |
| 30 | 30 |
| 31 | |
| 32 void Logger::CallEventLogger(Isolate* isolate, const char* name, StartEnd se, | 31 void Logger::CallEventLogger(Isolate* isolate, const char* name, StartEnd se, |
| 33 bool expose_to_api) { | 32 bool expose_to_api) { |
| 34 if (isolate->event_logger() != NULL) { | 33 if (isolate->event_logger()) { |
| 35 if (isolate->event_logger() == DefaultEventLoggerSentinel) { | 34 if (isolate->event_logger() == DefaultEventLoggerSentinel) { |
| 36 LOG(isolate, TimerEvent(se, name)); | 35 LOG(isolate, TimerEvent(se, name)); |
| 37 } else if (expose_to_api) { | 36 } else if (expose_to_api) { |
| 38 isolate->event_logger()(name, se); | 37 isolate->event_logger()(name, se); |
| 39 } | 38 } |
| 40 } | 39 } |
| 41 } | 40 } |
| 41 |
| 42 } // namespace internal | 42 } // namespace internal |
| 43 } // namespace v8 | 43 } // namespace v8 |
| 44 | 44 |
| 45 #endif // V8_LOG_INL_H_ | 45 #endif // V8_LOG_INL_H_ |
| OLD | NEW |