Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(960)

Side by Side Diff: src/log.cc

Issue 1752173003: Additional fixes for external callback logging in profiler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix test-log-stack-tracer.cc Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/profiler/profile-generator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <sstream> 8 #include <sstream>
9 9
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 1411
1412 1412
1413 void Logger::TickEvent(TickSample* sample, bool overflow) { 1413 void Logger::TickEvent(TickSample* sample, bool overflow) {
1414 if (!log_->IsEnabled() || !FLAG_prof_cpp) return; 1414 if (!log_->IsEnabled() || !FLAG_prof_cpp) return;
1415 Log::MessageBuilder msg(log_); 1415 Log::MessageBuilder msg(log_);
1416 msg.Append("%s,", kLogEventsNames[TICK_EVENT]); 1416 msg.Append("%s,", kLogEventsNames[TICK_EVENT]);
1417 msg.AppendAddress(sample->pc); 1417 msg.AppendAddress(sample->pc);
1418 msg.Append(",%ld", static_cast<int>(timer_.Elapsed().InMicroseconds())); 1418 msg.Append(",%ld", static_cast<int>(timer_.Elapsed().InMicroseconds()));
1419 if (sample->has_external_callback) { 1419 if (sample->has_external_callback) {
1420 msg.Append(",1,"); 1420 msg.Append(",1,");
1421 #if USES_FUNCTION_DESCRIPTORS 1421 msg.AppendAddress(sample->external_callback_entry);
1422 msg.AppendAddress(*FUNCTION_ENTRYPOINT_ADDRESS(sample->external_callback));
1423 #else
1424 msg.AppendAddress(sample->external_callback);
1425 #endif
1426 } else { 1422 } else {
1427 msg.Append(",0,"); 1423 msg.Append(",0,");
1428 msg.AppendAddress(sample->tos); 1424 msg.AppendAddress(sample->tos);
1429 } 1425 }
1430 msg.Append(",%d", static_cast<int>(sample->state)); 1426 msg.Append(",%d", static_cast<int>(sample->state));
1431 if (overflow) { 1427 if (overflow) {
1432 msg.Append(",overflow"); 1428 msg.Append(",overflow");
1433 } 1429 }
1434 for (unsigned i = 0; i < sample->frames_count; ++i) { 1430 for (unsigned i = 0; i < sample->frames_count; ++i) {
1435 msg.Append(','); 1431 msg.Append(',');
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1628 isolate_->heap()->empty_string(), line_num, column_num)); 1624 isolate_->heap()->empty_string(), line_num, column_num));
1629 } 1625 }
1630 } else if (shared->IsApiFunction()) { 1626 } else if (shared->IsApiFunction()) {
1631 // API function. 1627 // API function.
1632 FunctionTemplateInfo* fun_data = shared->get_api_func_data(); 1628 FunctionTemplateInfo* fun_data = shared->get_api_func_data();
1633 Object* raw_call_data = fun_data->call_code(); 1629 Object* raw_call_data = fun_data->call_code();
1634 if (!raw_call_data->IsUndefined()) { 1630 if (!raw_call_data->IsUndefined()) {
1635 CallHandlerInfo* call_data = CallHandlerInfo::cast(raw_call_data); 1631 CallHandlerInfo* call_data = CallHandlerInfo::cast(raw_call_data);
1636 Object* callback_obj = call_data->callback(); 1632 Object* callback_obj = call_data->callback();
1637 Address entry_point = v8::ToCData<Address>(callback_obj); 1633 Address entry_point = v8::ToCData<Address>(callback_obj);
1634 #if USES_FUNCTION_DESCRIPTORS
1635 entry_point = *FUNCTION_ENTRYPOINT_ADDRESS(entry_point);
1636 #endif
1638 PROFILE(isolate_, CallbackEvent(*func_name, entry_point)); 1637 PROFILE(isolate_, CallbackEvent(*func_name, entry_point));
1639 } 1638 }
1640 } else { 1639 } else {
1641 PROFILE(isolate_, 1640 PROFILE(isolate_,
1642 CodeCreateEvent( 1641 CodeCreateEvent(
1643 Logger::LAZY_COMPILE_TAG, *code, *shared, NULL, *func_name)); 1642 Logger::LAZY_COMPILE_TAG, *code, *shared, NULL, *func_name));
1644 } 1643 }
1645 } 1644 }
1646 1645
1647 1646
(...skipping 23 matching lines...) Expand all
1671 "Logger::LogAccessorCallbacks"); 1670 "Logger::LogAccessorCallbacks");
1672 HeapIterator iterator(heap); 1671 HeapIterator iterator(heap);
1673 DisallowHeapAllocation no_gc; 1672 DisallowHeapAllocation no_gc;
1674 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { 1673 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) {
1675 if (!obj->IsAccessorInfo()) continue; 1674 if (!obj->IsAccessorInfo()) continue;
1676 AccessorInfo* ai = AccessorInfo::cast(obj); 1675 AccessorInfo* ai = AccessorInfo::cast(obj);
1677 if (!ai->name()->IsName()) continue; 1676 if (!ai->name()->IsName()) continue;
1678 Address getter_entry = v8::ToCData<Address>(ai->getter()); 1677 Address getter_entry = v8::ToCData<Address>(ai->getter());
1679 Name* name = Name::cast(ai->name()); 1678 Name* name = Name::cast(ai->name());
1680 if (getter_entry != 0) { 1679 if (getter_entry != 0) {
1680 #if USES_FUNCTION_DESCRIPTORS
1681 getter_entry = *FUNCTION_ENTRYPOINT_ADDRESS(getter_entry);
1682 #endif
1681 PROFILE(isolate_, GetterCallbackEvent(name, getter_entry)); 1683 PROFILE(isolate_, GetterCallbackEvent(name, getter_entry));
1682 } 1684 }
1683 Address setter_entry = v8::ToCData<Address>(ai->setter()); 1685 Address setter_entry = v8::ToCData<Address>(ai->setter());
1684 if (setter_entry != 0) { 1686 if (setter_entry != 0) {
1687 #if USES_FUNCTION_DESCRIPTORS
1688 setter_entry = *FUNCTION_ENTRYPOINT_ADDRESS(setter_entry);
1689 #endif
1685 PROFILE(isolate_, SetterCallbackEvent(name, setter_entry)); 1690 PROFILE(isolate_, SetterCallbackEvent(name, setter_entry));
1686 } 1691 }
1687 } 1692 }
1688 } 1693 }
1689 1694
1690 1695
1691 static void AddIsolateIdIfNeeded(std::ostream& os, // NOLINT 1696 static void AddIsolateIdIfNeeded(std::ostream& os, // NOLINT
1692 Isolate* isolate) { 1697 Isolate* isolate) {
1693 if (FLAG_logfile_per_isolate) os << "isolate-" << isolate << "-"; 1698 if (FLAG_logfile_per_isolate) os << "isolate-" << isolate << "-";
1694 } 1699 }
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1836 removeCodeEventListener(jit_logger_); 1841 removeCodeEventListener(jit_logger_);
1837 delete jit_logger_; 1842 delete jit_logger_;
1838 jit_logger_ = NULL; 1843 jit_logger_ = NULL;
1839 } 1844 }
1840 1845
1841 return log_->Close(); 1846 return log_->Close();
1842 } 1847 }
1843 1848
1844 } // namespace internal 1849 } // namespace internal
1845 } // namespace v8 1850 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/profiler/profile-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698