Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: src/log-utils.cc

Issue 13932006: Replace OS::MemCopy with OS::MemMove (just as fast but more flexible). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/log.cc ('k') | src/mips/assembler-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 static const int kLowLevelLogBufferSize = 2 * MB; 160 static const int kLowLevelLogBufferSize = 2 * MB;
161 161
162 162
163 void Log::OpenFile(const char* name) { 163 void Log::OpenFile(const char* name) {
164 ASSERT(!IsEnabled()); 164 ASSERT(!IsEnabled());
165 output_handle_ = OS::FOpen(name, OS::LogFileOpenMode); 165 output_handle_ = OS::FOpen(name, OS::LogFileOpenMode);
166 if (FLAG_ll_prof) { 166 if (FLAG_ll_prof) {
167 // Open the low-level log file. 167 // Open the low-level log file.
168 size_t len = strlen(name); 168 size_t len = strlen(name);
169 ScopedVector<char> ll_name(static_cast<int>(len + sizeof(kLowLevelLogExt))); 169 ScopedVector<char> ll_name(static_cast<int>(len + sizeof(kLowLevelLogExt)));
170 memcpy(ll_name.start(), name, len); 170 OS::MemCopy(ll_name.start(), name, len);
171 memcpy(ll_name.start() + len, kLowLevelLogExt, sizeof(kLowLevelLogExt)); 171 OS::MemCopy(ll_name.start() + len,
172 kLowLevelLogExt, sizeof(kLowLevelLogExt));
172 ll_output_handle_ = OS::FOpen(ll_name.start(), OS::LogFileOpenMode); 173 ll_output_handle_ = OS::FOpen(ll_name.start(), OS::LogFileOpenMode);
173 setvbuf(ll_output_handle_, NULL, _IOFBF, kLowLevelLogBufferSize); 174 setvbuf(ll_output_handle_, NULL, _IOFBF, kLowLevelLogBufferSize);
174 } 175 }
175 } 176 }
176 177
177 178
178 FILE* Log::Close() { 179 FILE* Log::Close() {
179 FILE* result = NULL; 180 FILE* result = NULL;
180 if (output_handle_ != NULL) { 181 if (output_handle_ != NULL) {
181 if (strcmp(FLAG_logfile, kLogToTemporaryFile) != 0) { 182 if (strcmp(FLAG_logfile, kLogToTemporaryFile) != 0) {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 ASSERT(pos_ <= Log::kMessageBufferSize); 307 ASSERT(pos_ <= Log::kMessageBufferSize);
307 const int written = log_->WriteToFile(log_->message_buffer_, pos_); 308 const int written = log_->WriteToFile(log_->message_buffer_, pos_);
308 if (written != pos_) { 309 if (written != pos_) {
309 log_->stop(); 310 log_->stop();
310 log_->logger_->LogFailure(); 311 log_->logger_->LogFailure();
311 } 312 }
312 } 313 }
313 314
314 315
315 } } // namespace v8::internal 316 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/log.cc ('k') | src/mips/assembler-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698