| OLD | NEW |
| 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 | 296 |
| 297 // | 297 // |
| 298 // Logger class implementation. | 298 // Logger class implementation. |
| 299 // | 299 // |
| 300 Ticker* Logger::ticker_ = NULL; | 300 Ticker* Logger::ticker_ = NULL; |
| 301 Profiler* Logger::profiler_ = NULL; | 301 Profiler* Logger::profiler_ = NULL; |
| 302 VMState* Logger::current_state_ = NULL; | 302 VMState* Logger::current_state_ = NULL; |
| 303 VMState Logger::bottom_state_(EXTERNAL); | 303 VMState Logger::bottom_state_(EXTERNAL); |
| 304 SlidingStateWindow* Logger::sliding_state_window_ = NULL; | 304 SlidingStateWindow* Logger::sliding_state_window_ = NULL; |
| 305 const char** Logger::log_events_ = NULL; | 305 const char** Logger::log_events_ = NULL; |
| 306 int Logger::tick_repeat_count_ = 0; | 306 CompressionHelper* Logger::compression_helper_ = NULL; |
| 307 | 307 |
| 308 #define DECLARE_LONG_EVENT(ignore1, long_name, ignore2) long_name, | 308 #define DECLARE_LONG_EVENT(ignore1, long_name, ignore2) long_name, |
| 309 const char* kLongLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = { | 309 const char* kLongLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = { |
| 310 LOG_EVENTS_AND_TAGS_LIST(DECLARE_LONG_EVENT) | 310 LOG_EVENTS_AND_TAGS_LIST(DECLARE_LONG_EVENT) |
| 311 }; | 311 }; |
| 312 #undef DECLARE_LONG_EVENT | 312 #undef DECLARE_LONG_EVENT |
| 313 | 313 |
| 314 #define DECLARE_SHORT_EVENT(ignore1, ignore2, short_name) short_name, | 314 #define DECLARE_SHORT_EVENT(ignore1, ignore2, short_name) short_name, |
| 315 const char* kCompressedLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = { | 315 const char* kCompressedLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = { |
| 316 LOG_EVENTS_AND_TAGS_LIST(DECLARE_SHORT_EVENT) | 316 LOG_EVENTS_AND_TAGS_LIST(DECLARE_SHORT_EVENT) |
| 317 }; | 317 }; |
| 318 #undef DECLARE_SHORT_EVENT | 318 #undef DECLARE_SHORT_EVENT |
| 319 | 319 |
| 320 | 320 |
| 321 bool Logger::IsEnabled() { | 321 bool Logger::IsEnabled() { |
| 322 return Log::IsEnabled(); | 322 return Log::IsEnabled(); |
| 323 } | 323 } |
| 324 | 324 |
| 325 | 325 |
| 326 void Logger::ProfilerBeginEvent() { | 326 void Logger::ProfilerBeginEvent() { |
| 327 if (!Log::IsEnabled()) return; | 327 if (!Log::IsEnabled()) return; |
| 328 LogMessageBuilder msg; | 328 LogMessageBuilder msg; |
| 329 msg.Append("profiler,\"begin\",%d\n", kSamplingIntervalMs); | 329 msg.Append("profiler,\"begin\",%d\n", kSamplingIntervalMs); |
| 330 if (FLAG_compress_log) { | 330 if (FLAG_compress_log) { |
| 331 msg.Append("profiler,\"compression\",%d\n", Log::kRecordCompressorWindow); | 331 msg.Append("profiler,\"compression\",%d\n", kCompressionWindowSize); |
| 332 } | 332 } |
| 333 msg.WriteToLogFile(); | 333 msg.WriteToLogFile(); |
| 334 } | 334 } |
| 335 | 335 |
| 336 | 336 |
| 337 void Logger::LogAliases() { | 337 void Logger::LogAliases() { |
| 338 if (!Log::IsEnabled() || !FLAG_compress_log) return; | 338 if (!Log::IsEnabled() || !FLAG_compress_log) return; |
| 339 LogMessageBuilder msg; | 339 LogMessageBuilder msg; |
| 340 for (int i = 0; i < NUMBER_OF_LOG_EVENTS; ++i) { | 340 for (int i = 0; i < NUMBER_OF_LOG_EVENTS; ++i) { |
| 341 msg.Append("alias,%s,%s\n", | 341 msg.Append("alias,%s,%s\n", |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 #endif | 622 #endif |
| 623 } | 623 } |
| 624 | 624 |
| 625 | 625 |
| 626 void Logger::CodeCreateEvent(LogEventsAndTags tag, | 626 void Logger::CodeCreateEvent(LogEventsAndTags tag, |
| 627 Code* code, | 627 Code* code, |
| 628 const char* comment) { | 628 const char* comment) { |
| 629 #ifdef ENABLE_LOGGING_AND_PROFILING | 629 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 630 if (!Log::IsEnabled() || !FLAG_log_code) return; | 630 if (!Log::IsEnabled() || !FLAG_log_code) return; |
| 631 LogMessageBuilder msg; | 631 LogMessageBuilder msg; |
| 632 msg.Append("%s,%s,0x%" V8PRIxPTR ",%d,\"", | 632 msg.Append("%s,%s,", log_events_[CODE_CREATION_EVENT], log_events_[tag]); |
| 633 log_events_[CODE_CREATION_EVENT], log_events_[tag], | 633 msg.AppendAddress(code->address()); |
| 634 code->address(), code->ExecutableSize()); | 634 msg.Append(",%d,\"", code->ExecutableSize()); |
| 635 for (const char* p = comment; *p != '\0'; p++) { | 635 for (const char* p = comment; *p != '\0'; p++) { |
| 636 if (*p == '"') { | 636 if (*p == '"') { |
| 637 msg.Append('\\'); | 637 msg.Append('\\'); |
| 638 } | 638 } |
| 639 msg.Append(*p); | 639 msg.Append(*p); |
| 640 } | 640 } |
| 641 msg.Append('"'); | 641 msg.Append('"'); |
| 642 msg.Append('\n'); | 642 msg.Append('\n'); |
| 643 msg.WriteToLogFile(); | 643 msg.WriteToLogFile(); |
| 644 #endif | 644 #endif |
| 645 } | 645 } |
| 646 | 646 |
| 647 | 647 |
| 648 void Logger::CodeCreateEvent(LogEventsAndTags tag, Code* code, String* name) { | 648 void Logger::CodeCreateEvent(LogEventsAndTags tag, Code* code, String* name) { |
| 649 #ifdef ENABLE_LOGGING_AND_PROFILING | 649 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 650 if (!Log::IsEnabled() || !FLAG_log_code) return; | 650 if (!Log::IsEnabled() || !FLAG_log_code) return; |
| 651 LogMessageBuilder msg; | 651 LogMessageBuilder msg; |
| 652 SmartPointer<char> str = | 652 SmartPointer<char> str = |
| 653 name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 653 name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 654 msg.Append("%s,%s,0x%" V8PRIxPTR ",%d,\"%s\"\n", | 654 msg.Append("%s,%s,", log_events_[CODE_CREATION_EVENT], log_events_[tag]); |
| 655 log_events_[CODE_CREATION_EVENT], log_events_[tag], | 655 msg.AppendAddress(code->address()); |
| 656 code->address(), code->ExecutableSize(), *str); | 656 msg.Append(",%d,\"%s\"\n", code->ExecutableSize(), *str); |
| 657 msg.WriteToLogFile(); | 657 msg.WriteToLogFile(); |
| 658 #endif | 658 #endif |
| 659 } | 659 } |
| 660 | 660 |
| 661 | 661 |
| 662 void Logger::CodeCreateEvent(LogEventsAndTags tag, | 662 void Logger::CodeCreateEvent(LogEventsAndTags tag, |
| 663 Code* code, String* name, | 663 Code* code, String* name, |
| 664 String* source, int line) { | 664 String* source, int line) { |
| 665 #ifdef ENABLE_LOGGING_AND_PROFILING | 665 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 666 if (!Log::IsEnabled() || !FLAG_log_code) return; | 666 if (!Log::IsEnabled() || !FLAG_log_code) return; |
| 667 LogMessageBuilder msg; | 667 LogMessageBuilder msg; |
| 668 SmartPointer<char> str = | 668 SmartPointer<char> str = |
| 669 name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 669 name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 670 SmartPointer<char> sourcestr = | 670 SmartPointer<char> sourcestr = |
| 671 source->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 671 source->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 672 msg.Append("%s,%s,0x%" V8PRIxPTR ",%d,\"%s %s:%d\"\n", | 672 msg.Append("%s,%s,", log_events_[CODE_CREATION_EVENT], log_events_[tag]); |
| 673 log_events_[CODE_CREATION_EVENT], | 673 msg.AppendAddress(code->address()); |
| 674 log_events_[tag], code->address(), | 674 msg.Append(",%d,\"%s %s:%d\"\n", |
| 675 code->ExecutableSize(), | 675 code->ExecutableSize(), *str, *sourcestr, line); |
| 676 *str, *sourcestr, line); | |
| 677 msg.WriteToLogFile(); | 676 msg.WriteToLogFile(); |
| 678 #endif | 677 #endif |
| 679 } | 678 } |
| 680 | 679 |
| 681 | 680 |
| 682 void Logger::CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count) { | 681 void Logger::CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count) { |
| 683 #ifdef ENABLE_LOGGING_AND_PROFILING | 682 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 684 if (!Log::IsEnabled() || !FLAG_log_code) return; | 683 if (!Log::IsEnabled() || !FLAG_log_code) return; |
| 685 LogMessageBuilder msg; | 684 LogMessageBuilder msg; |
| 686 msg.Append("%s,%s,0x%" V8PRIxPTR ",%d,\"args_count: %d\"\n", | 685 msg.Append("%s,%s,", log_events_[CODE_CREATION_EVENT], log_events_[tag]); |
| 687 log_events_[CODE_CREATION_EVENT], | 686 msg.AppendAddress(code->address()); |
| 688 log_events_[tag], | 687 msg.Append(",%d,\"args_count: %d\"\n", code->ExecutableSize(), args_count); |
| 689 code->address(), | |
| 690 code->ExecutableSize(), | |
| 691 args_count); | |
| 692 msg.WriteToLogFile(); | 688 msg.WriteToLogFile(); |
| 693 #endif | 689 #endif |
| 694 } | 690 } |
| 695 | 691 |
| 696 | 692 |
| 697 void Logger::RegExpCodeCreateEvent(Code* code, String* source) { | 693 void Logger::RegExpCodeCreateEvent(Code* code, String* source) { |
| 698 #ifdef ENABLE_LOGGING_AND_PROFILING | 694 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 699 if (!Log::IsEnabled() || !FLAG_log_code) return; | 695 if (!Log::IsEnabled() || !FLAG_log_code) return; |
| 700 LogMessageBuilder msg; | 696 LogMessageBuilder msg; |
| 701 msg.Append("%s,%s,0x%" V8PRIxPTR ",%d,\"", | 697 msg.Append("%s,%s,", |
| 702 log_events_[CODE_CREATION_EVENT], | 698 log_events_[CODE_CREATION_EVENT], log_events_[REG_EXP_TAG]); |
| 703 log_events_[REG_EXP_TAG], | 699 msg.AppendAddress(code->address()); |
| 704 code->address(), | 700 msg.Append(",%d,\"", code->ExecutableSize()); |
| 705 code->ExecutableSize()); | |
| 706 msg.AppendDetailed(source, false); | 701 msg.AppendDetailed(source, false); |
| 707 msg.Append("\"\n"); | 702 msg.Append("\"\n"); |
| 708 msg.WriteToLogFile(); | 703 msg.WriteToLogFile(); |
| 709 #endif | 704 #endif |
| 710 } | 705 } |
| 711 | 706 |
| 712 | 707 |
| 708 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 709 |
| 710 // A class that contains all common code dealing with record compression. |
| 711 class CompressionHelper { |
| 712 public: |
| 713 explicit CompressionHelper(int window_size) |
| 714 : compressor_(window_size), repeat_count_(0) { } |
| 715 |
| 716 // Handles storing message in compressor, retrieving the previous one and |
| 717 // prefixing it with repeat count, if needed. |
| 718 // Returns true if message needs to be written to log. |
| 719 bool HandleMessage(LogMessageBuilder* msg) { |
| 720 if (!msg->StoreInCompressor(&compressor_)) { |
| 721 // Current message repeats the previous one, don't write it. |
| 722 ++repeat_count_; |
| 723 return false; |
| 724 } |
| 725 if (repeat_count_ == 0) { |
| 726 return msg->RetrieveCompressedPrevious(&compressor_); |
| 727 } |
| 728 OS::SNPrintF(prefix_, "%s,%d,", |
| 729 Logger::log_events_[Logger::REPEAT_META_EVENT], |
| 730 repeat_count_ + 1); |
| 731 repeat_count_ = 0; |
| 732 return msg->RetrieveCompressedPrevious(&compressor_, prefix_.start()); |
| 733 } |
| 734 |
| 735 private: |
| 736 LogRecordCompressor compressor_; |
| 737 int repeat_count_; |
| 738 EmbeddedVector<char, 20> prefix_; |
| 739 }; |
| 740 |
| 741 #endif // ENABLE_LOGGING_AND_PROFILING |
| 742 |
| 743 |
| 713 void Logger::CodeMoveEvent(Address from, Address to) { | 744 void Logger::CodeMoveEvent(Address from, Address to) { |
| 714 #ifdef ENABLE_LOGGING_AND_PROFILING | 745 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 746 static Address prev_to_ = NULL; |
| 715 if (!Log::IsEnabled() || !FLAG_log_code) return; | 747 if (!Log::IsEnabled() || !FLAG_log_code) return; |
| 716 LogMessageBuilder msg; | 748 LogMessageBuilder msg; |
| 717 msg.Append("%s,0x%" V8PRIxPTR ",0x%" V8PRIxPTR "\n", | 749 msg.Append("%s,", log_events_[CODE_MOVE_EVENT]); |
| 718 log_events_[CODE_MOVE_EVENT], from, to); | 750 msg.AppendAddress(from); |
| 751 msg.Append(','); |
| 752 msg.AppendAddress(to, prev_to_); |
| 753 prev_to_ = to; |
| 754 if (FLAG_compress_log) { |
| 755 ASSERT(compression_helper_ != NULL); |
| 756 if (!compression_helper_->HandleMessage(&msg)) return; |
| 757 } |
| 758 msg.Append('\n'); |
| 719 msg.WriteToLogFile(); | 759 msg.WriteToLogFile(); |
| 720 #endif | 760 #endif |
| 721 } | 761 } |
| 722 | 762 |
| 723 | 763 |
| 724 void Logger::CodeDeleteEvent(Address from) { | 764 void Logger::CodeDeleteEvent(Address from) { |
| 725 #ifdef ENABLE_LOGGING_AND_PROFILING | 765 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 726 if (!Log::IsEnabled() || !FLAG_log_code) return; | 766 if (!Log::IsEnabled() || !FLAG_log_code) return; |
| 727 LogMessageBuilder msg; | 767 LogMessageBuilder msg; |
| 728 msg.Append("%s,0x%" V8PRIxPTR "\n", log_events_[CODE_DELETE_EVENT], from); | 768 msg.Append("%s,", log_events_[CODE_DELETE_EVENT]); |
| 769 msg.AppendAddress(from); |
| 770 if (FLAG_compress_log) { |
| 771 ASSERT(compression_helper_ != NULL); |
| 772 if (!compression_helper_->HandleMessage(&msg)) return; |
| 773 } |
| 774 msg.Append('\n'); |
| 729 msg.WriteToLogFile(); | 775 msg.WriteToLogFile(); |
| 730 #endif | 776 #endif |
| 731 } | 777 } |
| 732 | 778 |
| 733 | 779 |
| 734 void Logger::ResourceEvent(const char* name, const char* tag) { | 780 void Logger::ResourceEvent(const char* name, const char* tag) { |
| 735 #ifdef ENABLE_LOGGING_AND_PROFILING | 781 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 736 if (!Log::IsEnabled() || !FLAG_log) return; | 782 if (!Log::IsEnabled() || !FLAG_log) return; |
| 737 LogMessageBuilder msg; | 783 LogMessageBuilder msg; |
| 738 msg.Append("%s,%s,", name, tag); | 784 msg.Append("%s,%s,", name, tag); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 parameter_string); | 869 parameter_string); |
| 824 DeleteArray(parameter_string); | 870 DeleteArray(parameter_string); |
| 825 msg.WriteToLogFile(); | 871 msg.WriteToLogFile(); |
| 826 #endif | 872 #endif |
| 827 } | 873 } |
| 828 | 874 |
| 829 | 875 |
| 830 #ifdef ENABLE_LOGGING_AND_PROFILING | 876 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 831 void Logger::TickEvent(TickSample* sample, bool overflow) { | 877 void Logger::TickEvent(TickSample* sample, bool overflow) { |
| 832 if (!Log::IsEnabled() || !FLAG_prof) return; | 878 if (!Log::IsEnabled() || !FLAG_prof) return; |
| 879 static Address prev_sp = NULL; |
| 833 LogMessageBuilder msg; | 880 LogMessageBuilder msg; |
| 834 msg.Append("%s,0x%" V8PRIxPTR ",0x%" V8PRIxPTR ",%d", | 881 msg.Append("%s,", log_events_[TICK_EVENT]); |
| 835 log_events_[TICK_EVENT], | 882 Address prev_addr = reinterpret_cast<Address>(sample->pc); |
| 836 sample->pc, sample->sp, static_cast<int>(sample->state)); | 883 msg.AppendAddress(prev_addr); |
| 884 msg.Append(','); |
| 885 msg.AppendAddress(reinterpret_cast<Address>(sample->sp), prev_sp); |
| 886 prev_sp = reinterpret_cast<Address>(sample->sp); |
| 887 msg.Append(",%d", static_cast<int>(sample->state)); |
| 837 if (overflow) { | 888 if (overflow) { |
| 838 msg.Append(",overflow"); | 889 msg.Append(",overflow"); |
| 839 } | 890 } |
| 840 uintptr_t prev_ptr = sample->pc; | |
| 841 for (int i = 0; i < sample->frames_count; ++i) { | 891 for (int i = 0; i < sample->frames_count; ++i) { |
| 842 if (FLAG_compress_log) { | 892 msg.Append(','); |
| 843 const uintptr_t ptr = OffsetFrom(sample->stack[i]); | 893 msg.AppendAddress(sample->stack[i], prev_addr); |
| 844 intptr_t delta = ptr - prev_ptr; | 894 prev_addr = sample->stack[i]; |
| 845 prev_ptr = ptr; | |
| 846 // To avoid printing negative offsets in an unsigned form, | |
| 847 // we are printing an absolute value with a sign. | |
| 848 const char sign = delta >= 0 ? '+' : '-'; | |
| 849 if (sign == '-') { delta = -delta; } | |
| 850 msg.Append(",%c0x%" V8PRIxPTR, sign, delta); | |
| 851 } else { | |
| 852 msg.Append(",0x%" V8PRIxPTR, sample->stack[i]); | |
| 853 } | |
| 854 } | 895 } |
| 855 // In case if log compression is disabled, the flow is straightforward, | 896 if (FLAG_compress_log) { |
| 856 // because both StoreInCompressor and RetrieveCompressedPrevious do nothing | 897 ASSERT(compression_helper_ != NULL); |
| 857 // and just return 'true'. Otherwise, to perform compression of repeated | 898 if (!compression_helper_->HandleMessage(&msg)) return; |
| 858 // tick events, instead of the current event, the previous one is written. | |
| 859 if (!msg.StoreInCompressor()) { | |
| 860 // Current message repeats the previous one, don't write it. | |
| 861 ++tick_repeat_count_; | |
| 862 return; | |
| 863 } | 899 } |
| 864 | |
| 865 bool has_previous_message; | |
| 866 if (tick_repeat_count_ > 0) { | |
| 867 EmbeddedVector<char, 20> prefix; | |
| 868 OS::SNPrintF(prefix, "%s,%d,", | |
| 869 log_events_[REPEAT_META_EVENT], | |
| 870 tick_repeat_count_ + 1); | |
| 871 tick_repeat_count_ = 0; | |
| 872 has_previous_message = msg.RetrieveCompressedPrevious(prefix.start()); | |
| 873 } else { | |
| 874 has_previous_message = msg.RetrieveCompressedPrevious(); | |
| 875 } | |
| 876 if (!has_previous_message) return; | |
| 877 msg.Append('\n'); | 900 msg.Append('\n'); |
| 878 msg.WriteToLogFile(); | 901 msg.WriteToLogFile(); |
| 879 } | 902 } |
| 880 | 903 |
| 881 | 904 |
| 882 bool Logger::IsProfilerPaused() { | 905 bool Logger::IsProfilerPaused() { |
| 883 return profiler_->paused(); | 906 return profiler_->paused(); |
| 884 } | 907 } |
| 885 | 908 |
| 886 | 909 |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1071 } | 1094 } |
| 1072 | 1095 |
| 1073 current_state_ = &bottom_state_; | 1096 current_state_ = &bottom_state_; |
| 1074 | 1097 |
| 1075 ticker_ = new Ticker(kSamplingIntervalMs); | 1098 ticker_ = new Ticker(kSamplingIntervalMs); |
| 1076 | 1099 |
| 1077 if (FLAG_sliding_state_window && sliding_state_window_ == NULL) { | 1100 if (FLAG_sliding_state_window && sliding_state_window_ == NULL) { |
| 1078 sliding_state_window_ = new SlidingStateWindow(); | 1101 sliding_state_window_ = new SlidingStateWindow(); |
| 1079 } | 1102 } |
| 1080 | 1103 |
| 1104 log_events_ = FLAG_compress_log ? |
| 1105 kCompressedLogEventsNames : kLongLogEventsNames; |
| 1106 if (FLAG_compress_log) { |
| 1107 compression_helper_ = new CompressionHelper(kCompressionWindowSize); |
| 1108 } |
| 1109 |
| 1081 if (FLAG_prof) { | 1110 if (FLAG_prof) { |
| 1082 profiler_ = new Profiler(); | 1111 profiler_ = new Profiler(); |
| 1083 if (!FLAG_prof_auto) | 1112 if (!FLAG_prof_auto) |
| 1084 profiler_->pause(); | 1113 profiler_->pause(); |
| 1085 profiler_->Engage(); | 1114 profiler_->Engage(); |
| 1086 } | 1115 } |
| 1087 | 1116 |
| 1088 LogMessageBuilder::set_write_failure_handler(StopLoggingAndProfiling); | 1117 LogMessageBuilder::set_write_failure_handler(StopLoggingAndProfiling); |
| 1089 | 1118 |
| 1090 log_events_ = FLAG_compress_log ? | |
| 1091 kCompressedLogEventsNames : kLongLogEventsNames; | |
| 1092 | |
| 1093 return true; | 1119 return true; |
| 1094 | 1120 |
| 1095 #else | 1121 #else |
| 1096 return false; | 1122 return false; |
| 1097 #endif | 1123 #endif |
| 1098 } | 1124 } |
| 1099 | 1125 |
| 1100 | 1126 |
| 1101 void Logger::TearDown() { | 1127 void Logger::TearDown() { |
| 1102 #ifdef ENABLE_LOGGING_AND_PROFILING | 1128 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 1103 LogMessageBuilder::set_write_failure_handler(NULL); | 1129 LogMessageBuilder::set_write_failure_handler(NULL); |
| 1104 | 1130 |
| 1105 // Stop the profiler before closing the file. | 1131 // Stop the profiler before closing the file. |
| 1106 if (profiler_ != NULL) { | 1132 if (profiler_ != NULL) { |
| 1107 profiler_->Disengage(); | 1133 profiler_->Disengage(); |
| 1108 delete profiler_; | 1134 delete profiler_; |
| 1109 profiler_ = NULL; | 1135 profiler_ = NULL; |
| 1110 } | 1136 } |
| 1111 | 1137 |
| 1138 delete compression_helper_; |
| 1139 compression_helper_ = NULL; |
| 1140 |
| 1112 delete sliding_state_window_; | 1141 delete sliding_state_window_; |
| 1113 sliding_state_window_ = NULL; | 1142 sliding_state_window_ = NULL; |
| 1114 | 1143 |
| 1115 delete ticker_; | 1144 delete ticker_; |
| 1116 ticker_ = NULL; | 1145 ticker_ = NULL; |
| 1117 | 1146 |
| 1118 Log::Close(); | 1147 Log::Close(); |
| 1119 #endif | 1148 #endif |
| 1120 } | 1149 } |
| 1121 | 1150 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 } else if (previous_->state_ == EXTERNAL) { | 1243 } else if (previous_->state_ == EXTERNAL) { |
| 1215 // We are leaving V8. | 1244 // We are leaving V8. |
| 1216 Heap::Protect(); | 1245 Heap::Protect(); |
| 1217 } | 1246 } |
| 1218 } | 1247 } |
| 1219 #endif | 1248 #endif |
| 1220 } | 1249 } |
| 1221 #endif | 1250 #endif |
| 1222 | 1251 |
| 1223 } } // namespace v8::internal | 1252 } } // namespace v8::internal |
| OLD | NEW |