| 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 <stdarg.h> | 5 #include <stdarg.h> |
| 6 | 6 |
| 7 #include "v8.h" | 7 #include "v8.h" |
| 8 | 8 |
| 9 #include "bootstrapper.h" | 9 #include "bootstrapper.h" |
| 10 #include "code-stubs.h" | 10 #include "code-stubs.h" |
| (...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1171 void Logger::RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache) { | 1171 void Logger::RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache) { |
| 1172 if (!log_->IsEnabled() || !FLAG_log_regexp) return; | 1172 if (!log_->IsEnabled() || !FLAG_log_regexp) return; |
| 1173 Log::MessageBuilder msg(log_); | 1173 Log::MessageBuilder msg(log_); |
| 1174 msg.Append("regexp-compile,"); | 1174 msg.Append("regexp-compile,"); |
| 1175 LogRegExpSource(regexp); | 1175 LogRegExpSource(regexp); |
| 1176 msg.Append(in_cache ? ",hit\n" : ",miss\n"); | 1176 msg.Append(in_cache ? ",hit\n" : ",miss\n"); |
| 1177 msg.WriteToLogFile(); | 1177 msg.WriteToLogFile(); |
| 1178 } | 1178 } |
| 1179 | 1179 |
| 1180 | 1180 |
| 1181 void Logger::LogRuntime(Vector<const char> format, | |
| 1182 Handle<JSArray> args) { | |
| 1183 if (!log_->IsEnabled() || !FLAG_log_runtime) return; | |
| 1184 Log::MessageBuilder msg(log_); | |
| 1185 for (int i = 0; i < format.length(); i++) { | |
| 1186 char c = format[i]; | |
| 1187 if (c == '%' && i <= format.length() - 2) { | |
| 1188 i++; | |
| 1189 ASSERT('0' <= format[i] && format[i] <= '9'); | |
| 1190 // No exception expected when getting an element from an array literal. | |
| 1191 Handle<Object> obj = Object::GetElement( | |
| 1192 isolate_, args, format[i] - '0').ToHandleChecked(); | |
| 1193 i++; | |
| 1194 switch (format[i]) { | |
| 1195 case 's': | |
| 1196 msg.AppendDetailed(String::cast(*obj), false); | |
| 1197 break; | |
| 1198 case 'S': | |
| 1199 msg.AppendDetailed(String::cast(*obj), true); | |
| 1200 break; | |
| 1201 case 'r': | |
| 1202 Logger::LogRegExpSource(Handle<JSRegExp>::cast(obj)); | |
| 1203 break; | |
| 1204 case 'x': | |
| 1205 msg.Append("0x%x", Smi::cast(*obj)->value()); | |
| 1206 break; | |
| 1207 case 'i': | |
| 1208 msg.Append("%i", Smi::cast(*obj)->value()); | |
| 1209 break; | |
| 1210 default: | |
| 1211 UNREACHABLE(); | |
| 1212 } | |
| 1213 } else { | |
| 1214 msg.Append(c); | |
| 1215 } | |
| 1216 } | |
| 1217 msg.Append('\n'); | |
| 1218 msg.WriteToLogFile(); | |
| 1219 } | |
| 1220 | |
| 1221 | |
| 1222 void Logger::ApiIndexedSecurityCheck(uint32_t index) { | 1181 void Logger::ApiIndexedSecurityCheck(uint32_t index) { |
| 1223 if (!log_->IsEnabled() || !FLAG_log_api) return; | 1182 if (!log_->IsEnabled() || !FLAG_log_api) return; |
| 1224 ApiEvent("api,check-security,%u\n", index); | 1183 ApiEvent("api,check-security,%u\n", index); |
| 1225 } | 1184 } |
| 1226 | 1185 |
| 1227 | 1186 |
| 1228 void Logger::ApiNamedPropertyAccess(const char* tag, | 1187 void Logger::ApiNamedPropertyAccess(const char* tag, |
| 1229 JSObject* holder, | 1188 JSObject* holder, |
| 1230 Object* name) { | 1189 Object* name) { |
| 1231 ASSERT(name->IsName()); | 1190 ASSERT(name->IsName()); |
| (...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2140 if (jit_logger_) { | 2099 if (jit_logger_) { |
| 2141 removeCodeEventListener(jit_logger_); | 2100 removeCodeEventListener(jit_logger_); |
| 2142 delete jit_logger_; | 2101 delete jit_logger_; |
| 2143 jit_logger_ = NULL; | 2102 jit_logger_ = NULL; |
| 2144 } | 2103 } |
| 2145 | 2104 |
| 2146 return log_->Close(); | 2105 return log_->Close(); |
| 2147 } | 2106 } |
| 2148 | 2107 |
| 2149 } } // namespace v8::internal | 2108 } } // namespace v8::internal |
| OLD | NEW |