OLD | NEW |
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 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |