| 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" |
| (...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 | 946 |
| 947 | 947 |
| 948 // Instantiate template methods. | 948 // Instantiate template methods. |
| 949 #define V(TimerName, expose) \ | 949 #define V(TimerName, expose) \ |
| 950 template void TimerEventScope<TimerEvent##TimerName>::LogTimerEvent( \ | 950 template void TimerEventScope<TimerEvent##TimerName>::LogTimerEvent( \ |
| 951 Logger::StartEnd se); | 951 Logger::StartEnd se); |
| 952 TIMER_EVENTS_LIST(V) | 952 TIMER_EVENTS_LIST(V) |
| 953 #undef V | 953 #undef V |
| 954 | 954 |
| 955 | 955 |
| 956 void Logger::LogRegExpSource(Handle<JSRegExp> regexp) { | 956 void Logger::LogRegExpSource(Handle<JSRegExp> regexp, |
| 957 Log::MessageBuilder& msg) { |
| 957 // Prints "/" + re.source + "/" + | 958 // Prints "/" + re.source + "/" + |
| 958 // (re.global?"g":"") + (re.ignorecase?"i":"") + (re.multiline?"m":"") | 959 // (re.global?"g":"") + (re.ignorecase?"i":"") + (re.multiline?"m":"") |
| 959 Log::MessageBuilder msg(log_); | |
| 960 | 960 |
| 961 Handle<Object> source = Object::GetProperty( | 961 Handle<Object> source = Object::GetProperty( |
| 962 isolate_, regexp, "source").ToHandleChecked(); | 962 isolate_, regexp, "source").ToHandleChecked(); |
| 963 if (!source->IsString()) { | 963 if (!source->IsString()) { |
| 964 msg.Append("no source"); | 964 msg.Append("no source"); |
| 965 return; | 965 return; |
| 966 } | 966 } |
| 967 | 967 |
| 968 switch (regexp->TypeTag()) { | 968 switch (regexp->TypeTag()) { |
| 969 case JSRegExp::ATOM: | 969 case JSRegExp::ATOM: |
| (...skipping 17 matching lines...) Expand all Loading... |
| 987 isolate_, regexp, "ignoreCase").ToHandleChecked(); | 987 isolate_, regexp, "ignoreCase").ToHandleChecked(); |
| 988 if (ignorecase->IsTrue()) { | 988 if (ignorecase->IsTrue()) { |
| 989 msg.Append('i'); | 989 msg.Append('i'); |
| 990 } | 990 } |
| 991 // multiline flag | 991 // multiline flag |
| 992 Handle<Object> multiline = Object::GetProperty( | 992 Handle<Object> multiline = Object::GetProperty( |
| 993 isolate_, regexp, "multiline").ToHandleChecked(); | 993 isolate_, regexp, "multiline").ToHandleChecked(); |
| 994 if (multiline->IsTrue()) { | 994 if (multiline->IsTrue()) { |
| 995 msg.Append('m'); | 995 msg.Append('m'); |
| 996 } | 996 } |
| 997 | |
| 998 msg.WriteToLogFile(); | |
| 999 } | 997 } |
| 1000 | 998 |
| 1001 | 999 |
| 1002 void Logger::RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache) { | 1000 void Logger::RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache) { |
| 1003 if (!log_->IsEnabled() || !FLAG_log_regexp) return; | 1001 if (!log_->IsEnabled() || !FLAG_log_regexp) return; |
| 1004 Log::MessageBuilder msg(log_); | 1002 Log::MessageBuilder msg(log_); |
| 1005 msg.Append("regexp-compile,"); | 1003 msg.Append("regexp-compile,"); |
| 1006 LogRegExpSource(regexp); | 1004 LogRegExpSource(regexp, msg); |
| 1007 msg.Append(in_cache ? ",hit" : ",miss"); | 1005 msg.Append(in_cache ? ",hit" : ",miss"); |
| 1008 msg.WriteToLogFile(); | 1006 msg.WriteToLogFile(); |
| 1009 } | 1007 } |
| 1010 | 1008 |
| 1011 | 1009 |
| 1012 void Logger::ApiNamedPropertyAccess(const char* tag, | 1010 void Logger::ApiNamedPropertyAccess(const char* tag, |
| 1013 JSObject* holder, | 1011 JSObject* holder, |
| 1014 Object* name) { | 1012 Object* name) { |
| 1015 DCHECK(name->IsName()); | 1013 DCHECK(name->IsName()); |
| 1016 if (!log_->IsEnabled() || !FLAG_log_api) return; | 1014 if (!log_->IsEnabled() || !FLAG_log_api) return; |
| (...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1895 removeCodeEventListener(jit_logger_); | 1893 removeCodeEventListener(jit_logger_); |
| 1896 delete jit_logger_; | 1894 delete jit_logger_; |
| 1897 jit_logger_ = NULL; | 1895 jit_logger_ = NULL; |
| 1898 } | 1896 } |
| 1899 | 1897 |
| 1900 return log_->Close(); | 1898 return log_->Close(); |
| 1901 } | 1899 } |
| 1902 | 1900 |
| 1903 } // namespace internal | 1901 } // namespace internal |
| 1904 } // namespace v8 | 1902 } // namespace v8 |
| OLD | NEW |