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 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 "V8.CompileFullCode"; | 1143 "V8.CompileFullCode"; |
1144 const char* Logger::TimerEventScope::v8_execute = "V8.Execute"; | 1144 const char* Logger::TimerEventScope::v8_execute = "V8.Execute"; |
1145 const char* Logger::TimerEventScope::v8_external = "V8.External"; | 1145 const char* Logger::TimerEventScope::v8_external = "V8.External"; |
1146 | 1146 |
1147 | 1147 |
1148 void Logger::LogRegExpSource(Handle<JSRegExp> regexp) { | 1148 void Logger::LogRegExpSource(Handle<JSRegExp> regexp) { |
1149 // Prints "/" + re.source + "/" + | 1149 // Prints "/" + re.source + "/" + |
1150 // (re.global?"g":"") + (re.ignorecase?"i":"") + (re.multiline?"m":"") | 1150 // (re.global?"g":"") + (re.ignorecase?"i":"") + (re.multiline?"m":"") |
1151 Log::MessageBuilder msg(log_); | 1151 Log::MessageBuilder msg(log_); |
1152 | 1152 |
1153 Handle<Object> source = Object::GetProperty( | 1153 Handle<Object> source = GetProperty(regexp, "source").ToHandleChecked(); |
1154 isolate_, regexp, "source").ToHandleChecked(); | |
1155 if (!source->IsString()) { | 1154 if (!source->IsString()) { |
1156 msg.Append("no source"); | 1155 msg.Append("no source"); |
1157 return; | 1156 return; |
1158 } | 1157 } |
1159 | 1158 |
1160 switch (regexp->TypeTag()) { | 1159 switch (regexp->TypeTag()) { |
1161 case JSRegExp::ATOM: | 1160 case JSRegExp::ATOM: |
1162 msg.Append('a'); | 1161 msg.Append('a'); |
1163 break; | 1162 break; |
1164 default: | 1163 default: |
1165 break; | 1164 break; |
1166 } | 1165 } |
1167 msg.Append('/'); | 1166 msg.Append('/'); |
1168 msg.AppendDetailed(*Handle<String>::cast(source), false); | 1167 msg.AppendDetailed(*Handle<String>::cast(source), false); |
1169 msg.Append('/'); | 1168 msg.Append('/'); |
1170 | 1169 |
1171 // global flag | 1170 // global flag |
1172 Handle<Object> global = Object::GetProperty( | 1171 Handle<Object> global = GetProperty(regexp, "global").ToHandleChecked(); |
1173 isolate_, regexp, "global").ToHandleChecked(); | |
1174 if (global->IsTrue()) { | 1172 if (global->IsTrue()) { |
1175 msg.Append('g'); | 1173 msg.Append('g'); |
1176 } | 1174 } |
1177 // ignorecase flag | 1175 // ignorecase flag |
1178 Handle<Object> ignorecase = Object::GetProperty( | 1176 Handle<Object> ignorecase = |
1179 isolate_, regexp, "ignoreCase").ToHandleChecked(); | 1177 GetProperty(regexp, "ignoreCase").ToHandleChecked(); |
1180 if (ignorecase->IsTrue()) { | 1178 if (ignorecase->IsTrue()) { |
1181 msg.Append('i'); | 1179 msg.Append('i'); |
1182 } | 1180 } |
1183 // multiline flag | 1181 // multiline flag |
1184 Handle<Object> multiline = Object::GetProperty( | 1182 Handle<Object> multiline = GetProperty(regexp, "multiline").ToHandleChecked(); |
1185 isolate_, regexp, "multiline").ToHandleChecked(); | |
1186 if (multiline->IsTrue()) { | 1183 if (multiline->IsTrue()) { |
1187 msg.Append('m'); | 1184 msg.Append('m'); |
1188 } | 1185 } |
1189 | 1186 |
1190 msg.WriteToLogFile(); | 1187 msg.WriteToLogFile(); |
1191 } | 1188 } |
1192 | 1189 |
1193 | 1190 |
1194 void Logger::RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache) { | 1191 void Logger::RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache) { |
1195 if (!log_->IsEnabled() || !FLAG_log_regexp) return; | 1192 if (!log_->IsEnabled() || !FLAG_log_regexp) return; |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1901 if (obj->IsCode()) LogCodeObject(obj); | 1898 if (obj->IsCode()) LogCodeObject(obj); |
1902 } | 1899 } |
1903 } | 1900 } |
1904 | 1901 |
1905 | 1902 |
1906 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared, | 1903 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared, |
1907 Handle<Code> code) { | 1904 Handle<Code> code) { |
1908 Handle<String> func_name(shared->DebugName()); | 1905 Handle<String> func_name(shared->DebugName()); |
1909 if (shared->script()->IsScript()) { | 1906 if (shared->script()->IsScript()) { |
1910 Handle<Script> script(Script::cast(shared->script())); | 1907 Handle<Script> script(Script::cast(shared->script())); |
1911 int line_num = Script::GetLineNumber(script, shared->start_position()) + 1; | 1908 int line_num = GetScriptLineNumber(script, shared->start_position()) + 1; |
1912 int column_num = | 1909 int column_num = |
1913 Script::GetColumnNumber(script, shared->start_position()) + 1; | 1910 GetScriptColumnNumber(script, shared->start_position()) + 1; |
1914 if (script->name()->IsString()) { | 1911 if (script->name()->IsString()) { |
1915 Handle<String> script_name(String::cast(script->name())); | 1912 Handle<String> script_name(String::cast(script->name())); |
1916 if (line_num > 0) { | 1913 if (line_num > 0) { |
1917 PROFILE(isolate_, | 1914 PROFILE(isolate_, |
1918 CodeCreateEvent( | 1915 CodeCreateEvent( |
1919 Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script), | 1916 Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG, *script), |
1920 *code, *shared, NULL, | 1917 *code, *shared, NULL, |
1921 *script_name, line_num, column_num)); | 1918 *script_name, line_num, column_num)); |
1922 } else { | 1919 } else { |
1923 // Can't distinguish eval and script here, so always use Script. | 1920 // Can't distinguish eval and script here, so always use Script. |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2159 if (jit_logger_) { | 2156 if (jit_logger_) { |
2160 removeCodeEventListener(jit_logger_); | 2157 removeCodeEventListener(jit_logger_); |
2161 delete jit_logger_; | 2158 delete jit_logger_; |
2162 jit_logger_ = NULL; | 2159 jit_logger_ = NULL; |
2163 } | 2160 } |
2164 | 2161 |
2165 return log_->Close(); | 2162 return log_->Close(); |
2166 } | 2163 } |
2167 | 2164 |
2168 } } // namespace v8::internal | 2165 } } // namespace v8::internal |
OLD | NEW |