| OLD | NEW |
| 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 if (logfile_ == NULL || !FLAG_prof) return; | 343 if (logfile_ == NULL || !FLAG_prof) return; |
| 344 ScopedLock sl(mutex_); | 344 ScopedLock sl(mutex_); |
| 345 fprintf(logfile_, "shared-library,\"%ls\",0x%08x,0x%08x\n", library_path, | 345 fprintf(logfile_, "shared-library,\"%ls\",0x%08x,0x%08x\n", library_path, |
| 346 start, end); | 346 start, end); |
| 347 #endif | 347 #endif |
| 348 } | 348 } |
| 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 int len = str->length(); | 353 StringShape shape(*str); |
| 354 int len = str->length(shape); |
| 354 if (len > 256) | 355 if (len > 256) |
| 355 len = 256; | 356 len = 256; |
| 356 for (int i = 0; i < len; i++) { | 357 for (int i = 0; i < len; i++) { |
| 357 uc32 c = str->Get(i); | 358 uc32 c = str->Get(shape, i); |
| 358 if (c < 32 || (c > 126 && c <= 255)) { | 359 if (c < 32 || (c > 126 && c <= 255)) { |
| 359 fprintf(logfile_, "\\x%02x", c); | 360 fprintf(logfile_, "\\x%02x", c); |
| 360 } else if (c > 255) { | 361 } else if (c > 255) { |
| 361 fprintf(logfile_, "\\u%04x", c); | 362 fprintf(logfile_, "\\u%04x", c); |
| 362 } else if (c == ',') { | 363 } else if (c == ',') { |
| 363 fprintf(logfile_, "\\,"); | 364 fprintf(logfile_, "\\,"); |
| 364 } else { | 365 } else { |
| 365 fprintf(logfile_, "%lc", c); | 366 fprintf(logfile_, "%lc", c); |
| 366 } | 367 } |
| 367 } | 368 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 int start_index, | 424 int start_index, |
| 424 Handle<String> input_string) { | 425 Handle<String> input_string) { |
| 425 #ifdef ENABLE_LOGGING_AND_PROFILING | 426 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 426 if (logfile_ == NULL || !FLAG_log_regexp) return; | 427 if (logfile_ == NULL || !FLAG_log_regexp) return; |
| 427 ScopedLock sl(mutex_); | 428 ScopedLock sl(mutex_); |
| 428 | 429 |
| 429 fprintf(logfile_, "regexp-run,"); | 430 fprintf(logfile_, "regexp-run,"); |
| 430 LogRegExpSource(regexp); | 431 LogRegExpSource(regexp); |
| 431 fprintf(logfile_, ","); | 432 fprintf(logfile_, ","); |
| 432 LogString(input_string); | 433 LogString(input_string); |
| 433 fprintf(logfile_, ",%d..%d\n", start_index, input_string->length()); | 434 StringShape shape(*input_string); |
| 435 fprintf(logfile_, ",%d..%d\n", start_index, input_string->length(shape)); |
| 434 #endif | 436 #endif |
| 435 } | 437 } |
| 436 | 438 |
| 437 | 439 |
| 438 void Logger::ApiIndexedSecurityCheck(uint32_t index) { | 440 void Logger::ApiIndexedSecurityCheck(uint32_t index) { |
| 439 #ifdef ENABLE_LOGGING_AND_PROFILING | 441 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 440 if (logfile_ == NULL || !FLAG_log_api) return; | 442 if (logfile_ == NULL || !FLAG_log_api) return; |
| 441 ApiEvent("api,check-security,%u\n", index); | 443 ApiEvent("api,check-security,%u\n", index); |
| 442 #endif | 444 #endif |
| 443 } | 445 } |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 if (FLAG_log_state_changes) { | 842 if (FLAG_log_state_changes) { |
| 841 LOG(StringEvent("Leaving", StateToString(state_))); | 843 LOG(StringEvent("Leaving", StateToString(state_))); |
| 842 if (previous_) { | 844 if (previous_) { |
| 843 LOG(StringEvent("To", StateToString(previous_->state_))); | 845 LOG(StringEvent("To", StateToString(previous_->state_))); |
| 844 } | 846 } |
| 845 } | 847 } |
| 846 } | 848 } |
| 847 #endif | 849 #endif |
| 848 | 850 |
| 849 } } // namespace v8::internal | 851 } } // namespace v8::internal |
| OLD | NEW |