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

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

Issue 16901014: CPUProfiler: Simplify logging part of CreateCodeEvent functions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: comments addressed Created 7 years, 6 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-utils.h ('k') | src/objects.h » ('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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 230
231 231
232 void LogMessageBuilder::Append(const char c) { 232 void LogMessageBuilder::Append(const char c) {
233 if (pos_ < Log::kMessageBufferSize) { 233 if (pos_ < Log::kMessageBufferSize) {
234 log_->message_buffer_[pos_++] = c; 234 log_->message_buffer_[pos_++] = c;
235 } 235 }
236 ASSERT(pos_ <= Log::kMessageBufferSize); 236 ASSERT(pos_ <= Log::kMessageBufferSize);
237 } 237 }
238 238
239 239
240 void LogMessageBuilder::AppendDoubleQuotedString(const char* string) {
241 Append('"');
242 for (const char* p = string; *p != '\0'; p++) {
243 if (*p == '"') {
244 Append('\\');
245 }
246 Append(*p);
247 }
248 Append('"');
249 }
250
251
240 void LogMessageBuilder::Append(String* str) { 252 void LogMessageBuilder::Append(String* str) {
241 DisallowHeapAllocation no_gc; // Ensure string stay valid. 253 DisallowHeapAllocation no_gc; // Ensure string stay valid.
242 int length = str->length(); 254 int length = str->length();
243 for (int i = 0; i < length; i++) { 255 for (int i = 0; i < length; i++) {
244 Append(static_cast<char>(str->Get(i))); 256 Append(static_cast<char>(str->Get(i)));
245 } 257 }
246 } 258 }
247 259
248 260
249 void LogMessageBuilder::AppendAddress(Address addr) { 261 void LogMessageBuilder::AppendAddress(Address addr) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 ASSERT(pos_ <= Log::kMessageBufferSize); 314 ASSERT(pos_ <= Log::kMessageBufferSize);
303 const int written = log_->WriteToFile(log_->message_buffer_, pos_); 315 const int written = log_->WriteToFile(log_->message_buffer_, pos_);
304 if (written != pos_) { 316 if (written != pos_) {
305 log_->stop(); 317 log_->stop();
306 log_->logger_->LogFailure(); 318 log_->logger_->LogFailure();
307 } 319 }
308 } 320 }
309 321
310 322
311 } } // namespace v8::internal 323 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/log-utils.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698