| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
| 8 | 8 |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 | 839 |
| 840 Handle<String> script_name = script->name()->IsString() | 840 Handle<String> script_name = script->name()->IsString() |
| 841 ? Handle<String>(String::cast(script->name())) | 841 ? Handle<String>(String::cast(script->name())) |
| 842 : isolate->factory()->empty_string(); | 842 : isolate->factory()->empty_string(); |
| 843 Logger::LogEventsAndTags log_tag = info->is_eval() | 843 Logger::LogEventsAndTags log_tag = info->is_eval() |
| 844 ? Logger::EVAL_TAG | 844 ? Logger::EVAL_TAG |
| 845 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script); | 845 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script); |
| 846 | 846 |
| 847 PROFILE(isolate, CodeCreateEvent( | 847 PROFILE(isolate, CodeCreateEvent( |
| 848 log_tag, *info->code(), *result, info, *script_name)); | 848 log_tag, *info->code(), *result, info, *script_name)); |
| 849 isolate->CodeCreateEvent(*info->code(), *script_name); |
| 849 GDBJIT(AddCode(script_name, script, info->code(), info)); | 850 GDBJIT(AddCode(script_name, script, info->code(), info)); |
| 850 | 851 |
| 851 // Hint to the runtime system used when allocating space for initial | 852 // Hint to the runtime system used when allocating space for initial |
| 852 // property space by setting the expected number of properties for | 853 // property space by setting the expected number of properties for |
| 853 // the instances of the function. | 854 // the instances of the function. |
| 854 SetExpectedNofPropertiesFromEstimate(result, | 855 SetExpectedNofPropertiesFromEstimate(result, |
| 855 lit->expected_property_count()); | 856 lit->expected_property_count()); |
| 856 | 857 |
| 857 script->set_compilation_state(Script::COMPILATION_STATE_COMPILED); | 858 script->set_compilation_state(Script::COMPILATION_STATE_COMPILED); |
| 858 | 859 |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1254 void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag, | 1255 void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag, |
| 1255 CompilationInfo* info, | 1256 CompilationInfo* info, |
| 1256 Handle<SharedFunctionInfo> shared) { | 1257 Handle<SharedFunctionInfo> shared) { |
| 1257 // SharedFunctionInfo is passed separately, because if CompilationInfo | 1258 // SharedFunctionInfo is passed separately, because if CompilationInfo |
| 1258 // was created using Script object, it will not have it. | 1259 // was created using Script object, it will not have it. |
| 1259 | 1260 |
| 1260 // Log the code generation. If source information is available include | 1261 // Log the code generation. If source information is available include |
| 1261 // script name and line number. Check explicitly whether logging is | 1262 // script name and line number. Check explicitly whether logging is |
| 1262 // enabled as finding the line number is not free. | 1263 // enabled as finding the line number is not free. |
| 1263 if (info->isolate()->logger()->is_logging_code_events() || | 1264 if (info->isolate()->logger()->is_logging_code_events() || |
| 1264 info->isolate()->cpu_profiler()->is_profiling()) { | 1265 info->isolate()->cpu_profiler()->is_profiling() || |
| 1266 info->isolate()->code_event_handler() != NULL) { |
| 1265 Handle<Script> script = info->script(); | 1267 Handle<Script> script = info->script(); |
| 1266 Handle<Code> code = info->code(); | 1268 Handle<Code> code = info->code(); |
| 1267 if (code.is_identical_to( | 1269 if (code.is_identical_to( |
| 1268 info->isolate()->builtins()->CompileUnoptimized())) { | 1270 info->isolate()->builtins()->CompileUnoptimized())) { |
| 1269 return; | 1271 return; |
| 1270 } | 1272 } |
| 1271 int line_num = Script::GetLineNumber(script, shared->start_position()) + 1; | 1273 int line_num = Script::GetLineNumber(script, shared->start_position()) + 1; |
| 1272 int column_num = | 1274 int column_num = |
| 1273 Script::GetColumnNumber(script, shared->start_position()) + 1; | 1275 Script::GetColumnNumber(script, shared->start_position()) + 1; |
| 1274 String* script_name = script->name()->IsString() | 1276 String* script_name = script->name()->IsString() |
| 1275 ? String::cast(script->name()) | 1277 ? String::cast(script->name()) |
| 1276 : info->isolate()->heap()->empty_string(); | 1278 : info->isolate()->heap()->empty_string(); |
| 1277 Logger::LogEventsAndTags log_tag = Logger::ToNativeByScript(tag, *script); | 1279 Logger::LogEventsAndTags log_tag = Logger::ToNativeByScript(tag, *script); |
| 1278 PROFILE(info->isolate(), CodeCreateEvent( | 1280 PROFILE(info->isolate(), CodeCreateEvent( |
| 1279 log_tag, *code, *shared, info, script_name, line_num, column_num)); | 1281 log_tag, *code, *shared, info, script_name, line_num, column_num)); |
| 1282 info->isolate()->CodeCreateEvent(*code, *shared, script_name, |
| 1283 line_num, column_num); |
| 1280 } | 1284 } |
| 1281 | 1285 |
| 1282 GDBJIT(AddCode(Handle<String>(shared->DebugName()), | 1286 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
| 1283 Handle<Script>(info->script()), | 1287 Handle<Script>(info->script()), |
| 1284 Handle<Code>(info->code()), | 1288 Handle<Code>(info->code()), |
| 1285 info)); | 1289 info)); |
| 1286 } | 1290 } |
| 1287 | 1291 |
| 1288 | 1292 |
| 1289 CompilationPhase::CompilationPhase(const char* name, CompilationInfo* info) | 1293 CompilationPhase::CompilationPhase(const char* name, CompilationInfo* info) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1310 AllowHandleDereference allow_deref; | 1314 AllowHandleDereference allow_deref; |
| 1311 bool tracing_on = info()->IsStub() | 1315 bool tracing_on = info()->IsStub() |
| 1312 ? FLAG_trace_hydrogen_stubs | 1316 ? FLAG_trace_hydrogen_stubs |
| 1313 : (FLAG_trace_hydrogen && | 1317 : (FLAG_trace_hydrogen && |
| 1314 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1318 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
| 1315 return (tracing_on && | 1319 return (tracing_on && |
| 1316 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1320 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
| 1317 } | 1321 } |
| 1318 | 1322 |
| 1319 } } // namespace v8::internal | 1323 } } // namespace v8::internal |
| OLD | NEW |