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