Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 896 CallbackEventInternal("get ", name, entry_point); | 896 CallbackEventInternal("get ", name, entry_point); |
| 897 } | 897 } |
| 898 | 898 |
| 899 | 899 |
| 900 void Logger::SetterCallbackEvent(Name* name, Address entry_point) { | 900 void Logger::SetterCallbackEvent(Name* name, Address entry_point) { |
| 901 if (!log_->IsEnabled() || !FLAG_log_code) return; | 901 if (!log_->IsEnabled() || !FLAG_log_code) return; |
| 902 CallbackEventInternal("set ", name, entry_point); | 902 CallbackEventInternal("set ", name, entry_point); |
| 903 } | 903 } |
| 904 | 904 |
| 905 | 905 |
| 906 void Logger::AppendCodeCreateHeader(LogMessageBuilder* msg, | |
| 907 LogEventsAndTags tag, | |
| 908 Code* code, | |
| 909 int override_code_kind) { | |
| 910 ASSERT(msg); | |
| 911 msg->Append("%s,%s,%d,", | |
| 912 kLogEventsNames[CODE_CREATION_EVENT], | |
| 913 kLogEventsNames[tag], | |
| 914 override_code_kind ? override_code_kind : code->kind()); | |
| 915 msg->AppendAddress(code->address()); | |
| 916 msg->Append(",%d,", code->ExecutableSize()); | |
| 917 } | |
| 918 | |
| 919 | |
| 920 void Logger::AppendSymbolName(LogMessageBuilder* msg, | |
| 921 Symbol* symbol) { | |
| 922 ASSERT(symbol); | |
|
yurys
2013/06/21 09:32:51
No need in this assert.
| |
| 923 msg->Append("symbol("); | |
| 924 if (!symbol->name()->IsUndefined()) { | |
| 925 msg->Append("\""); | |
| 926 msg->AppendDetailed(String::cast(symbol->name()), false); | |
| 927 msg->Append("\" "); | |
| 928 } | |
| 929 msg->Append("hash %x)", symbol->Hash()); | |
| 930 } | |
| 931 | |
| 932 | |
| 906 void Logger::CodeCreateEvent(LogEventsAndTags tag, | 933 void Logger::CodeCreateEvent(LogEventsAndTags tag, |
| 907 Code* code, | 934 Code* code, |
| 908 const char* comment) { | 935 const char* comment) { |
| 909 if (!is_logging_code_events()) return; | 936 if (!is_logging_code_events()) return; |
| 910 if (FLAG_ll_prof || Serializer::enabled() || code_event_handler_ != NULL) { | 937 if (FLAG_ll_prof || Serializer::enabled() || code_event_handler_ != NULL) { |
| 911 name_buffer_->Reset(); | 938 name_buffer_->Reset(); |
| 912 name_buffer_->AppendBytes(kLogEventsNames[tag]); | 939 name_buffer_->AppendBytes(kLogEventsNames[tag]); |
| 913 name_buffer_->AppendByte(':'); | 940 name_buffer_->AppendByte(':'); |
| 914 name_buffer_->AppendBytes(comment); | 941 name_buffer_->AppendBytes(comment); |
| 915 } | 942 } |
| 916 if (code_event_handler_ != NULL) { | 943 if (code_event_handler_ != NULL) { |
| 917 IssueCodeAddedEvent(code, NULL, name_buffer_->get(), name_buffer_->size()); | 944 IssueCodeAddedEvent(code, NULL, name_buffer_->get(), name_buffer_->size()); |
| 918 } | 945 } |
| 919 if (!log_->IsEnabled()) return; | 946 if (!log_->IsEnabled()) return; |
| 920 if (FLAG_ll_prof) { | 947 if (FLAG_ll_prof) { |
| 921 LowLevelCodeCreateEvent(code, name_buffer_->get(), name_buffer_->size()); | 948 LowLevelCodeCreateEvent(code, name_buffer_->get(), name_buffer_->size()); |
| 922 } | 949 } |
| 923 if (Serializer::enabled()) { | 950 if (Serializer::enabled()) { |
| 924 RegisterSnapshotCodeName(code, name_buffer_->get(), name_buffer_->size()); | 951 RegisterSnapshotCodeName(code, name_buffer_->get(), name_buffer_->size()); |
| 925 } | 952 } |
| 926 if (!FLAG_log_code) return; | 953 if (!FLAG_log_code) return; |
| 927 LogMessageBuilder msg(this); | 954 LogMessageBuilder msg(this); |
| 928 msg.Append("%s,%s,%d,", | 955 AppendCodeCreateHeader(&msg, tag, code); |
| 929 kLogEventsNames[CODE_CREATION_EVENT], | 956 msg.AppendDoubleQuotedString(comment); |
| 930 kLogEventsNames[tag], | |
| 931 code->kind()); | |
| 932 msg.AppendAddress(code->address()); | |
| 933 msg.Append(",%d,\"", code->ExecutableSize()); | |
| 934 for (const char* p = comment; *p != '\0'; p++) { | |
| 935 if (*p == '"') { | |
| 936 msg.Append('\\'); | |
| 937 } | |
| 938 msg.Append(*p); | |
| 939 } | |
| 940 msg.Append('"'); | |
| 941 msg.Append('\n'); | 957 msg.Append('\n'); |
| 942 msg.WriteToLogFile(); | 958 msg.WriteToLogFile(); |
| 943 } | 959 } |
| 944 | 960 |
| 945 | 961 |
| 946 void Logger::CodeCreateEvent(LogEventsAndTags tag, | 962 void Logger::CodeCreateEvent(LogEventsAndTags tag, |
| 947 Code* code, | 963 Code* code, |
| 948 Name* name) { | 964 Name* name) { |
| 949 if (!is_logging_code_events()) return; | 965 if (!is_logging_code_events()) return; |
| 950 if (FLAG_ll_prof || Serializer::enabled() || code_event_handler_ != NULL) { | 966 if (FLAG_ll_prof || Serializer::enabled() || code_event_handler_ != NULL) { |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 971 } | 987 } |
| 972 if (!log_->IsEnabled()) return; | 988 if (!log_->IsEnabled()) return; |
| 973 if (FLAG_ll_prof) { | 989 if (FLAG_ll_prof) { |
| 974 LowLevelCodeCreateEvent(code, name_buffer_->get(), name_buffer_->size()); | 990 LowLevelCodeCreateEvent(code, name_buffer_->get(), name_buffer_->size()); |
| 975 } | 991 } |
| 976 if (Serializer::enabled()) { | 992 if (Serializer::enabled()) { |
| 977 RegisterSnapshotCodeName(code, name_buffer_->get(), name_buffer_->size()); | 993 RegisterSnapshotCodeName(code, name_buffer_->get(), name_buffer_->size()); |
| 978 } | 994 } |
| 979 if (!FLAG_log_code) return; | 995 if (!FLAG_log_code) return; |
| 980 LogMessageBuilder msg(this); | 996 LogMessageBuilder msg(this); |
| 981 msg.Append("%s,%s,%d,", | 997 AppendCodeCreateHeader(&msg, tag, code); |
| 982 kLogEventsNames[CODE_CREATION_EVENT], | |
| 983 kLogEventsNames[tag], | |
| 984 code->kind()); | |
| 985 msg.AppendAddress(code->address()); | |
| 986 msg.Append(",%d,", code->ExecutableSize()); | |
| 987 if (name->IsString()) { | 998 if (name->IsString()) { |
| 988 msg.Append('"'); | 999 msg.Append('"'); |
| 989 msg.AppendDetailed(String::cast(name), false); | 1000 msg.AppendDetailed(String::cast(name), false); |
| 990 msg.Append('"'); | 1001 msg.Append('"'); |
| 991 } else { | 1002 } else { |
| 992 Symbol* symbol = Symbol::cast(name); | 1003 AppendSymbolName(&msg, Symbol::cast(name)); |
| 993 msg.Append("symbol("); | |
| 994 if (!symbol->name()->IsUndefined()) { | |
| 995 msg.Append("\""); | |
| 996 msg.AppendDetailed(String::cast(symbol->name()), false); | |
| 997 msg.Append("\" "); | |
| 998 } | |
| 999 msg.Append("hash %x)", symbol->Hash()); | |
| 1000 } | 1004 } |
| 1001 msg.Append('\n'); | 1005 msg.Append('\n'); |
| 1002 msg.WriteToLogFile(); | 1006 msg.WriteToLogFile(); |
| 1003 } | 1007 } |
| 1004 | 1008 |
| 1005 | 1009 |
| 1006 // ComputeMarker must only be used when SharedFunctionInfo is known. | 1010 // ComputeMarker must only be used when SharedFunctionInfo is known. |
| 1007 static const char* ComputeMarker(Code* code) { | 1011 static const char* ComputeMarker(Code* code) { |
| 1008 switch (code->kind()) { | 1012 switch (code->kind()) { |
| 1009 case Code::FUNCTION: return code->optimizable() ? "~" : ""; | 1013 case Code::FUNCTION: return code->optimizable() ? "~" : ""; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1053 } | 1057 } |
| 1054 if (Serializer::enabled()) { | 1058 if (Serializer::enabled()) { |
| 1055 RegisterSnapshotCodeName(code, name_buffer_->get(), name_buffer_->size()); | 1059 RegisterSnapshotCodeName(code, name_buffer_->get(), name_buffer_->size()); |
| 1056 } | 1060 } |
| 1057 if (!FLAG_log_code) return; | 1061 if (!FLAG_log_code) return; |
| 1058 if (code == Isolate::Current()->builtins()->builtin( | 1062 if (code == Isolate::Current()->builtins()->builtin( |
| 1059 Builtins::kLazyCompile)) | 1063 Builtins::kLazyCompile)) |
| 1060 return; | 1064 return; |
| 1061 | 1065 |
| 1062 LogMessageBuilder msg(this); | 1066 LogMessageBuilder msg(this); |
| 1063 msg.Append("%s,%s,%d,", | 1067 AppendCodeCreateHeader(&msg, tag, code); |
| 1064 kLogEventsNames[CODE_CREATION_EVENT], | |
| 1065 kLogEventsNames[tag], | |
| 1066 code->kind()); | |
| 1067 msg.AppendAddress(code->address()); | |
| 1068 msg.Append(",%d,", code->ExecutableSize()); | |
| 1069 if (name->IsString()) { | 1068 if (name->IsString()) { |
| 1070 SmartArrayPointer<char> str = | 1069 SmartArrayPointer<char> str = |
| 1071 String::cast(name)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 1070 String::cast(name)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 1072 msg.Append("\"%s\"", *str); | 1071 msg.Append("\"%s\"", *str); |
| 1073 } else { | 1072 } else { |
| 1074 Symbol* symbol = Symbol::cast(name); | 1073 AppendSymbolName(&msg, Symbol::cast(name)); |
| 1075 msg.Append("symbol("); | |
| 1076 if (!symbol->name()->IsUndefined()) { | |
| 1077 msg.Append("\""); | |
| 1078 msg.AppendDetailed(String::cast(symbol->name()), false); | |
| 1079 msg.Append("\" "); | |
| 1080 } | |
| 1081 msg.Append("hash %x)", symbol->Hash()); | |
| 1082 } | 1074 } |
| 1083 msg.Append(','); | 1075 msg.Append(','); |
| 1084 msg.AppendAddress(shared->address()); | 1076 msg.AppendAddress(shared->address()); |
| 1085 msg.Append(",%s", ComputeMarker(code)); | 1077 msg.Append(",%s", ComputeMarker(code)); |
| 1086 msg.Append('\n'); | 1078 msg.Append('\n'); |
| 1087 msg.WriteToLogFile(); | 1079 msg.WriteToLogFile(); |
| 1088 } | 1080 } |
| 1089 | 1081 |
| 1090 | 1082 |
| 1091 // Although, it is possible to extract source and line from | 1083 // Although, it is possible to extract source and line from |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1124 } | 1116 } |
| 1125 if (!log_->IsEnabled()) return; | 1117 if (!log_->IsEnabled()) return; |
| 1126 if (FLAG_ll_prof) { | 1118 if (FLAG_ll_prof) { |
| 1127 LowLevelCodeCreateEvent(code, name_buffer_->get(), name_buffer_->size()); | 1119 LowLevelCodeCreateEvent(code, name_buffer_->get(), name_buffer_->size()); |
| 1128 } | 1120 } |
| 1129 if (Serializer::enabled()) { | 1121 if (Serializer::enabled()) { |
| 1130 RegisterSnapshotCodeName(code, name_buffer_->get(), name_buffer_->size()); | 1122 RegisterSnapshotCodeName(code, name_buffer_->get(), name_buffer_->size()); |
| 1131 } | 1123 } |
| 1132 if (!FLAG_log_code) return; | 1124 if (!FLAG_log_code) return; |
| 1133 LogMessageBuilder msg(this); | 1125 LogMessageBuilder msg(this); |
| 1126 AppendCodeCreateHeader(&msg, tag, code); | |
| 1134 SmartArrayPointer<char> name = | 1127 SmartArrayPointer<char> name = |
| 1135 shared->DebugName()->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 1128 shared->DebugName()->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 1136 msg.Append("%s,%s,%d,", | 1129 msg.Append("\"%s ", *name); |
| 1137 kLogEventsNames[CODE_CREATION_EVENT], | |
| 1138 kLogEventsNames[tag], | |
| 1139 code->kind()); | |
| 1140 msg.AppendAddress(code->address()); | |
| 1141 msg.Append(",%d,\"%s ", code->ExecutableSize(), *name); | |
| 1142 if (source->IsString()) { | 1130 if (source->IsString()) { |
| 1143 SmartArrayPointer<char> sourcestr = | 1131 SmartArrayPointer<char> sourcestr = |
| 1144 String::cast(source)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 1132 String::cast(source)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 1145 msg.Append("%s", *sourcestr); | 1133 msg.Append("%s", *sourcestr); |
| 1146 } else { | 1134 } else { |
| 1147 Symbol* symbol = Symbol::cast(source); | 1135 AppendSymbolName(&msg, Symbol::cast(source)); |
| 1148 msg.Append("symbol("); | |
| 1149 if (!symbol->name()->IsUndefined()) { | |
| 1150 msg.Append("\""); | |
| 1151 msg.AppendDetailed(String::cast(symbol->name()), false); | |
| 1152 msg.Append("\" "); | |
| 1153 } | |
| 1154 msg.Append("hash %x)", symbol->Hash()); | |
| 1155 } | 1136 } |
| 1156 msg.Append(":%d\",", line); | 1137 msg.Append(":%d\",", line); |
| 1157 msg.AppendAddress(shared->address()); | 1138 msg.AppendAddress(shared->address()); |
| 1158 msg.Append(",%s", ComputeMarker(code)); | 1139 msg.Append(",%s", ComputeMarker(code)); |
| 1159 msg.Append('\n'); | 1140 msg.Append('\n'); |
| 1160 msg.WriteToLogFile(); | 1141 msg.WriteToLogFile(); |
| 1161 } | 1142 } |
| 1162 | 1143 |
| 1163 | 1144 |
| 1164 void Logger::CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count) { | 1145 void Logger::CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count) { |
| 1165 if (!is_logging_code_events()) return; | 1146 if (!is_logging_code_events()) return; |
| 1166 if (FLAG_ll_prof || Serializer::enabled() || code_event_handler_ != NULL) { | 1147 if (FLAG_ll_prof || Serializer::enabled() || code_event_handler_ != NULL) { |
| 1167 name_buffer_->Reset(); | 1148 name_buffer_->Reset(); |
| 1168 name_buffer_->AppendBytes(kLogEventsNames[tag]); | 1149 name_buffer_->AppendBytes(kLogEventsNames[tag]); |
| 1169 name_buffer_->AppendByte(':'); | 1150 name_buffer_->AppendByte(':'); |
| 1170 name_buffer_->AppendInt(args_count); | 1151 name_buffer_->AppendInt(args_count); |
| 1171 } | 1152 } |
| 1172 if (code_event_handler_ != NULL) { | 1153 if (code_event_handler_ != NULL) { |
| 1173 IssueCodeAddedEvent(code, NULL, name_buffer_->get(), name_buffer_->size()); | 1154 IssueCodeAddedEvent(code, NULL, name_buffer_->get(), name_buffer_->size()); |
| 1174 } | 1155 } |
| 1175 if (!log_->IsEnabled()) return; | 1156 if (!log_->IsEnabled()) return; |
| 1176 if (FLAG_ll_prof) { | 1157 if (FLAG_ll_prof) { |
| 1177 LowLevelCodeCreateEvent(code, name_buffer_->get(), name_buffer_->size()); | 1158 LowLevelCodeCreateEvent(code, name_buffer_->get(), name_buffer_->size()); |
| 1178 } | 1159 } |
| 1179 if (Serializer::enabled()) { | 1160 if (Serializer::enabled()) { |
| 1180 RegisterSnapshotCodeName(code, name_buffer_->get(), name_buffer_->size()); | 1161 RegisterSnapshotCodeName(code, name_buffer_->get(), name_buffer_->size()); |
| 1181 } | 1162 } |
| 1182 if (!FLAG_log_code) return; | 1163 if (!FLAG_log_code) return; |
| 1183 LogMessageBuilder msg(this); | 1164 LogMessageBuilder msg(this); |
| 1184 msg.Append("%s,%s,%d,", | 1165 AppendCodeCreateHeader(&msg, tag, code); |
| 1185 kLogEventsNames[CODE_CREATION_EVENT], | 1166 msg.Append("\"args_count: %d\"", args_count); |
| 1186 kLogEventsNames[tag], | |
| 1187 code->kind()); | |
| 1188 msg.AppendAddress(code->address()); | |
| 1189 msg.Append(",%d,\"args_count: %d\"", code->ExecutableSize(), args_count); | |
| 1190 msg.Append('\n'); | 1167 msg.Append('\n'); |
| 1191 msg.WriteToLogFile(); | 1168 msg.WriteToLogFile(); |
| 1192 } | 1169 } |
| 1193 | 1170 |
| 1194 | 1171 |
| 1195 void Logger::CodeMovingGCEvent() { | 1172 void Logger::CodeMovingGCEvent() { |
| 1196 if (!log_->IsEnabled() || !FLAG_ll_prof) return; | 1173 if (!log_->IsEnabled() || !FLAG_ll_prof) return; |
| 1197 LowLevelLogWriteBytes(&kCodeMovingGCTag, sizeof(kCodeMovingGCTag)); | 1174 LowLevelLogWriteBytes(&kCodeMovingGCTag, sizeof(kCodeMovingGCTag)); |
| 1198 OS::SignalCodeMovingGC(); | 1175 OS::SignalCodeMovingGC(); |
| 1199 } | 1176 } |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 1212 } | 1189 } |
| 1213 if (!log_->IsEnabled()) return; | 1190 if (!log_->IsEnabled()) return; |
| 1214 if (FLAG_ll_prof) { | 1191 if (FLAG_ll_prof) { |
| 1215 LowLevelCodeCreateEvent(code, name_buffer_->get(), name_buffer_->size()); | 1192 LowLevelCodeCreateEvent(code, name_buffer_->get(), name_buffer_->size()); |
| 1216 } | 1193 } |
| 1217 if (Serializer::enabled()) { | 1194 if (Serializer::enabled()) { |
| 1218 RegisterSnapshotCodeName(code, name_buffer_->get(), name_buffer_->size()); | 1195 RegisterSnapshotCodeName(code, name_buffer_->get(), name_buffer_->size()); |
| 1219 } | 1196 } |
| 1220 if (!FLAG_log_code) return; | 1197 if (!FLAG_log_code) return; |
| 1221 LogMessageBuilder msg(this); | 1198 LogMessageBuilder msg(this); |
| 1222 msg.Append("%s,%s,-2,", | 1199 AppendCodeCreateHeader(&msg, REG_EXP_TAG, code, -2); |
|
yurys
2013/06/21 09:32:51
I wonder if we could have a constant with descript
| |
| 1223 kLogEventsNames[CODE_CREATION_EVENT], | 1200 msg.Append('"'); |
| 1224 kLogEventsNames[REG_EXP_TAG]); | |
| 1225 msg.AppendAddress(code->address()); | |
| 1226 msg.Append(",%d,\"", code->ExecutableSize()); | |
| 1227 msg.AppendDetailed(source, false); | 1201 msg.AppendDetailed(source, false); |
| 1228 msg.Append('\"'); | 1202 msg.Append('"'); |
| 1229 msg.Append('\n'); | 1203 msg.Append('\n'); |
| 1230 msg.WriteToLogFile(); | 1204 msg.WriteToLogFile(); |
| 1231 } | 1205 } |
| 1232 | 1206 |
| 1233 | 1207 |
| 1234 void Logger::CodeMoveEvent(Address from, Address to) { | 1208 void Logger::CodeMoveEvent(Address from, Address to) { |
| 1235 if (code_event_handler_ != NULL) IssueCodeMovedEvent(from, to); | 1209 if (code_event_handler_ != NULL) IssueCodeMovedEvent(from, to); |
| 1236 if (!log_->IsEnabled()) return; | 1210 if (!log_->IsEnabled()) return; |
| 1237 if (FLAG_ll_prof) LowLevelCodeMoveEvent(from, to); | 1211 if (FLAG_ll_prof) LowLevelCodeMoveEvent(from, to); |
| 1238 if (Serializer::enabled() && address_to_name_map_ != NULL) { | 1212 if (Serializer::enabled() && address_to_name_map_ != NULL) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1287 } | 1261 } |
| 1288 } | 1262 } |
| 1289 | 1263 |
| 1290 void Logger::SnapshotPositionEvent(Address addr, int pos) { | 1264 void Logger::SnapshotPositionEvent(Address addr, int pos) { |
| 1291 if (!log_->IsEnabled()) return; | 1265 if (!log_->IsEnabled()) return; |
| 1292 if (FLAG_ll_prof) LowLevelSnapshotPositionEvent(addr, pos); | 1266 if (FLAG_ll_prof) LowLevelSnapshotPositionEvent(addr, pos); |
| 1293 if (Serializer::enabled() && address_to_name_map_ != NULL) { | 1267 if (Serializer::enabled() && address_to_name_map_ != NULL) { |
| 1294 const char* code_name = address_to_name_map_->Lookup(addr); | 1268 const char* code_name = address_to_name_map_->Lookup(addr); |
| 1295 if (code_name == NULL) return; // Not a code object. | 1269 if (code_name == NULL) return; // Not a code object. |
| 1296 LogMessageBuilder msg(this); | 1270 LogMessageBuilder msg(this); |
| 1297 msg.Append("%s,%d,\"", kLogEventsNames[SNAPSHOT_CODE_NAME_EVENT], pos); | 1271 msg.Append("%s,%d,", kLogEventsNames[SNAPSHOT_CODE_NAME_EVENT], pos); |
| 1298 for (const char* p = code_name; *p != '\0'; ++p) { | 1272 msg.AppendDoubleQuotedString(code_name); |
| 1299 if (*p == '"') msg.Append('\\'); | 1273 msg.Append("\n"); |
| 1300 msg.Append(*p); | |
| 1301 } | |
| 1302 msg.Append("\"\n"); | |
| 1303 msg.WriteToLogFile(); | 1274 msg.WriteToLogFile(); |
| 1304 } | 1275 } |
| 1305 if (!FLAG_log_snapshot_positions) return; | 1276 if (!FLAG_log_snapshot_positions) return; |
| 1306 LogMessageBuilder msg(this); | 1277 LogMessageBuilder msg(this); |
| 1307 msg.Append("%s,", kLogEventsNames[SNAPSHOT_POSITION_EVENT]); | 1278 msg.Append("%s,", kLogEventsNames[SNAPSHOT_POSITION_EVENT]); |
| 1308 msg.AppendAddress(addr); | 1279 msg.AppendAddress(addr); |
| 1309 msg.Append(",%d", pos); | 1280 msg.Append(",%d", pos); |
| 1310 msg.Append('\n'); | 1281 msg.Append('\n'); |
| 1311 msg.WriteToLogFile(); | 1282 msg.WriteToLogFile(); |
| 1312 } | 1283 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1364 ? JSObject::cast(obj)->class_name() | 1335 ? JSObject::cast(obj)->class_name() |
| 1365 : isolate_->heap()->empty_string(); | 1336 : isolate_->heap()->empty_string(); |
| 1366 msg.Append("suspect-read,"); | 1337 msg.Append("suspect-read,"); |
| 1367 msg.Append(class_name); | 1338 msg.Append(class_name); |
| 1368 msg.Append(','); | 1339 msg.Append(','); |
| 1369 if (name->IsString()) { | 1340 if (name->IsString()) { |
| 1370 msg.Append('"'); | 1341 msg.Append('"'); |
| 1371 msg.Append(String::cast(name)); | 1342 msg.Append(String::cast(name)); |
| 1372 msg.Append('"'); | 1343 msg.Append('"'); |
| 1373 } else { | 1344 } else { |
| 1374 Symbol* symbol = Symbol::cast(name); | 1345 AppendSymbolName(&msg, Symbol::cast(name)); |
| 1375 msg.Append("symbol("); | |
| 1376 if (!symbol->name()->IsUndefined()) { | |
| 1377 msg.Append("\""); | |
| 1378 msg.AppendDetailed(String::cast(symbol->name()), false); | |
| 1379 msg.Append("\" "); | |
| 1380 } | |
| 1381 msg.Append("hash %x)", symbol->Hash()); | |
| 1382 } | 1346 } |
| 1383 msg.Append('\n'); | 1347 msg.Append('\n'); |
| 1384 msg.WriteToLogFile(); | 1348 msg.WriteToLogFile(); |
| 1385 } | 1349 } |
| 1386 | 1350 |
| 1387 | 1351 |
| 1388 void Logger::HeapSampleBeginEvent(const char* space, const char* kind) { | 1352 void Logger::HeapSampleBeginEvent(const char* space, const char* kind) { |
| 1389 if (!log_->IsEnabled() || !FLAG_log_gc) return; | 1353 if (!log_->IsEnabled() || !FLAG_log_gc) return; |
| 1390 LogMessageBuilder msg(this); | 1354 LogMessageBuilder msg(this); |
| 1391 // Using non-relative system time in order to be able to synchronize with | 1355 // Using non-relative system time in order to be able to synchronize with |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1884 profiler_ = NULL; | 1848 profiler_ = NULL; |
| 1885 } | 1849 } |
| 1886 | 1850 |
| 1887 delete ticker_; | 1851 delete ticker_; |
| 1888 ticker_ = NULL; | 1852 ticker_ = NULL; |
| 1889 | 1853 |
| 1890 return log_->Close(); | 1854 return log_->Close(); |
| 1891 } | 1855 } |
| 1892 | 1856 |
| 1893 } } // namespace v8::internal | 1857 } } // namespace v8::internal |
| OLD | NEW |