OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 #include "src/log.h" | 5 #include "src/log.h" |
6 | 6 |
7 #include <cstdarg> | 7 #include <cstdarg> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/v8.h" | 10 #include "src/v8.h" |
11 | 11 |
12 #include "src/bailout-reason.h" | 12 #include "src/bailout-reason.h" |
13 #include "src/base/platform/platform.h" | 13 #include "src/base/platform/platform.h" |
14 #include "src/bootstrapper.h" | 14 #include "src/bootstrapper.h" |
15 #include "src/code-stubs.h" | 15 #include "src/code-stubs.h" |
16 #include "src/cpu-profiler.h" | 16 #include "src/cpu-profiler.h" |
17 #include "src/deoptimizer.h" | 17 #include "src/deoptimizer.h" |
18 #include "src/global-handles.h" | 18 #include "src/global-handles.h" |
| 19 #include "src/log-inl.h" |
19 #include "src/log-utils.h" | 20 #include "src/log-utils.h" |
20 #include "src/macro-assembler.h" | 21 #include "src/macro-assembler.h" |
21 #include "src/perf-jit.h" | 22 #include "src/perf-jit.h" |
22 #include "src/runtime-profiler.h" | 23 #include "src/runtime-profiler.h" |
23 #include "src/serialize.h" | 24 #include "src/serialize.h" |
24 #include "src/string-stream.h" | 25 #include "src/string-stream.h" |
25 #include "src/vm-state-inl.h" | 26 #include "src/vm-state-inl.h" |
26 | 27 |
27 namespace v8 { | 28 namespace v8 { |
28 namespace internal { | 29 namespace internal { |
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 } | 948 } |
948 | 949 |
949 | 950 |
950 void Logger::LeaveExternal(Isolate* isolate) { | 951 void Logger::LeaveExternal(Isolate* isolate) { |
951 LOG(isolate, TimerEvent(END, TimerEventExternal::name())); | 952 LOG(isolate, TimerEvent(END, TimerEventExternal::name())); |
952 DCHECK(isolate->current_vm_state() == EXTERNAL); | 953 DCHECK(isolate->current_vm_state() == EXTERNAL); |
953 isolate->set_current_vm_state(JS); | 954 isolate->set_current_vm_state(JS); |
954 } | 955 } |
955 | 956 |
956 | 957 |
957 void Logger::DefaultTimerEventsLogger(const char* name, int se) { | |
958 Isolate* isolate = Isolate::Current(); | |
959 LOG(isolate, TimerEvent(static_cast<StartEnd>(se), name)); | |
960 } | |
961 | |
962 | |
963 template <class TimerEvent> | 958 template <class TimerEvent> |
964 void TimerEventScope<TimerEvent>::LogTimerEvent(Logger::StartEnd se) { | 959 void TimerEventScope<TimerEvent>::LogTimerEvent(Logger::StartEnd se) { |
965 if (TimerEvent::expose_to_api() || | 960 Logger::CallEventLogger(isolate_, TimerEvent::name(), se, |
966 isolate_->event_logger() == Logger::DefaultTimerEventsLogger) { | 961 TimerEvent::expose_to_api()); |
967 isolate_->event_logger()(TimerEvent::name(), se); | |
968 } | |
969 } | 962 } |
970 | 963 |
971 | 964 |
972 // Instantiate template methods. | 965 // Instantiate template methods. |
973 #define V(TimerName, expose) \ | 966 #define V(TimerName, expose) \ |
974 template void TimerEventScope<TimerEvent##TimerName>::LogTimerEvent( \ | 967 template void TimerEventScope<TimerEvent##TimerName>::LogTimerEvent( \ |
975 Logger::StartEnd se); | 968 Logger::StartEnd se); |
976 TIMER_EVENTS_LIST(V) | 969 TIMER_EVENTS_LIST(V) |
977 #undef V | 970 #undef V |
978 | 971 |
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1938 if (jit_logger_) { | 1931 if (jit_logger_) { |
1939 removeCodeEventListener(jit_logger_); | 1932 removeCodeEventListener(jit_logger_); |
1940 delete jit_logger_; | 1933 delete jit_logger_; |
1941 jit_logger_ = NULL; | 1934 jit_logger_ = NULL; |
1942 } | 1935 } |
1943 | 1936 |
1944 return log_->Close(); | 1937 return log_->Close(); |
1945 } | 1938 } |
1946 | 1939 |
1947 } } // namespace v8::internal | 1940 } } // namespace v8::internal |
OLD | NEW |