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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 | 344 |
345 void LogMessageBuilder::WriteToLogFile() { | 345 void LogMessageBuilder::WriteToLogFile() { |
346 ASSERT(pos_ <= Log::kMessageBufferSize); | 346 ASSERT(pos_ <= Log::kMessageBufferSize); |
347 const int written = Log::Write(Log::message_buffer_, pos_); | 347 const int written = Log::Write(Log::message_buffer_, pos_); |
348 if (written != pos_ && write_failure_handler != NULL) { | 348 if (written != pos_ && write_failure_handler != NULL) { |
349 write_failure_handler(); | 349 write_failure_handler(); |
350 } | 350 } |
351 } | 351 } |
352 | 352 |
353 | 353 |
354 void LogMessageBuilder::WriteCStringToLogFile(const char* str) { | |
355 const int len = StrLength(str); | |
356 const int written = Log::Write(str, len); | |
357 if (written != len && write_failure_handler != NULL) { | |
358 write_failure_handler(); | |
359 } | |
360 } | |
361 | |
362 | |
363 // Formatting string for back references to the whole line. E.g. "#2" means | 354 // Formatting string for back references to the whole line. E.g. "#2" means |
364 // "the second line above". | 355 // "the second line above". |
365 const char* LogRecordCompressor::kLineBackwardReferenceFormat = "#%d"; | 356 const char* LogRecordCompressor::kLineBackwardReferenceFormat = "#%d"; |
366 | 357 |
367 // Formatting string for back references. E.g. "#2:10" means | 358 // Formatting string for back references. E.g. "#2:10" means |
368 // "the second line above, start from char 10 (0-based)". | 359 // "the second line above, start from char 10 (0-based)". |
369 const char* LogRecordCompressor::kBackwardReferenceFormat = "#%d:%d"; | 360 const char* LogRecordCompressor::kBackwardReferenceFormat = "#%d:%d"; |
370 | 361 |
371 | 362 |
372 LogRecordCompressor::~LogRecordCompressor() { | 363 LogRecordCompressor::~LogRecordCompressor() { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 PrintBackwardReference(backref, best.distance, best.copy_from_pos); | 485 PrintBackwardReference(backref, best.distance, best.copy_from_pos); |
495 ASSERT(strlen(backref.start()) - best.backref_size == 0); | 486 ASSERT(strlen(backref.start()) - best.backref_size == 0); |
496 prev_record->Truncate(static_cast<int>(unchanged_len + best.backref_size)); | 487 prev_record->Truncate(static_cast<int>(unchanged_len + best.backref_size)); |
497 } | 488 } |
498 return true; | 489 return true; |
499 } | 490 } |
500 | 491 |
501 #endif // ENABLE_LOGGING_AND_PROFILING | 492 #endif // ENABLE_LOGGING_AND_PROFILING |
502 | 493 |
503 } } // namespace v8::internal | 494 } } // namespace v8::internal |
OLD | NEW |