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

Side by Side Diff: src/log.cc

Issue 14139033: Clean up VMState a little bit. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fixed mistake Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « src/log.h ('k') | src/log-utils.h » ('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 // 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 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 ASSERT(FLAG_log_internal_timer_events); 651 ASSERT(FLAG_log_internal_timer_events);
652 LogMessageBuilder msg(this); 652 LogMessageBuilder msg(this);
653 int since_epoch = static_cast<int>(OS::Ticks() - epoch_); 653 int since_epoch = static_cast<int>(OS::Ticks() - epoch_);
654 const char* format = (se == START) ? "timer-event-start,\"%s\",%ld\n" 654 const char* format = (se == START) ? "timer-event-start,\"%s\",%ld\n"
655 : "timer-event-end,\"%s\",%ld\n"; 655 : "timer-event-end,\"%s\",%ld\n";
656 msg.Append(format, name, since_epoch); 656 msg.Append(format, name, since_epoch);
657 msg.WriteToLogFile(); 657 msg.WriteToLogFile();
658 } 658 }
659 659
660 660
661 void Logger::EnterExternal() { 661 void Logger::EnterExternal(Isolate* isolate) {
662 LOG(ISOLATE, TimerEvent(START, TimerEventScope::v8_external)); 662 LOG(isolate, TimerEvent(START, TimerEventScope::v8_external));
663 ASSERT(isolate->current_vm_state() == JS);
664 isolate->set_current_vm_state(EXTERNAL);
663 } 665 }
664 666
665 667
666 void Logger::LeaveExternal() { 668 void Logger::LeaveExternal(Isolate* isolate) {
667 LOG(ISOLATE, TimerEvent(END, TimerEventScope::v8_external)); 669 LOG(isolate, TimerEvent(END, TimerEventScope::v8_external));
670 ASSERT(isolate->current_vm_state() == EXTERNAL);
671 isolate->set_current_vm_state(JS);
668 } 672 }
669 673
670 674
671 void Logger::TimerEventScope::LogTimerEvent(StartEnd se) { 675 void Logger::TimerEventScope::LogTimerEvent(StartEnd se) {
672 LOG(isolate_, TimerEvent(se, name_)); 676 LOG(isolate_, TimerEvent(se, name_));
673 } 677 }
674 678
675 679
676 const char* Logger::TimerEventScope::v8_recompile_synchronous = 680 const char* Logger::TimerEventScope::v8_recompile_synchronous =
677 "V8.RecompileSynchronous"; 681 "V8.RecompileSynchronous";
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1810 PROFILE(isolate_, GetterCallbackEvent(name, getter_entry)); 1814 PROFILE(isolate_, GetterCallbackEvent(name, getter_entry));
1811 } 1815 }
1812 Address setter_entry = v8::ToCData<Address>(ai->setter()); 1816 Address setter_entry = v8::ToCData<Address>(ai->setter());
1813 if (setter_entry != 0) { 1817 if (setter_entry != 0) {
1814 PROFILE(isolate_, SetterCallbackEvent(name, setter_entry)); 1818 PROFILE(isolate_, SetterCallbackEvent(name, setter_entry));
1815 } 1819 }
1816 } 1820 }
1817 } 1821 }
1818 1822
1819 1823
1820 bool Logger::SetUp() { 1824 bool Logger::SetUp(Isolate* isolate) {
1821 // Tests and EnsureInitialize() can call this twice in a row. It's harmless. 1825 // Tests and EnsureInitialize() can call this twice in a row. It's harmless.
1822 if (is_initialized_) return true; 1826 if (is_initialized_) return true;
1823 is_initialized_ = true; 1827 is_initialized_ = true;
1824 1828
1825 // --ll-prof implies --log-code and --log-snapshot-positions. 1829 // --ll-prof implies --log-code and --log-snapshot-positions.
1826 if (FLAG_ll_prof) { 1830 if (FLAG_ll_prof) {
1827 FLAG_log_snapshot_positions = true; 1831 FLAG_log_snapshot_positions = true;
1828 } 1832 }
1829 1833
1830 // --prof_lazy controls --log-code, implies --noprof_auto. 1834 // --prof_lazy controls --log-code, implies --noprof_auto.
1831 if (FLAG_prof_lazy) { 1835 if (FLAG_prof_lazy) {
1832 FLAG_log_code = false; 1836 FLAG_log_code = false;
1833 FLAG_prof_auto = false; 1837 FLAG_prof_auto = false;
1834 } 1838 }
1835 1839
1836 // TODO(isolates): this assert introduces cyclic dependency (logger
1837 // -> thread local top -> heap -> logger).
1838 // ASSERT(VMState::is_outermost_external());
1839
1840 log_->Initialize(); 1840 log_->Initialize();
1841 1841
1842 if (FLAG_ll_prof) LogCodeInfo(); 1842 if (FLAG_ll_prof) LogCodeInfo();
1843 1843
1844 Isolate* isolate = Isolate::Current();
1845 ticker_ = new Ticker(isolate, kSamplingIntervalMs); 1844 ticker_ = new Ticker(isolate, kSamplingIntervalMs);
1846 1845
1847 bool start_logging = FLAG_log || FLAG_log_runtime || FLAG_log_api 1846 if (Log::InitLogAtStart()) {
1848 || FLAG_log_code || FLAG_log_gc || FLAG_log_handles || FLAG_log_suspect
1849 || FLAG_log_regexp || FLAG_log_state_changes || FLAG_ll_prof
1850 || FLAG_log_internal_timer_events;
1851
1852 if (start_logging) {
1853 logging_nesting_ = 1; 1847 logging_nesting_ = 1;
1854 } 1848 }
1855 1849
1856 if (FLAG_prof) { 1850 if (FLAG_prof) {
1857 profiler_ = new Profiler(isolate); 1851 profiler_ = new Profiler(isolate);
1858 if (!FLAG_prof_auto) { 1852 if (!FLAG_prof_auto) {
1859 profiler_->pause(); 1853 profiler_->pause();
1860 } else { 1854 } else {
1861 logging_nesting_ = 1; 1855 logging_nesting_ = 1;
1862 } 1856 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1899 profiler_ = NULL; 1893 profiler_ = NULL;
1900 } 1894 }
1901 1895
1902 delete ticker_; 1896 delete ticker_;
1903 ticker_ = NULL; 1897 ticker_ = NULL;
1904 1898
1905 return log_->Close(); 1899 return log_->Close();
1906 } 1900 }
1907 1901
1908 } } // namespace v8::internal 1902 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/log.h ('k') | src/log-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698