| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 // --prof implies --log-code. | 73 // --prof implies --log-code. |
| 74 if (FLAG_prof) FLAG_log_code = true; | 74 if (FLAG_prof) FLAG_log_code = true; |
| 75 | 75 |
| 76 // --prof_lazy controls --log-code, implies --noprof_auto. | 76 // --prof_lazy controls --log-code, implies --noprof_auto. |
| 77 if (FLAG_prof_lazy) { | 77 if (FLAG_prof_lazy) { |
| 78 FLAG_log_code = false; | 78 FLAG_log_code = false; |
| 79 FLAG_prof_auto = false; | 79 FLAG_prof_auto = false; |
| 80 } | 80 } |
| 81 | 81 |
| 82 bool open_log_file = FLAG_log || FLAG_log_runtime || FLAG_log_api | |
| 83 || FLAG_log_code || FLAG_log_gc || FLAG_log_handles || FLAG_log_suspect | |
| 84 || FLAG_log_regexp || FLAG_log_state_changes || FLAG_ll_prof | |
| 85 || FLAG_log_internal_timer_events; | |
| 86 | |
| 87 // If we're logging anything, we need to open the log file. | 82 // If we're logging anything, we need to open the log file. |
| 88 if (open_log_file) { | 83 if (Log::InitLogAtStart()) { |
| 89 if (strcmp(FLAG_logfile, "-") == 0) { | 84 if (strcmp(FLAG_logfile, "-") == 0) { |
| 90 OpenStdout(); | 85 OpenStdout(); |
| 91 } else if (strcmp(FLAG_logfile, kLogToTemporaryFile) == 0) { | 86 } else if (strcmp(FLAG_logfile, kLogToTemporaryFile) == 0) { |
| 92 OpenTemporaryFile(); | 87 OpenTemporaryFile(); |
| 93 } else { | 88 } else { |
| 94 if (strchr(FLAG_logfile, '%') != NULL || | 89 if (strchr(FLAG_logfile, '%') != NULL || |
| 95 !Isolate::Current()->IsDefaultIsolate()) { | 90 !Isolate::Current()->IsDefaultIsolate()) { |
| 96 // If there's a '%' in the log file name we have to expand | 91 // If there's a '%' in the log file name we have to expand |
| 97 // placeholders. | 92 // placeholders. |
| 98 HeapStringAllocator allocator; | 93 HeapStringAllocator allocator; |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 ASSERT(pos_ <= Log::kMessageBufferSize); | 302 ASSERT(pos_ <= Log::kMessageBufferSize); |
| 308 const int written = log_->WriteToFile(log_->message_buffer_, pos_); | 303 const int written = log_->WriteToFile(log_->message_buffer_, pos_); |
| 309 if (written != pos_) { | 304 if (written != pos_) { |
| 310 log_->stop(); | 305 log_->stop(); |
| 311 log_->logger_->LogFailure(); | 306 log_->logger_->LogFailure(); |
| 312 } | 307 } |
| 313 } | 308 } |
| 314 | 309 |
| 315 | 310 |
| 316 } } // namespace v8::internal | 311 } } // namespace v8::internal |
| OLD | NEW |