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

Side by Side Diff: src/log.cc

Issue 151603004: A64: Synchronize with r16587. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/liveedit.cc ('k') | src/macros.py » ('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 956 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 void Logger::LogRuntime(Vector<const char> format, 967 void Logger::LogRuntime(Vector<const char> format,
968 JSArray* args) { 968 JSArray* args) {
969 if (!log_->IsEnabled() || !FLAG_log_runtime) return; 969 if (!log_->IsEnabled() || !FLAG_log_runtime) return;
970 HandleScope scope(isolate_); 970 HandleScope scope(isolate_);
971 Log::MessageBuilder msg(log_); 971 Log::MessageBuilder msg(log_);
972 for (int i = 0; i < format.length(); i++) { 972 for (int i = 0; i < format.length(); i++) {
973 char c = format[i]; 973 char c = format[i];
974 if (c == '%' && i <= format.length() - 2) { 974 if (c == '%' && i <= format.length() - 2) {
975 i++; 975 i++;
976 ASSERT('0' <= format[i] && format[i] <= '9'); 976 ASSERT('0' <= format[i] && format[i] <= '9');
977 MaybeObject* maybe = args->GetElement(format[i] - '0'); 977 MaybeObject* maybe = args->GetElement(isolate_, format[i] - '0');
978 Object* obj; 978 Object* obj;
979 if (!maybe->ToObject(&obj)) { 979 if (!maybe->ToObject(&obj)) {
980 msg.Append("<exception>"); 980 msg.Append("<exception>");
981 continue; 981 continue;
982 } 982 }
983 i++; 983 i++;
984 switch (format[i]) { 984 switch (format[i]) {
985 case 's': 985 case 's':
986 msg.AppendDetailed(String::cast(obj), false); 986 msg.AppendDetailed(String::cast(obj), false);
987 break; 987 break;
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 PROFILE(isolate_, GetterCallbackEvent(name, getter_entry)); 1757 PROFILE(isolate_, GetterCallbackEvent(name, getter_entry));
1758 } 1758 }
1759 Address setter_entry = v8::ToCData<Address>(ai->setter()); 1759 Address setter_entry = v8::ToCData<Address>(ai->setter());
1760 if (setter_entry != 0) { 1760 if (setter_entry != 0) {
1761 PROFILE(isolate_, SetterCallbackEvent(name, setter_entry)); 1761 PROFILE(isolate_, SetterCallbackEvent(name, setter_entry));
1762 } 1762 }
1763 } 1763 }
1764 } 1764 }
1765 1765
1766 1766
1767 static void AddIsolateIdIfNeeded(StringStream* stream) { 1767 static void AddIsolateIdIfNeeded(Isolate* isolate, StringStream* stream) {
1768 Isolate* isolate = Isolate::Current();
1769 if (isolate->IsDefaultIsolate()) return; 1768 if (isolate->IsDefaultIsolate()) return;
1770 stream->Add("isolate-%p-", isolate); 1769 stream->Add("isolate-%p-", isolate);
1771 } 1770 }
1772 1771
1773 1772
1774 static SmartArrayPointer<const char> PrepareLogFileName(const char* file_name) { 1773 static SmartArrayPointer<const char> PrepareLogFileName(
1774 Isolate* isolate, const char* file_name) {
1775 if (strchr(file_name, '%') != NULL || 1775 if (strchr(file_name, '%') != NULL ||
1776 !Isolate::Current()->IsDefaultIsolate()) { 1776 !isolate->IsDefaultIsolate()) {
1777 // If there's a '%' in the log file name we have to expand 1777 // If there's a '%' in the log file name we have to expand
1778 // placeholders. 1778 // placeholders.
1779 HeapStringAllocator allocator; 1779 HeapStringAllocator allocator;
1780 StringStream stream(&allocator); 1780 StringStream stream(&allocator);
1781 AddIsolateIdIfNeeded(&stream); 1781 AddIsolateIdIfNeeded(isolate, &stream);
1782 for (const char* p = file_name; *p; p++) { 1782 for (const char* p = file_name; *p; p++) {
1783 if (*p == '%') { 1783 if (*p == '%') {
1784 p++; 1784 p++;
1785 switch (*p) { 1785 switch (*p) {
1786 case '\0': 1786 case '\0':
1787 // If there's a % at the end of the string we back up 1787 // If there's a % at the end of the string we back up
1788 // one character so we can escape the loop properly. 1788 // one character so we can escape the loop properly.
1789 p--; 1789 p--;
1790 break; 1790 break;
1791 case 'p': 1791 case 'p':
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1825 // 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.
1826 if (is_initialized_) return true; 1826 if (is_initialized_) return true;
1827 is_initialized_ = true; 1827 is_initialized_ = true;
1828 1828
1829 // --ll-prof implies --log-code and --log-snapshot-positions. 1829 // --ll-prof implies --log-code and --log-snapshot-positions.
1830 if (FLAG_ll_prof) { 1830 if (FLAG_ll_prof) {
1831 FLAG_log_snapshot_positions = true; 1831 FLAG_log_snapshot_positions = true;
1832 } 1832 }
1833 1833
1834 SmartArrayPointer<const char> log_file_name = 1834 SmartArrayPointer<const char> log_file_name =
1835 PrepareLogFileName(FLAG_logfile); 1835 PrepareLogFileName(isolate, FLAG_logfile);
1836 log_->Initialize(*log_file_name); 1836 log_->Initialize(*log_file_name);
1837 1837
1838 if (FLAG_ll_prof) { 1838 if (FLAG_ll_prof) {
1839 ll_logger_ = new LowLevelLogger(*log_file_name); 1839 ll_logger_ = new LowLevelLogger(*log_file_name);
1840 addCodeEventListener(ll_logger_); 1840 addCodeEventListener(ll_logger_);
1841 } 1841 }
1842 1842
1843 ticker_ = new Ticker(isolate, kSamplingIntervalMs); 1843 ticker_ = new Ticker(isolate, kSamplingIntervalMs);
1844 1844
1845 if (Log::InitLogAtStart()) { 1845 if (Log::InitLogAtStart()) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1906 if (jit_logger_) { 1906 if (jit_logger_) {
1907 removeCodeEventListener(jit_logger_); 1907 removeCodeEventListener(jit_logger_);
1908 delete jit_logger_; 1908 delete jit_logger_;
1909 jit_logger_ = NULL; 1909 jit_logger_ = NULL;
1910 } 1910 }
1911 1911
1912 return log_->Close(); 1912 return log_->Close();
1913 } 1913 }
1914 1914
1915 } } // namespace v8::internal 1915 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/liveedit.cc ('k') | src/macros.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698