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

Side by Side Diff: src/log.cc

Issue 45010: Remove all uses of StringShape variables, since that has proven... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 9 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/jsregexp.cc ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 if (pos_ < Logger::kMessageBufferSize) { 355 if (pos_ < Logger::kMessageBufferSize) {
356 Logger::message_buffer_[pos_++] = c; 356 Logger::message_buffer_[pos_++] = c;
357 } 357 }
358 ASSERT(pos_ <= Logger::kMessageBufferSize); 358 ASSERT(pos_ <= Logger::kMessageBufferSize);
359 } 359 }
360 360
361 361
362 // Append a heap string. 362 // Append a heap string.
363 void LogMessageBuilder::Append(String* str) { 363 void LogMessageBuilder::Append(String* str) {
364 AssertNoAllocation no_heap_allocation; // Ensure string stay valid. 364 AssertNoAllocation no_heap_allocation; // Ensure string stay valid.
365 StringShape shape(str); 365 int length = str->length();
366 int length = str->length(shape);
367 for (int i = 0; i < length; i++) { 366 for (int i = 0; i < length; i++) {
368 Append(static_cast<char>(str->Get(shape, i))); 367 Append(static_cast<char>(str->Get(i)));
369 } 368 }
370 } 369 }
371 370
372 void LogMessageBuilder::AppendDetailed(String* str, bool show_impl_info) { 371 void LogMessageBuilder::AppendDetailed(String* str, bool show_impl_info) {
373 AssertNoAllocation no_heap_allocation; // Ensure string stay valid. 372 AssertNoAllocation no_heap_allocation; // Ensure string stay valid.
374 StringShape shape(str); 373 int len = str->length();
375 int len = str->length(shape);
376 if (len > 0x1000) 374 if (len > 0x1000)
377 len = 0x1000; 375 len = 0x1000;
378 if (show_impl_info) { 376 if (show_impl_info) {
379 Append(shape.IsAsciiRepresentation() ? 'a' : '2'); 377 Append(StringShape(str).IsAsciiRepresentation() ? 'a' : '2');
380 if (shape.IsExternal()) 378 if (StringShape(str).IsExternal())
381 Append('e'); 379 Append('e');
382 if (shape.IsSymbol()) 380 if (StringShape(str).IsSymbol())
383 Append('#'); 381 Append('#');
384 Append(":%i:", str->length()); 382 Append(":%i:", str->length());
385 } 383 }
386 for (int i = 0; i < len; i++) { 384 for (int i = 0; i < len; i++) {
387 uc32 c = str->Get(shape, i); 385 uc32 c = str->Get(i);
388 if (c > 0xff) { 386 if (c > 0xff) {
389 Append("\\u%04x", c); 387 Append("\\u%04x", c);
390 } else if (c < 32 || c > 126) { 388 } else if (c < 32 || c > 126) {
391 Append("\\x%02x", c); 389 Append("\\x%02x", c);
392 } else if (c == ',') { 390 } else if (c == ',') {
393 Append("\\,"); 391 Append("\\,");
394 } else if (c == '\\') { 392 } else if (c == '\\') {
395 Append("\\\\"); 393 Append("\\\\");
396 } else { 394 } else {
397 Append("%lc", c); 395 Append("%lc", c);
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 if (FLAG_log_state_changes) { 1139 if (FLAG_log_state_changes) {
1142 LOG(UncheckedStringEvent("Leaving", StateToString(state_))); 1140 LOG(UncheckedStringEvent("Leaving", StateToString(state_)));
1143 if (previous_) { 1141 if (previous_) {
1144 LOG(UncheckedStringEvent("To", StateToString(previous_->state_))); 1142 LOG(UncheckedStringEvent("To", StateToString(previous_->state_)));
1145 } 1143 }
1146 } 1144 }
1147 } 1145 }
1148 #endif 1146 #endif
1149 1147
1150 } } // namespace v8::internal 1148 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/jsregexp.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698