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

Side by Side Diff: src/log.cc

Issue 12861: Regexp logging and stl (Closed)
Patch Set: Created 12 years 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
« no previous file with comments | « src/jsregexp.cc ('k') | no next file » | 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 349
350 350
351 #ifdef ENABLE_LOGGING_AND_PROFILING 351 #ifdef ENABLE_LOGGING_AND_PROFILING
352 void Logger::LogString(Handle<String> str) { 352 void Logger::LogString(Handle<String> str) {
353 StringShape shape(*str); 353 StringShape shape(*str);
354 int len = str->length(shape); 354 int len = str->length(shape);
355 if (len > 256) 355 if (len > 256)
356 len = 256; 356 len = 256;
357 for (int i = 0; i < len; i++) { 357 for (int i = 0; i < len; i++) {
358 uc32 c = str->Get(shape, i); 358 uc32 c = str->Get(shape, i);
359 if (c < 32 || (c > 126 && c <= 255)) { 359 if (c > 0xff) {
360 fprintf(logfile_, "\\u%04x", c);
361 } else if (c < 32 || c > 126) {
360 fprintf(logfile_, "\\x%02x", c); 362 fprintf(logfile_, "\\x%02x", c);
361 } else if (c > 255) {
362 fprintf(logfile_, "\\u%04x", c);
363 } else if (c == ',') { 363 } else if (c == ',') {
364 fprintf(logfile_, "\\,"); 364 fprintf(logfile_, "\\,");
365 } else if (c == '\\') {
366 fprintf(logfile_, "\\\\");
365 } else { 367 } else {
366 fprintf(logfile_, "%lc", c); 368 fprintf(logfile_, "%lc", c);
367 } 369 }
368 } 370 }
369 } 371 }
370 372
371 void Logger::LogRegExpSource(Handle<JSRegExp> regexp) { 373 void Logger::LogRegExpSource(Handle<JSRegExp> regexp) {
372 // Prints "/" + re.source + "/" + 374 // Prints "/" + re.source + "/" +
373 // (re.global?"g":"") + (re.ignorecase?"i":"") + (re.multiline?"m":"") 375 // (re.global?"g":"") + (re.ignorecase?"i":"") + (re.multiline?"m":"")
374 376
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 if (FLAG_log_state_changes) { 843 if (FLAG_log_state_changes) {
842 LOG(StringEvent("Leaving", StateToString(state_))); 844 LOG(StringEvent("Leaving", StateToString(state_)));
843 if (previous_) { 845 if (previous_) {
844 LOG(StringEvent("To", StateToString(previous_->state_))); 846 LOG(StringEvent("To", StateToString(previous_->state_)));
845 } 847 }
846 } 848 }
847 } 849 }
848 #endif 850 #endif
849 851
850 } } // namespace v8::internal 852 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/jsregexp.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698