Chromium Code Reviews| 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 ((tag == CodeEventListener::FUNCTION_TAG || |
| 19 tag == CodeEventListener::LAZY_COMPILE_TAG || | |
| 20 tag == CodeEventListener::SCRIPT_TAG) && | |
| 19 script->type() == Script::TYPE_NATIVE) { | 21 script->type() == Script::TYPE_NATIVE) { |
| 20 switch (tag) { | 22 switch (tag) { |
|
Yang
2016/06/14 13:38:12
why don't we simplify this to
if (script->type()
alph
2016/06/14 16:38:20
Done.
| |
| 21 case FUNCTION_TAG: return NATIVE_FUNCTION_TAG; | 23 case CodeEventListener::FUNCTION_TAG: |
| 22 case LAZY_COMPILE_TAG: return NATIVE_LAZY_COMPILE_TAG; | 24 return CodeEventListener::NATIVE_FUNCTION_TAG; |
| 23 case SCRIPT_TAG: return NATIVE_SCRIPT_TAG; | 25 case CodeEventListener::LAZY_COMPILE_TAG: |
| 26 return CodeEventListener::NATIVE_LAZY_COMPILE_TAG; | |
| 27 case CodeEventListener::SCRIPT_TAG: | |
| 28 return CodeEventListener::NATIVE_SCRIPT_TAG; | |
| 24 default: return tag; | 29 default: return tag; |
| 25 } | 30 } |
| 26 } else { | 31 } else { |
| 27 return tag; | 32 return tag; |
| 28 } | 33 } |
| 29 } | 34 } |
| 30 | 35 |
| 31 | |
| 32 void Logger::CallEventLogger(Isolate* isolate, const char* name, StartEnd se, | 36 void Logger::CallEventLogger(Isolate* isolate, const char* name, StartEnd se, |
| 33 bool expose_to_api) { | 37 bool expose_to_api) { |
| 34 if (isolate->event_logger() != NULL) { | 38 if (isolate->event_logger()) { |
| 35 if (isolate->event_logger() == DefaultEventLoggerSentinel) { | 39 if (isolate->event_logger() == DefaultEventLoggerSentinel) { |
| 36 LOG(isolate, TimerEvent(se, name)); | 40 LOG(isolate, TimerEvent(se, name)); |
| 37 } else if (expose_to_api) { | 41 } else if (expose_to_api) { |
| 38 isolate->event_logger()(name, se); | 42 isolate->event_logger()(name, se); |
| 39 } | 43 } |
| 40 } | 44 } |
| 41 } | 45 } |
| 46 | |
| 42 } // namespace internal | 47 } // namespace internal |
| 43 } // namespace v8 | 48 } // namespace v8 |
| 44 | 49 |
| 45 #endif // V8_LOG_INL_H_ | 50 #endif // V8_LOG_INL_H_ |
| OLD | NEW |