OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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/log.h" | 5 #include "src/log.h" |
6 | 6 |
7 #include <cstdarg> | 7 #include <cstdarg> |
8 #include <memory> | 8 #include <memory> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1505 PROFILE(isolate_, CodeCreateEvent( | 1505 PROFILE(isolate_, CodeCreateEvent( |
1506 CodeEventListener::BYTECODE_HANDLER_TAG, | 1506 CodeEventListener::BYTECODE_HANDLER_TAG, |
1507 AbstractCode::cast(code), bytecode_name.c_str())); | 1507 AbstractCode::cast(code), bytecode_name.c_str())); |
1508 } | 1508 } |
1509 } | 1509 } |
1510 } | 1510 } |
1511 } | 1511 } |
1512 | 1512 |
1513 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared, | 1513 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared, |
1514 Handle<AbstractCode> code) { | 1514 Handle<AbstractCode> code) { |
1515 Handle<String> func_name(shared->DebugName()); | |
1516 if (shared->script()->IsScript()) { | 1515 if (shared->script()->IsScript()) { |
1517 Handle<Script> script(Script::cast(shared->script())); | 1516 Handle<Script> script(Script::cast(shared->script())); |
1518 int line_num = Script::GetLineNumber(script, shared->start_position()) + 1; | 1517 int line_num = Script::GetLineNumber(script, shared->start_position()) + 1; |
1519 int column_num = | 1518 int column_num = |
1520 Script::GetColumnNumber(script, shared->start_position()) + 1; | 1519 Script::GetColumnNumber(script, shared->start_position()) + 1; |
1521 if (script->name()->IsString()) { | 1520 if (script->name()->IsString()) { |
1522 Handle<String> script_name(String::cast(script->name())); | 1521 Handle<String> script_name(String::cast(script->name())); |
1523 if (line_num > 0) { | 1522 if (line_num > 0) { |
1524 PROFILE(isolate_, | 1523 PROFILE(isolate_, |
1525 CodeCreateEvent( | 1524 CodeCreateEvent( |
(...skipping 18 matching lines...) Expand all Loading... |
1544 // API function. | 1543 // API function. |
1545 FunctionTemplateInfo* fun_data = shared->get_api_func_data(); | 1544 FunctionTemplateInfo* fun_data = shared->get_api_func_data(); |
1546 Object* raw_call_data = fun_data->call_code(); | 1545 Object* raw_call_data = fun_data->call_code(); |
1547 if (!raw_call_data->IsUndefined(isolate_)) { | 1546 if (!raw_call_data->IsUndefined(isolate_)) { |
1548 CallHandlerInfo* call_data = CallHandlerInfo::cast(raw_call_data); | 1547 CallHandlerInfo* call_data = CallHandlerInfo::cast(raw_call_data); |
1549 Object* callback_obj = call_data->callback(); | 1548 Object* callback_obj = call_data->callback(); |
1550 Address entry_point = v8::ToCData<Address>(callback_obj); | 1549 Address entry_point = v8::ToCData<Address>(callback_obj); |
1551 #if USES_FUNCTION_DESCRIPTORS | 1550 #if USES_FUNCTION_DESCRIPTORS |
1552 entry_point = *FUNCTION_ENTRYPOINT_ADDRESS(entry_point); | 1551 entry_point = *FUNCTION_ENTRYPOINT_ADDRESS(entry_point); |
1553 #endif | 1552 #endif |
1554 PROFILE(isolate_, CallbackEvent(*func_name, entry_point)); | 1553 PROFILE(isolate_, CallbackEvent(shared->DebugName(), entry_point)); |
1555 } | 1554 } |
1556 } else { | 1555 } else { |
1557 PROFILE(isolate_, CodeCreateEvent(CodeEventListener::LAZY_COMPILE_TAG, | 1556 PROFILE(isolate_, |
1558 *code, *shared, *func_name)); | 1557 CodeCreateEvent(CodeEventListener::LAZY_COMPILE_TAG, *code, *shared, |
| 1558 isolate_->heap()->empty_string())); |
1559 } | 1559 } |
1560 } | 1560 } |
1561 | 1561 |
1562 | 1562 |
1563 void Logger::LogCompiledFunctions() { | 1563 void Logger::LogCompiledFunctions() { |
1564 Heap* heap = isolate_->heap(); | 1564 Heap* heap = isolate_->heap(); |
1565 HandleScope scope(isolate_); | 1565 HandleScope scope(isolate_); |
1566 const int compiled_funcs_count = EnumerateCompiledFunctions(heap, NULL, NULL); | 1566 const int compiled_funcs_count = EnumerateCompiledFunctions(heap, NULL, NULL); |
1567 ScopedVector< Handle<SharedFunctionInfo> > sfis(compiled_funcs_count); | 1567 ScopedVector< Handle<SharedFunctionInfo> > sfis(compiled_funcs_count); |
1568 ScopedVector<Handle<AbstractCode> > code_objects(compiled_funcs_count); | 1568 ScopedVector<Handle<AbstractCode> > code_objects(compiled_funcs_count); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1780 | 1780 |
1781 if (profiler_listener_.get() != nullptr) { | 1781 if (profiler_listener_.get() != nullptr) { |
1782 removeCodeEventListener(profiler_listener_.get()); | 1782 removeCodeEventListener(profiler_listener_.get()); |
1783 } | 1783 } |
1784 | 1784 |
1785 return log_->Close(); | 1785 return log_->Close(); |
1786 } | 1786 } |
1787 | 1787 |
1788 } // namespace internal | 1788 } // namespace internal |
1789 } // namespace v8 | 1789 } // namespace v8 |
OLD | NEW |