| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 if (block_write_pos_ == block_size_) { | 113 if (block_write_pos_ == block_size_) { |
| 114 block_write_pos_ = 0; | 114 block_write_pos_ = 0; |
| 115 AllocateBlock(++block_index_); | 115 AllocateBlock(++block_index_); |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 write_pos_ += data_size; | 118 write_pos_ += data_size; |
| 119 return data_size; | 119 return data_size; |
| 120 } | 120 } |
| 121 | 121 |
| 122 // Must be the same message as in Logger::PauseProfiler. | 122 // Must be the same message as in Logger::PauseProfiler. |
| 123 const char* Log::kDynamicBufferSeal = "profiler,\"pause\"\n"; | 123 const char* const Log::kDynamicBufferSeal = "profiler,\"pause\"\n"; |
| 124 | 124 |
| 125 Log::Log(Logger* logger) | 125 Log::Log(Logger* logger) |
| 126 : write_to_file_(false), | 126 : write_to_file_(false), |
| 127 is_stopped_(false), | 127 is_stopped_(false), |
| 128 output_handle_(NULL), | 128 output_handle_(NULL), |
| 129 output_buffer_(NULL), | 129 output_buffer_(NULL), |
| 130 mutex_(NULL), | 130 mutex_(NULL), |
| 131 message_buffer_(NULL), | 131 message_buffer_(NULL), |
| 132 logger_(logger) { | 132 logger_(logger) { |
| 133 } | 133 } |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 log_->WriteToMemory(log_->message_buffer_, pos_); | 432 log_->WriteToMemory(log_->message_buffer_, pos_); |
| 433 if (written != pos_) { | 433 if (written != pos_) { |
| 434 log_->stop(); | 434 log_->stop(); |
| 435 log_->logger_->LogFailure(); | 435 log_->logger_->LogFailure(); |
| 436 } | 436 } |
| 437 } | 437 } |
| 438 | 438 |
| 439 | 439 |
| 440 // Formatting string for back references to the whole line. E.g. "#2" means | 440 // Formatting string for back references to the whole line. E.g. "#2" means |
| 441 // "the second line above". | 441 // "the second line above". |
| 442 const char* LogRecordCompressor::kLineBackwardReferenceFormat = "#%d"; | 442 const char* const LogRecordCompressor::kLineBackwardReferenceFormat = "#%d"; |
| 443 | 443 |
| 444 // Formatting string for back references. E.g. "#2:10" means | 444 // Formatting string for back references. E.g. "#2:10" means |
| 445 // "the second line above, start from char 10 (0-based)". | 445 // "the second line above, start from char 10 (0-based)". |
| 446 const char* LogRecordCompressor::kBackwardReferenceFormat = "#%d:%d"; | 446 const char* const LogRecordCompressor::kBackwardReferenceFormat = "#%d:%d"; |
| 447 | 447 |
| 448 | 448 |
| 449 LogRecordCompressor::~LogRecordCompressor() { | 449 LogRecordCompressor::~LogRecordCompressor() { |
| 450 for (int i = 0; i < buffer_.length(); ++i) { | 450 for (int i = 0; i < buffer_.length(); ++i) { |
| 451 buffer_[i].Dispose(); | 451 buffer_[i].Dispose(); |
| 452 } | 452 } |
| 453 } | 453 } |
| 454 | 454 |
| 455 | 455 |
| 456 static int GetNumberLength(int number) { | 456 static int GetNumberLength(int number) { |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 PrintBackwardReference(backref, best.distance, best.copy_from_pos); | 571 PrintBackwardReference(backref, best.distance, best.copy_from_pos); |
| 572 ASSERT(strlen(backref.start()) - best.backref_size == 0); | 572 ASSERT(strlen(backref.start()) - best.backref_size == 0); |
| 573 prev_record->Truncate(static_cast<int>(unchanged_len + best.backref_size)); | 573 prev_record->Truncate(static_cast<int>(unchanged_len + best.backref_size)); |
| 574 } | 574 } |
| 575 return true; | 575 return true; |
| 576 } | 576 } |
| 577 | 577 |
| 578 #endif // ENABLE_LOGGING_AND_PROFILING | 578 #endif // ENABLE_LOGGING_AND_PROFILING |
| 579 | 579 |
| 580 } } // namespace v8::internal | 580 } } // namespace v8::internal |
| OLD | NEW |