Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: src/log.cc

Issue 157503002: A64: Synchronize with r18444. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/liveedit.cc ('k') | src/mark-compact.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 va_end(ap); 1034 va_end(ap);
1035 msg.WriteToLogFile(); 1035 msg.WriteToLogFile();
1036 } 1036 }
1037 1037
1038 1038
1039 void Logger::ApiNamedSecurityCheck(Object* key) { 1039 void Logger::ApiNamedSecurityCheck(Object* key) {
1040 if (!log_->IsEnabled() || !FLAG_log_api) return; 1040 if (!log_->IsEnabled() || !FLAG_log_api) return;
1041 if (key->IsString()) { 1041 if (key->IsString()) {
1042 SmartArrayPointer<char> str = 1042 SmartArrayPointer<char> str =
1043 String::cast(key)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); 1043 String::cast(key)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
1044 ApiEvent("api,check-security,\"%s\"\n", *str); 1044 ApiEvent("api,check-security,\"%s\"\n", str.get());
1045 } else if (key->IsSymbol()) { 1045 } else if (key->IsSymbol()) {
1046 Symbol* symbol = Symbol::cast(key); 1046 Symbol* symbol = Symbol::cast(key);
1047 if (symbol->name()->IsUndefined()) { 1047 if (symbol->name()->IsUndefined()) {
1048 ApiEvent("api,check-security,symbol(hash %x)\n", 1048 ApiEvent("api,check-security,symbol(hash %x)\n",
1049 Symbol::cast(key)->Hash()); 1049 Symbol::cast(key)->Hash());
1050 } else { 1050 } else {
1051 SmartArrayPointer<char> str = String::cast(symbol->name())->ToCString( 1051 SmartArrayPointer<char> str = String::cast(symbol->name())->ToCString(
1052 DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); 1052 DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
1053 ApiEvent("api,check-security,symbol(\"%s\" hash %x)\n", 1053 ApiEvent("api,check-security,symbol(\"%s\" hash %x)\n",
1054 *str, 1054 str.get(),
1055 Symbol::cast(key)->Hash()); 1055 Symbol::cast(key)->Hash());
1056 } 1056 }
1057 } else if (key->IsUndefined()) { 1057 } else if (key->IsUndefined()) {
1058 ApiEvent("api,check-security,undefined\n"); 1058 ApiEvent("api,check-security,undefined\n");
1059 } else { 1059 } else {
1060 ApiEvent("api,check-security,['no-name']\n"); 1060 ApiEvent("api,check-security,['no-name']\n");
1061 } 1061 }
1062 } 1062 }
1063 1063
1064 1064
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 JSObject* holder, 1246 JSObject* holder,
1247 Object* name) { 1247 Object* name) {
1248 ASSERT(name->IsName()); 1248 ASSERT(name->IsName());
1249 if (!log_->IsEnabled() || !FLAG_log_api) return; 1249 if (!log_->IsEnabled() || !FLAG_log_api) return;
1250 String* class_name_obj = holder->class_name(); 1250 String* class_name_obj = holder->class_name();
1251 SmartArrayPointer<char> class_name = 1251 SmartArrayPointer<char> class_name =
1252 class_name_obj->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); 1252 class_name_obj->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
1253 if (name->IsString()) { 1253 if (name->IsString()) {
1254 SmartArrayPointer<char> property_name = 1254 SmartArrayPointer<char> property_name =
1255 String::cast(name)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); 1255 String::cast(name)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
1256 ApiEvent("api,%s,\"%s\",\"%s\"\n", tag, *class_name, *property_name); 1256 ApiEvent("api,%s,\"%s\",\"%s\"\n", tag, class_name.get(),
1257 property_name.get());
1257 } else { 1258 } else {
1258 Symbol* symbol = Symbol::cast(name); 1259 Symbol* symbol = Symbol::cast(name);
1259 uint32_t hash = symbol->Hash(); 1260 uint32_t hash = symbol->Hash();
1260 if (symbol->name()->IsUndefined()) { 1261 if (symbol->name()->IsUndefined()) {
1261 ApiEvent("api,%s,\"%s\",symbol(hash %x)\n", tag, *class_name, hash); 1262 ApiEvent("api,%s,\"%s\",symbol(hash %x)\n", tag, class_name.get(), hash);
1262 } else { 1263 } else {
1263 SmartArrayPointer<char> str = String::cast(symbol->name())->ToCString( 1264 SmartArrayPointer<char> str = String::cast(symbol->name())->ToCString(
1264 DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); 1265 DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
1265 ApiEvent("api,%s,\"%s\",symbol(\"%s\" hash %x)\n", 1266 ApiEvent("api,%s,\"%s\",symbol(\"%s\" hash %x)\n",
1266 tag, *class_name, *str, hash); 1267 tag, class_name.get(), str.get(), hash);
1267 } 1268 }
1268 } 1269 }
1269 } 1270 }
1270 1271
1271 void Logger::ApiIndexedPropertyAccess(const char* tag, 1272 void Logger::ApiIndexedPropertyAccess(const char* tag,
1272 JSObject* holder, 1273 JSObject* holder,
1273 uint32_t index) { 1274 uint32_t index) {
1274 if (!log_->IsEnabled() || !FLAG_log_api) return; 1275 if (!log_->IsEnabled() || !FLAG_log_api) return;
1275 String* class_name_obj = holder->class_name(); 1276 String* class_name_obj = holder->class_name();
1276 SmartArrayPointer<char> class_name = 1277 SmartArrayPointer<char> class_name =
1277 class_name_obj->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); 1278 class_name_obj->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
1278 ApiEvent("api,%s,\"%s\",%u\n", tag, *class_name, index); 1279 ApiEvent("api,%s,\"%s\",%u\n", tag, class_name.get(), index);
1279 } 1280 }
1280 1281
1281 1282
1282 void Logger::ApiObjectAccess(const char* tag, JSObject* object) { 1283 void Logger::ApiObjectAccess(const char* tag, JSObject* object) {
1283 if (!log_->IsEnabled() || !FLAG_log_api) return; 1284 if (!log_->IsEnabled() || !FLAG_log_api) return;
1284 String* class_name_obj = object->class_name(); 1285 String* class_name_obj = object->class_name();
1285 SmartArrayPointer<char> class_name = 1286 SmartArrayPointer<char> class_name =
1286 class_name_obj->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); 1287 class_name_obj->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
1287 ApiEvent("api,%s,\"%s\"\n", tag, *class_name); 1288 ApiEvent("api,%s,\"%s\"\n", tag, class_name.get());
1288 } 1289 }
1289 1290
1290 1291
1291 void Logger::ApiEntryCall(const char* name) { 1292 void Logger::ApiEntryCall(const char* name) {
1292 if (!log_->IsEnabled() || !FLAG_log_api) return; 1293 if (!log_->IsEnabled() || !FLAG_log_api) return;
1293 ApiEvent("api,%s\n", name); 1294 ApiEvent("api,%s\n", name);
1294 } 1295 }
1295 1296
1296 1297
1297 void Logger::NewEvent(const char* name, void* object, size_t size) { 1298 void Logger::NewEvent(const char* name, void* object, size_t size) {
(...skipping 27 matching lines...) Expand all
1325 Address entry_point) { 1326 Address entry_point) {
1326 if (!FLAG_log_code || !log_->IsEnabled()) return; 1327 if (!FLAG_log_code || !log_->IsEnabled()) return;
1327 Log::MessageBuilder msg(log_); 1328 Log::MessageBuilder msg(log_);
1328 msg.Append("%s,%s,-2,", 1329 msg.Append("%s,%s,-2,",
1329 kLogEventsNames[CODE_CREATION_EVENT], 1330 kLogEventsNames[CODE_CREATION_EVENT],
1330 kLogEventsNames[CALLBACK_TAG]); 1331 kLogEventsNames[CALLBACK_TAG]);
1331 msg.AppendAddress(entry_point); 1332 msg.AppendAddress(entry_point);
1332 if (name->IsString()) { 1333 if (name->IsString()) {
1333 SmartArrayPointer<char> str = 1334 SmartArrayPointer<char> str =
1334 String::cast(name)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); 1335 String::cast(name)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
1335 msg.Append(",1,\"%s%s\"", prefix, *str); 1336 msg.Append(",1,\"%s%s\"", prefix, str.get());
1336 } else { 1337 } else {
1337 Symbol* symbol = Symbol::cast(name); 1338 Symbol* symbol = Symbol::cast(name);
1338 if (symbol->name()->IsUndefined()) { 1339 if (symbol->name()->IsUndefined()) {
1339 msg.Append(",1,symbol(hash %x)", prefix, symbol->Hash()); 1340 msg.Append(",1,symbol(hash %x)", prefix, symbol->Hash());
1340 } else { 1341 } else {
1341 SmartArrayPointer<char> str = String::cast(symbol->name())->ToCString( 1342 SmartArrayPointer<char> str = String::cast(symbol->name())->ToCString(
1342 DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); 1343 DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
1343 msg.Append(",1,symbol(\"%s\" hash %x)", prefix, *str, symbol->Hash()); 1344 msg.Append(",1,symbol(\"%s\" hash %x)", prefix, str.get(),
1345 symbol->Hash());
1344 } 1346 }
1345 } 1347 }
1346 msg.Append('\n'); 1348 msg.Append('\n');
1347 msg.WriteToLogFile(); 1349 msg.WriteToLogFile();
1348 } 1350 }
1349 1351
1350 1352
1351 void Logger::CallbackEvent(Name* name, Address entry_point) { 1353 void Logger::CallbackEvent(Name* name, Address entry_point) {
1352 PROFILER_LOG(CallbackEvent(name, entry_point)); 1354 PROFILER_LOG(CallbackEvent(name, entry_point));
1353 CallbackEventInternal("", name, entry_point); 1355 CallbackEventInternal("", name, entry_point);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 Code* code, 1425 Code* code,
1424 SharedFunctionInfo* shared, 1426 SharedFunctionInfo* shared,
1425 CompilationInfo* info, 1427 CompilationInfo* info,
1426 Name* name) { 1428 Name* name) {
1427 PROFILER_LOG(CodeCreateEvent(tag, code, shared, info, name)); 1429 PROFILER_LOG(CodeCreateEvent(tag, code, shared, info, name));
1428 1430
1429 if (!is_logging_code_events()) return; 1431 if (!is_logging_code_events()) return;
1430 CALL_LISTENERS(CodeCreateEvent(tag, code, shared, info, name)); 1432 CALL_LISTENERS(CodeCreateEvent(tag, code, shared, info, name));
1431 1433
1432 if (!FLAG_log_code || !log_->IsEnabled()) return; 1434 if (!FLAG_log_code || !log_->IsEnabled()) return;
1433 if (code == isolate_->builtins()->builtin( 1435 if (code == isolate_->builtins()->builtin(Builtins::kCompileUnoptimized))
1434 Builtins::kLazyCompile))
1435 return; 1436 return;
1436 1437
1437 Log::MessageBuilder msg(log_); 1438 Log::MessageBuilder msg(log_);
1438 AppendCodeCreateHeader(&msg, tag, code); 1439 AppendCodeCreateHeader(&msg, tag, code);
1439 if (name->IsString()) { 1440 if (name->IsString()) {
1440 SmartArrayPointer<char> str = 1441 SmartArrayPointer<char> str =
1441 String::cast(name)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); 1442 String::cast(name)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
1442 msg.Append("\"%s\"", *str); 1443 msg.Append("\"%s\"", str.get());
1443 } else { 1444 } else {
1444 msg.AppendSymbolName(Symbol::cast(name)); 1445 msg.AppendSymbolName(Symbol::cast(name));
1445 } 1446 }
1446 msg.Append(','); 1447 msg.Append(',');
1447 msg.AppendAddress(shared->address()); 1448 msg.AppendAddress(shared->address());
1448 msg.Append(",%s", ComputeMarker(code)); 1449 msg.Append(",%s", ComputeMarker(code));
1449 msg.Append('\n'); 1450 msg.Append('\n');
1450 msg.WriteToLogFile(); 1451 msg.WriteToLogFile();
1451 } 1452 }
1452 1453
(...skipping 10 matching lines...) Expand all
1463 1464
1464 if (!is_logging_code_events()) return; 1465 if (!is_logging_code_events()) return;
1465 CALL_LISTENERS(CodeCreateEvent(tag, code, shared, info, source, line, 1466 CALL_LISTENERS(CodeCreateEvent(tag, code, shared, info, source, line,
1466 column)); 1467 column));
1467 1468
1468 if (!FLAG_log_code || !log_->IsEnabled()) return; 1469 if (!FLAG_log_code || !log_->IsEnabled()) return;
1469 Log::MessageBuilder msg(log_); 1470 Log::MessageBuilder msg(log_);
1470 AppendCodeCreateHeader(&msg, tag, code); 1471 AppendCodeCreateHeader(&msg, tag, code);
1471 SmartArrayPointer<char> name = 1472 SmartArrayPointer<char> name =
1472 shared->DebugName()->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); 1473 shared->DebugName()->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
1473 msg.Append("\"%s ", *name); 1474 msg.Append("\"%s ", name.get());
1474 if (source->IsString()) { 1475 if (source->IsString()) {
1475 SmartArrayPointer<char> sourcestr = 1476 SmartArrayPointer<char> sourcestr =
1476 String::cast(source)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); 1477 String::cast(source)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
1477 msg.Append("%s", *sourcestr); 1478 msg.Append("%s", sourcestr.get());
1478 } else { 1479 } else {
1479 msg.AppendSymbolName(Symbol::cast(source)); 1480 msg.AppendSymbolName(Symbol::cast(source));
1480 } 1481 }
1481 msg.Append(":%d:%d\",", line, column); 1482 msg.Append(":%d:%d\",", line, column);
1482 msg.AppendAddress(shared->address()); 1483 msg.AppendAddress(shared->address());
1483 msg.Append(",%s", ComputeMarker(code)); 1484 msg.Append(",%s", ComputeMarker(code));
1484 msg.Append('\n'); 1485 msg.Append('\n');
1485 msg.WriteToLogFile(); 1486 msg.WriteToLogFile();
1486 } 1487 }
1487 1488
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1958 "Logger::LogCompiledFunctions"); 1959 "Logger::LogCompiledFunctions");
1959 HandleScope scope(isolate_); 1960 HandleScope scope(isolate_);
1960 const int compiled_funcs_count = EnumerateCompiledFunctions(heap, NULL, NULL); 1961 const int compiled_funcs_count = EnumerateCompiledFunctions(heap, NULL, NULL);
1961 ScopedVector< Handle<SharedFunctionInfo> > sfis(compiled_funcs_count); 1962 ScopedVector< Handle<SharedFunctionInfo> > sfis(compiled_funcs_count);
1962 ScopedVector< Handle<Code> > code_objects(compiled_funcs_count); 1963 ScopedVector< Handle<Code> > code_objects(compiled_funcs_count);
1963 EnumerateCompiledFunctions(heap, sfis.start(), code_objects.start()); 1964 EnumerateCompiledFunctions(heap, sfis.start(), code_objects.start());
1964 1965
1965 // During iteration, there can be heap allocation due to 1966 // During iteration, there can be heap allocation due to
1966 // GetScriptLineNumber call. 1967 // GetScriptLineNumber call.
1967 for (int i = 0; i < compiled_funcs_count; ++i) { 1968 for (int i = 0; i < compiled_funcs_count; ++i) {
1968 if (*code_objects[i] == isolate_->builtins()->builtin( 1969 if (code_objects[i].is_identical_to(
1969 Builtins::kLazyCompile)) 1970 isolate_->builtins()->CompileUnoptimized()))
1970 continue; 1971 continue;
1971 LogExistingFunction(sfis[i], code_objects[i]); 1972 LogExistingFunction(sfis[i], code_objects[i]);
1972 } 1973 }
1973 } 1974 }
1974 1975
1975 1976
1976 void Logger::LogAccessorCallbacks() { 1977 void Logger::LogAccessorCallbacks() {
1977 Heap* heap = isolate_->heap(); 1978 Heap* heap = isolate_->heap();
1978 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, 1979 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask,
1979 "Logger::LogAccessorCallbacks"); 1980 "Logger::LogAccessorCallbacks");
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
2057 if (is_initialized_) return true; 2058 if (is_initialized_) return true;
2058 is_initialized_ = true; 2059 is_initialized_ = true;
2059 2060
2060 // --ll-prof implies --log-code and --log-snapshot-positions. 2061 // --ll-prof implies --log-code and --log-snapshot-positions.
2061 if (FLAG_ll_prof) { 2062 if (FLAG_ll_prof) {
2062 FLAG_log_snapshot_positions = true; 2063 FLAG_log_snapshot_positions = true;
2063 } 2064 }
2064 2065
2065 SmartArrayPointer<const char> log_file_name = 2066 SmartArrayPointer<const char> log_file_name =
2066 PrepareLogFileName(isolate, FLAG_logfile); 2067 PrepareLogFileName(isolate, FLAG_logfile);
2067 log_->Initialize(*log_file_name); 2068 log_->Initialize(log_file_name.get());
2068 2069
2069 2070
2070 if (FLAG_perf_basic_prof) { 2071 if (FLAG_perf_basic_prof) {
2071 perf_basic_logger_ = new PerfBasicLogger(); 2072 perf_basic_logger_ = new PerfBasicLogger();
2072 addCodeEventListener(perf_basic_logger_); 2073 addCodeEventListener(perf_basic_logger_);
2073 } 2074 }
2074 2075
2075 if (FLAG_perf_jit_prof) { 2076 if (FLAG_perf_jit_prof) {
2076 perf_jit_logger_ = new PerfJitLogger(); 2077 perf_jit_logger_ = new PerfJitLogger();
2077 addCodeEventListener(perf_jit_logger_); 2078 addCodeEventListener(perf_jit_logger_);
2078 } 2079 }
2079 2080
2080 if (FLAG_ll_prof) { 2081 if (FLAG_ll_prof) {
2081 ll_logger_ = new LowLevelLogger(*log_file_name); 2082 ll_logger_ = new LowLevelLogger(log_file_name.get());
2082 addCodeEventListener(ll_logger_); 2083 addCodeEventListener(ll_logger_);
2083 } 2084 }
2084 2085
2085 ticker_ = new Ticker(isolate, kSamplingIntervalMs); 2086 ticker_ = new Ticker(isolate, kSamplingIntervalMs);
2086 2087
2087 if (Log::InitLogAtStart()) { 2088 if (Log::InitLogAtStart()) {
2088 is_logging_ = true; 2089 is_logging_ = true;
2089 } 2090 }
2090 2091
2091 if (FLAG_prof) { 2092 if (FLAG_prof) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
2160 if (jit_logger_) { 2161 if (jit_logger_) {
2161 removeCodeEventListener(jit_logger_); 2162 removeCodeEventListener(jit_logger_);
2162 delete jit_logger_; 2163 delete jit_logger_;
2163 jit_logger_ = NULL; 2164 jit_logger_ = NULL;
2164 } 2165 }
2165 2166
2166 return log_->Close(); 2167 return log_->Close();
2167 } 2168 }
2168 2169
2169 } } // namespace v8::internal 2170 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/liveedit.cc ('k') | src/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698