OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 LogMessageBuilder::LogMessageBuilder(): sl(Log::mutex_), pos_(0) { | 208 LogMessageBuilder::LogMessageBuilder(): sl(Log::mutex_), pos_(0) { |
209 ASSERT(Log::message_buffer_ != NULL); | 209 ASSERT(Log::message_buffer_ != NULL); |
210 } | 210 } |
211 | 211 |
212 | 212 |
213 void LogMessageBuilder::Append(const char* format, ...) { | 213 void LogMessageBuilder::Append(const char* format, ...) { |
214 Vector<char> buf(Log::message_buffer_ + pos_, | 214 Vector<char> buf(Log::message_buffer_ + pos_, |
215 Log::kMessageBufferSize - pos_); | 215 Log::kMessageBufferSize - pos_); |
216 va_list args; | 216 va_list args; |
217 va_start(args, format); | 217 va_start(args, format); |
218 Append(format, args); | 218 AppendVA(format, args); |
219 va_end(args); | 219 va_end(args); |
220 ASSERT(pos_ <= Log::kMessageBufferSize); | 220 ASSERT(pos_ <= Log::kMessageBufferSize); |
221 } | 221 } |
222 | 222 |
223 | 223 |
224 void LogMessageBuilder::Append(const char* format, va_list args) { | 224 void LogMessageBuilder::AppendVA(const char* format, va_list args) { |
225 Vector<char> buf(Log::message_buffer_ + pos_, | 225 Vector<char> buf(Log::message_buffer_ + pos_, |
226 Log::kMessageBufferSize - pos_); | 226 Log::kMessageBufferSize - pos_); |
227 int result = v8::internal::OS::VSNPrintF(buf, format, args); | 227 int result = v8::internal::OS::VSNPrintF(buf, format, args); |
228 | 228 |
229 // Result is -1 if output was truncated. | 229 // Result is -1 if output was truncated. |
230 if (result >= 0) { | 230 if (result >= 0) { |
231 pos_ += result; | 231 pos_ += result; |
232 } else { | 232 } else { |
233 pos_ = Log::kMessageBufferSize; | 233 pos_ = Log::kMessageBufferSize; |
234 } | 234 } |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 PrintBackwardReference(backref, best.distance, best.copy_from_pos); | 474 PrintBackwardReference(backref, best.distance, best.copy_from_pos); |
475 ASSERT(strlen(backref.start()) - best.backref_size == 0); | 475 ASSERT(strlen(backref.start()) - best.backref_size == 0); |
476 prev_record->Truncate(unchanged_len + best.backref_size); | 476 prev_record->Truncate(unchanged_len + best.backref_size); |
477 } | 477 } |
478 return true; | 478 return true; |
479 } | 479 } |
480 | 480 |
481 #endif // ENABLE_LOGGING_AND_PROFILING | 481 #endif // ENABLE_LOGGING_AND_PROFILING |
482 | 482 |
483 } } // namespace v8::internal | 483 } } // namespace v8::internal |
OLD | NEW |