OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 // Whether logging is stopped (e.g. due to insufficient resources). | 145 // Whether logging is stopped (e.g. due to insufficient resources). |
146 static bool is_stopped_; | 146 static bool is_stopped_; |
147 | 147 |
148 // When logging is active, either output_handle_ or output_buffer_ is used | 148 // When logging is active, either output_handle_ or output_buffer_ is used |
149 // to store a pointer to log destination. If logging was opened via OpenStdout | 149 // to store a pointer to log destination. If logging was opened via OpenStdout |
150 // or OpenFile, then output_handle_ is used. If logging was opened | 150 // or OpenFile, then output_handle_ is used. If logging was opened |
151 // via OpenMemoryBuffer, then output_buffer_ is used. | 151 // via OpenMemoryBuffer, then output_buffer_ is used. |
152 // mutex_ should be acquired before using output_handle_ or output_buffer_. | 152 // mutex_ should be acquired before using output_handle_ or output_buffer_. |
153 static FILE* output_handle_; | 153 static FILE* output_handle_; |
154 | 154 |
| 155 // Used when low-level profiling is active to save code object contents. |
| 156 static FILE* output_code_handle_; |
| 157 |
155 static LogDynamicBuffer* output_buffer_; | 158 static LogDynamicBuffer* output_buffer_; |
156 | 159 |
157 // Size of dynamic buffer block (and dynamic buffer initial size). | 160 // Size of dynamic buffer block (and dynamic buffer initial size). |
158 static const int kDynamicBufferBlockSize = 65536; | 161 static const int kDynamicBufferBlockSize = 65536; |
159 | 162 |
160 // Maximum size of dynamic buffer. | 163 // Maximum size of dynamic buffer. |
161 static const int kMaxDynamicBufferSize = 50 * 1024 * 1024; | 164 static const int kMaxDynamicBufferSize = 50 * 1024 * 1024; |
162 | 165 |
163 // Message to "seal" dynamic buffer with. | 166 // Message to "seal" dynamic buffer with. |
164 static const char* kDynamicBufferSeal; | 167 static const char* kDynamicBufferSeal; |
165 | 168 |
166 // mutex_ is a Mutex used for enforcing exclusive | 169 // mutex_ is a Mutex used for enforcing exclusive |
167 // access to the formatting buffer and the log file or log memory buffer. | 170 // access to the formatting buffer and the log file or log memory buffer. |
168 static Mutex* mutex_; | 171 static Mutex* mutex_; |
169 | 172 |
170 // Buffer used for formatting log messages. This is a singleton buffer and | 173 // Buffer used for formatting log messages. This is a singleton buffer and |
171 // mutex_ should be acquired before using it. | 174 // mutex_ should be acquired before using it. |
172 static char* message_buffer_; | 175 static char* message_buffer_; |
173 | 176 |
| 177 friend class Logger; |
174 friend class LogMessageBuilder; | 178 friend class LogMessageBuilder; |
175 friend class LogRecordCompressor; | 179 friend class LogRecordCompressor; |
176 }; | 180 }; |
177 | 181 |
178 | 182 |
179 // An utility class for performing backward reference compression | 183 // An utility class for performing backward reference compression |
180 // of string ends. It operates using a window of previous strings. | 184 // of string ends. It operates using a window of previous strings. |
181 class LogRecordCompressor { | 185 class LogRecordCompressor { |
182 public: | 186 public: |
183 // 'window_size' is the size of backward lookup window. | 187 // 'window_size' is the size of backward lookup window. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 | 285 |
282 ScopedLock sl; | 286 ScopedLock sl; |
283 int pos_; | 287 int pos_; |
284 }; | 288 }; |
285 | 289 |
286 #endif // ENABLE_LOGGING_AND_PROFILING | 290 #endif // ENABLE_LOGGING_AND_PROFILING |
287 | 291 |
288 } } // namespace v8::internal | 292 } } // namespace v8::internal |
289 | 293 |
290 #endif // V8_LOG_UTILS_H_ | 294 #endif // V8_LOG_UTILS_H_ |
OLD | NEW |