Chromium Code Reviews| 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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 370 void Logger::LogRegExpSource(Handle<JSRegExp> regexp) { | 370 void Logger::LogRegExpSource(Handle<JSRegExp> regexp) { |
| 371 // Prints "/" + re.source + "/" + | 371 // Prints "/" + re.source + "/" + |
| 372 // (re.global?"g":"") + (re.ignorecase?"i":"") + (re.multiline?"m":"") | 372 // (re.global?"g":"") + (re.ignorecase?"i":"") + (re.multiline?"m":"") |
| 373 | 373 |
| 374 Handle<Object> source = GetProperty(regexp, "source"); | 374 Handle<Object> source = GetProperty(regexp, "source"); |
| 375 if (!source->IsString()) { | 375 if (!source->IsString()) { |
| 376 fprintf(logfile_, "no source"); | 376 fprintf(logfile_, "no source"); |
| 377 return; | 377 return; |
| 378 } | 378 } |
| 379 | 379 |
| 380 if (regexp->type()->IsSmi()) { | 380 switch (regexp->TypeTag()) { |
| 381 switch (regexp->type_tag()) { | 381 case JSRegExp::ATOM: |
|
Kasper Lund
2008/10/24 06:42:50
Fix switch indentation. The cases should be indent
| |
| 382 case JSRegExp::ATOM: | 382 fprintf(logfile_, "a"); |
| 383 fprintf(logfile_, "a"); | 383 break; |
| 384 break; | 384 default: |
| 385 default: | 385 break; |
| 386 break; | |
| 387 } | |
| 388 } | 386 } |
| 389 fprintf(logfile_, "/"); | 387 fprintf(logfile_, "/"); |
| 390 LogString(Handle<String>::cast(source)); | 388 LogString(Handle<String>::cast(source)); |
| 391 fprintf(logfile_, "/"); | 389 fprintf(logfile_, "/"); |
| 392 | 390 |
| 393 // global flag | 391 // global flag |
| 394 Handle<Object> global = GetProperty(regexp, "global"); | 392 Handle<Object> global = GetProperty(regexp, "global"); |
| 395 if (global->IsTrue()) { | 393 if (global->IsTrue()) { |
| 396 fprintf(logfile_, "g"); | 394 fprintf(logfile_, "g"); |
| 397 } | 395 } |
| 398 // ignorecase flag | 396 // ignorecase flag |
| 399 Handle<Object> ignorecase = GetProperty(regexp, "ignoreCase"); | 397 Handle<Object> ignorecase = GetProperty(regexp, "ignoreCase"); |
| 400 if (ignorecase->IsTrue()) { | 398 if (ignorecase->IsTrue()) { |
| 401 fprintf(logfile_, "i"); | 399 fprintf(logfile_, "i"); |
| 402 } | 400 } |
| 403 // multiline flag | 401 // multiline flag |
| 404 Handle<Object> multiline = GetProperty(regexp, "multiline"); | 402 Handle<Object> multiline = GetProperty(regexp, "multiline"); |
| 405 if (multiline->IsTrue()) { | 403 if (multiline->IsTrue()) { |
| 406 fprintf(logfile_, "m"); | 404 fprintf(logfile_, "m"); |
| 407 } | 405 } |
| 408 } | 406 } |
| 409 #endif // ENABLE_LOGGING_AND_PROFILING | 407 #endif // ENABLE_LOGGING_AND_PROFILING |
| 410 | 408 |
| 411 | 409 |
| 412 void Logger::RegExpCompileEvent(Handle<JSRegExp> regexp) { | 410 void Logger::RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache) { |
| 413 #ifdef ENABLE_LOGGING_AND_PROFILING | 411 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 414 if (logfile_ == NULL || !FLAG_log_regexp) return; | 412 if (logfile_ == NULL || !FLAG_log_regexp) return; |
| 415 ScopedLock sl(mutex_); | 413 ScopedLock sl(mutex_); |
| 416 | 414 |
| 417 fprintf(logfile_, "regexp-compile,"); | 415 fprintf(logfile_, "regexp-compile,"); |
| 418 LogRegExpSource(regexp); | 416 LogRegExpSource(regexp); |
| 419 fprintf(logfile_, "\n"); | 417 fprintf(logfile_, in_cache ? ",hit\n" : ",miss\n"); |
| 420 #endif | 418 #endif |
| 421 } | 419 } |
| 422 | 420 |
| 423 | 421 |
| 424 void Logger::RegExpExecEvent(Handle<JSRegExp> regexp, | 422 void Logger::RegExpExecEvent(Handle<JSRegExp> regexp, |
| 425 int start_index, | 423 int start_index, |
| 426 Handle<String> input_string) { | 424 Handle<String> input_string) { |
| 427 #ifdef ENABLE_LOGGING_AND_PROFILING | 425 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 428 if (logfile_ == NULL || !FLAG_log_regexp) return; | 426 if (logfile_ == NULL || !FLAG_log_regexp) return; |
| 429 ScopedLock sl(mutex_); | 427 ScopedLock sl(mutex_); |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 842 if (FLAG_log_state_changes) { | 840 if (FLAG_log_state_changes) { |
| 843 LOG(StringEvent("Leaving", StateToString(state_))); | 841 LOG(StringEvent("Leaving", StateToString(state_))); |
| 844 if (previous_) { | 842 if (previous_) { |
| 845 LOG(StringEvent("To", StateToString(previous_->state_))); | 843 LOG(StringEvent("To", StateToString(previous_->state_))); |
| 846 } | 844 } |
| 847 } | 845 } |
| 848 } | 846 } |
| 849 #endif | 847 #endif |
| 850 | 848 |
| 851 } } // namespace v8::internal | 849 } } // namespace v8::internal |
| OLD | NEW |