| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 log_(new Log(this)), | 337 log_(new Log(this)), |
| 338 is_initialized_(false), | 338 is_initialized_(false), |
| 339 last_address_(NULL), | 339 last_address_(NULL), |
| 340 prev_sp_(NULL), | 340 prev_sp_(NULL), |
| 341 prev_function_(NULL), | 341 prev_function_(NULL), |
| 342 prev_to_(NULL), | 342 prev_to_(NULL), |
| 343 prev_code_(NULL) { | 343 prev_code_(NULL) { |
| 344 } | 344 } |
| 345 | 345 |
| 346 #define DECLARE_LONG_EVENT(ignore1, long_name, ignore2) long_name, | 346 #define DECLARE_LONG_EVENT(ignore1, long_name, ignore2) long_name, |
| 347 const char* kLongLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = { | 347 static const char* const kLongLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = { |
| 348 LOG_EVENTS_AND_TAGS_LIST(DECLARE_LONG_EVENT) | 348 LOG_EVENTS_AND_TAGS_LIST(DECLARE_LONG_EVENT) |
| 349 }; | 349 }; |
| 350 #undef DECLARE_LONG_EVENT | 350 #undef DECLARE_LONG_EVENT |
| 351 | 351 |
| 352 #define DECLARE_SHORT_EVENT(ignore1, ignore2, short_name) short_name, | 352 #define DECLARE_SHORT_EVENT(ignore1, ignore2, short_name) short_name, |
| 353 const char* kCompressedLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = { | 353 static const char* const |
| 354 kCompressedLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = { |
| 354 LOG_EVENTS_AND_TAGS_LIST(DECLARE_SHORT_EVENT) | 355 LOG_EVENTS_AND_TAGS_LIST(DECLARE_SHORT_EVENT) |
| 355 }; | 356 }; |
| 356 #undef DECLARE_SHORT_EVENT | 357 #undef DECLARE_SHORT_EVENT |
| 357 | 358 |
| 358 | 359 |
| 359 void Logger::ProfilerBeginEvent() { | 360 void Logger::ProfilerBeginEvent() { |
| 360 if (!log_->IsEnabled()) return; | 361 if (!log_->IsEnabled()) return; |
| 361 LogMessageBuilder msg(this); | 362 LogMessageBuilder msg(this); |
| 362 msg.Append("profiler,\"begin\",%d\n", kSamplingIntervalMs); | 363 msg.Append("profiler,\"begin\",%d\n", kSamplingIntervalMs); |
| 363 if (FLAG_compress_log) { | 364 if (FLAG_compress_log) { |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 msg.WriteToLogFile(); | 905 msg.WriteToLogFile(); |
| 905 #endif | 906 #endif |
| 906 } | 907 } |
| 907 | 908 |
| 908 | 909 |
| 909 void Logger::FunctionCreateEvent(JSFunction* function) { | 910 void Logger::FunctionCreateEvent(JSFunction* function) { |
| 910 #ifdef ENABLE_LOGGING_AND_PROFILING | 911 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 911 // This function can be called from GC iterators (during Scavenge, | 912 // This function can be called from GC iterators (during Scavenge, |
| 912 // MC, and MS), so marking bits can be set on objects. That's | 913 // MC, and MS), so marking bits can be set on objects. That's |
| 913 // why unchecked accessors are used here. | 914 // why unchecked accessors are used here. |
| 914 static Address prev_code = NULL; | |
| 915 if (!log_->IsEnabled() || !FLAG_log_code) return; | 915 if (!log_->IsEnabled() || !FLAG_log_code) return; |
| 916 LogMessageBuilder msg(this); | 916 LogMessageBuilder msg(this); |
| 917 msg.Append("%s,", log_events_[FUNCTION_CREATION_EVENT]); | 917 msg.Append("%s,", log_events_[FUNCTION_CREATION_EVENT]); |
| 918 msg.AppendAddress(function->address()); | 918 msg.AppendAddress(function->address()); |
| 919 msg.Append(','); | 919 msg.Append(','); |
| 920 msg.AppendAddress(function->unchecked_code()->address(), prev_code); | 920 msg.AppendAddress(function->unchecked_code()->address(), prev_code_); |
| 921 prev_code = function->unchecked_code()->address(); | 921 prev_code_ = function->unchecked_code()->address(); |
| 922 if (FLAG_compress_log) { | 922 if (FLAG_compress_log) { |
| 923 ASSERT(compression_helper_ != NULL); | 923 ASSERT(compression_helper_ != NULL); |
| 924 if (!compression_helper_->HandleMessage(&msg)) return; | 924 if (!compression_helper_->HandleMessage(&msg)) return; |
| 925 } | 925 } |
| 926 msg.Append('\n'); | 926 msg.Append('\n'); |
| 927 msg.WriteToLogFile(); | 927 msg.WriteToLogFile(); |
| 928 #endif | 928 #endif |
| 929 } | 929 } |
| 930 | 930 |
| 931 | 931 |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 } | 1541 } |
| 1542 // Otherwise, if the sliding state window computation has not been | 1542 // Otherwise, if the sliding state window computation has not been |
| 1543 // started we do it now. | 1543 // started we do it now. |
| 1544 if (sliding_state_window_ == NULL) { | 1544 if (sliding_state_window_ == NULL) { |
| 1545 sliding_state_window_ = new SlidingStateWindow(); | 1545 sliding_state_window_ = new SlidingStateWindow(); |
| 1546 } | 1546 } |
| 1547 #endif | 1547 #endif |
| 1548 } | 1548 } |
| 1549 | 1549 |
| 1550 } } // namespace v8::internal | 1550 } } // namespace v8::internal |
| OLD | NEW |