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

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

Issue 15691017: Make assertion scopes thread safe. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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
« src/api.cc ('K') | « src/log.cc ('k') | src/mark-compact.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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::Append(String* str) { 240 void LogMessageBuilder::Append(String* str) {
241 AssertNoAllocation no_heap_allocation; // Ensure string stay valid. 241 DisallowHeapAllocation no_gc; // Ensure string stay valid.
242 int length = str->length(); 242 int length = str->length();
243 for (int i = 0; i < length; i++) { 243 for (int i = 0; i < length; i++) {
244 Append(static_cast<char>(str->Get(i))); 244 Append(static_cast<char>(str->Get(i)));
245 } 245 }
246 } 246 }
247 247
248 248
249 void LogMessageBuilder::AppendAddress(Address addr) { 249 void LogMessageBuilder::AppendAddress(Address addr) {
250 Append("0x%" V8PRIxPTR, addr); 250 Append("0x%" V8PRIxPTR, addr);
251 } 251 }
252 252
253 253
254 void LogMessageBuilder::AppendDetailed(String* str, bool show_impl_info) { 254 void LogMessageBuilder::AppendDetailed(String* str, bool show_impl_info) {
255 if (str == NULL) return; 255 if (str == NULL) return;
256 AssertNoAllocation no_heap_allocation; // Ensure string stay valid. 256 DisallowHeapAllocation no_gc; // Ensure string stay valid.
257 int len = str->length(); 257 int len = str->length();
258 if (len > 0x1000) 258 if (len > 0x1000)
259 len = 0x1000; 259 len = 0x1000;
260 if (show_impl_info) { 260 if (show_impl_info) {
261 Append(str->IsOneByteRepresentation() ? 'a' : '2'); 261 Append(str->IsOneByteRepresentation() ? 'a' : '2');
262 if (StringShape(str).IsExternal()) 262 if (StringShape(str).IsExternal())
263 Append('e'); 263 Append('e');
264 if (StringShape(str).IsInternalized()) 264 if (StringShape(str).IsInternalized())
265 Append('#'); 265 Append('#');
266 Append(":%i:", str->length()); 266 Append(":%i:", str->length());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 ASSERT(pos_ <= Log::kMessageBufferSize); 302 ASSERT(pos_ <= Log::kMessageBufferSize);
303 const int written = log_->WriteToFile(log_->message_buffer_, pos_); 303 const int written = log_->WriteToFile(log_->message_buffer_, pos_);
304 if (written != pos_) { 304 if (written != pos_) {
305 log_->stop(); 305 log_->stop();
306 log_->logger_->LogFailure(); 306 log_->logger_->LogFailure();
307 } 307 }
308 } 308 }
309 309
310 310
311 } } // namespace v8::internal 311 } } // namespace v8::internal
OLDNEW
« src/api.cc ('K') | « src/log.cc ('k') | src/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698