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

Side by Side Diff: src/log.cc

Issue 435003: Patch for allowing several V8 instances in process:... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 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 | Annotate | Revision Log
« no previous file with comments | « src/log.h ('k') | src/log-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 23 matching lines...) Expand all
34 #include "log.h" 34 #include "log.h"
35 #include "macro-assembler.h" 35 #include "macro-assembler.h"
36 #include "serialize.h" 36 #include "serialize.h"
37 #include "string-stream.h" 37 #include "string-stream.h"
38 38
39 namespace v8 { 39 namespace v8 {
40 namespace internal { 40 namespace internal {
41 41
42 #ifdef ENABLE_LOGGING_AND_PROFILING 42 #ifdef ENABLE_LOGGING_AND_PROFILING
43 43
44 class LoggerPrivateData {
45 public:
46 // Tells whether we are currently recording tick samples.
47 bool profiler_paused_;
48
49 Address prev_to_;
50 Address prev_sp_;
51
52 LoggerPrivateData()
53 :profiler_paused_(false),
54 prev_to_(NULL),
55 prev_sp_(NULL) {
56 }
57 };
58
44 // 59 //
45 // Sliding state window. Updates counters to keep track of the last 60 // Sliding state window. Updates counters to keep track of the last
46 // window of kBufferSize states. This is useful to track where we 61 // window of kBufferSize states. This is useful to track where we
47 // spent our time. 62 // spent our time.
48 // 63 //
49 class SlidingStateWindow { 64 class SlidingStateWindow {
50 public: 65 public:
51 SlidingStateWindow(); 66 SlidingStateWindow();
52 ~SlidingStateWindow(); 67 ~SlidingStateWindow();
53 void AddState(StateTag state); 68 void AddState(StateTag state);
54 69
55 private: 70 private:
56 static const int kBufferSize = 256; 71 static const int kBufferSize = 256;
57 int current_index_; 72 int current_index_;
58 bool is_full_; 73 bool is_full_;
59 byte buffer_[kBufferSize]; 74 byte buffer_[kBufferSize];
60 75
61 76
62 void IncrementStateCounter(StateTag state) { 77 void IncrementStateCounter(StateTag state) {
63 Counters::state_counters[state].Increment(); 78 INC_COUNTER(state_counters[state]);
64 } 79 }
65 80
66 81
67 void DecrementStateCounter(StateTag state) { 82 void DecrementStateCounter(StateTag state) {
68 Counters::state_counters[state].Decrement(); 83 DEC_COUNTER(state_counters[state]);
69 } 84 }
70 }; 85 };
71 86
72 87
73 // 88 //
74 // The Profiler samples pc and sp values for the main thread. 89 // The Profiler samples pc and sp values for the main thread.
75 // Each sample is appended to a circular buffer. 90 // Each sample is appended to a circular buffer.
76 // An independent thread removes data and writes it to the log. 91 // An independent thread removes data and writes it to the log.
77 // This design minimizes the time spent in the sampler. 92 // This design minimizes the time spent in the sampler.
78 // 93 //
79 class Profiler: public Thread { 94 class Profiler: public Thread {
80 public: 95 public:
81 Profiler(); 96 Profiler();
82 void Engage(); 97 void Engage();
83 void Disengage(); 98 void Disengage();
84 99
85 // Inserts collected profiling data into buffer. 100 // Inserts collected profiling data into buffer.
86 void Insert(TickSample* sample) { 101 void Insert(TickSample* sample) {
87 if (paused_) 102 if (v8_context()->logger_data_.private_data_.profiler_paused_)
88 return; 103 return;
89 104
90 if (Succ(head_) == tail_) { 105 if (Succ(head_) == tail_) {
91 overflow_ = true; 106 overflow_ = true;
92 } else { 107 } else {
93 buffer_[head_] = *sample; 108 buffer_[head_] = *sample;
94 head_ = Succ(head_); 109 head_ = Succ(head_);
95 buffer_semaphore_->Signal(); // Tell we have an element. 110 buffer_semaphore_->Signal(); // Tell we have an element.
96 } 111 }
97 } 112 }
98 113
99 // Waits for a signal and removes profiling data. 114 // Waits for a signal and removes profiling data.
100 bool Remove(TickSample* sample) { 115 bool Remove(TickSample* sample) {
101 buffer_semaphore_->Wait(); // Wait for an element. 116 buffer_semaphore_->Wait(); // Wait for an element.
102 *sample = buffer_[tail_]; 117 *sample = buffer_[tail_];
103 bool result = overflow_; 118 bool result = overflow_;
104 tail_ = Succ(tail_); 119 tail_ = Succ(tail_);
105 overflow_ = false; 120 overflow_ = false;
106 return result; 121 return result;
107 } 122 }
108 123
109 void Run(); 124 void Run();
110 125
111 // Pause and Resume TickSample data collection. 126 // Pause and Resume TickSample data collection.
112 static bool paused() { return paused_; } 127 static bool paused() {
113 static void pause() { paused_ = true; } 128 return v8_context()->logger_data_.private_data_.profiler_paused_;
114 static void resume() { paused_ = false; } 129 }
130 static void pause() {
131 v8_context()->logger_data_.private_data_.profiler_paused_ = true;
132 }
133 static void resume() {
134 v8_context()->logger_data_.private_data_.profiler_paused_ = false;
135 }
115 136
116 private: 137 private:
117 // Returns the next index in the cyclic buffer. 138 // Returns the next index in the cyclic buffer.
118 int Succ(int index) { return (index + 1) % kBufferSize; } 139 int Succ(int index) { return (index + 1) % kBufferSize; }
119 140
120 // Cyclic buffer for communicating profiling samples 141 // Cyclic buffer for communicating profiling samples
121 // between the signal handler and the worker thread. 142 // between the signal handler and the worker thread.
122 static const int kBufferSize = 128; 143 static const int kBufferSize = 128;
123 TickSample buffer_[kBufferSize]; // Buffer storage. 144 TickSample buffer_[kBufferSize]; // Buffer storage.
124 int head_; // Index to the buffer head. 145 int head_; // Index to the buffer head.
125 int tail_; // Index to the buffer tail. 146 int tail_; // Index to the buffer tail.
126 bool overflow_; // Tell whether a buffer overflow has occurred. 147 bool overflow_; // Tell whether a buffer overflow has occurred.
127 Semaphore* buffer_semaphore_; // Sempahore used for buffer synchronization. 148 Semaphore* buffer_semaphore_; // Sempahore used for buffer synchronization.
128 149
129 // Tells whether profiler is engaged, that is, processing thread is stated. 150 // Tells whether profiler is engaged, that is, processing thread is stated.
130 bool engaged_; 151 bool engaged_;
131 152
132 // Tells whether worker thread should continue running. 153 // Tells whether worker thread should continue running.
133 bool running_; 154 bool running_;
134
135 // Tells whether we are currently recording tick samples.
136 static bool paused_;
137 }; 155 };
138 156
139 bool Profiler::paused_ = false;
140 157
141 158
142 // 159 //
143 // StackTracer implementation 160 // StackTracer implementation
144 // 161 //
145 void StackTracer::Trace(TickSample* sample) { 162 void StackTracer::Trace(TickSample* sample) {
146 if (sample->state == GC) { 163 if (sample->state == GC) {
147 sample->frames_count = 0; 164 sample->frames_count = 0;
148 return; 165 return;
149 } 166 }
150 167
151 const Address js_entry_sp = Top::js_entry_sp(Top::GetCurrentThread()); 168 const Address js_entry_sp = Top::js_entry_sp(Top::GetCurrentThread());
152 if (js_entry_sp == 0) { 169 if (js_entry_sp == 0) {
153 // Not executing JS now. 170 // Not executing JS now.
154 sample->frames_count = 0; 171 sample->frames_count = 0;
155 return; 172 return;
156 } 173 }
157 174
158 int i = 0; 175 int i = 0;
159 const Address callback = Logger::current_state_ != NULL ? 176 LoggerData& logger_data = v8_context()->logger_data_;
160 Logger::current_state_->external_callback() : NULL; 177 const Address callback = logger_data.current_state_ != NULL ?
178 logger_data.current_state_->external_callback() : NULL;
161 if (callback != NULL) { 179 if (callback != NULL) {
162 sample->stack[i++] = callback; 180 sample->stack[i++] = callback;
163 } 181 }
164 182
165 SafeStackTraceFrameIterator it( 183 SafeStackTraceFrameIterator it(
166 reinterpret_cast<Address>(sample->fp), 184 reinterpret_cast<Address>(sample->fp),
167 reinterpret_cast<Address>(sample->sp), 185 reinterpret_cast<Address>(sample->sp),
168 reinterpret_cast<Address>(sample->sp), 186 reinterpret_cast<Address>(sample->sp),
169 js_entry_sp); 187 js_entry_sp);
170 while (!it.done() && i < TickSample::kMaxFramesCount) { 188 while (!it.done() && i < TickSample::kMaxFramesCount) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 }; 239 };
222 240
223 241
224 // 242 //
225 // SlidingStateWindow implementation. 243 // SlidingStateWindow implementation.
226 // 244 //
227 SlidingStateWindow::SlidingStateWindow(): current_index_(0), is_full_(false) { 245 SlidingStateWindow::SlidingStateWindow(): current_index_(0), is_full_(false) {
228 for (int i = 0; i < kBufferSize; i++) { 246 for (int i = 0; i < kBufferSize; i++) {
229 buffer_[i] = static_cast<byte>(OTHER); 247 buffer_[i] = static_cast<byte>(OTHER);
230 } 248 }
231 Logger::ticker_->SetWindow(this); 249 v8_context()->logger_data_.ticker_->SetWindow(this);
232 } 250 }
233 251
234 252
235 SlidingStateWindow::~SlidingStateWindow() { 253 SlidingStateWindow::~SlidingStateWindow() {
236 Logger::ticker_->ClearWindow(); 254 v8_context()->logger_data_.ticker_->ClearWindow();
237 } 255 }
238 256
239 257
240 void SlidingStateWindow::AddState(StateTag state) { 258 void SlidingStateWindow::AddState(StateTag state) {
241 if (is_full_) { 259 if (is_full_) {
242 DecrementStateCounter(static_cast<StateTag>(buffer_[current_index_])); 260 DecrementStateCounter(static_cast<StateTag>(buffer_[current_index_]));
243 } else if (current_index_ == kBufferSize - 1) { 261 } else if (current_index_ == kBufferSize - 1) {
244 is_full_ = true; 262 is_full_ = true;
245 } 263 }
246 buffer_[current_index_] = static_cast<byte>(state); 264 buffer_[current_index_] = static_cast<byte>(state);
(...skipping 24 matching lines...) Expand all
271 // http://code.google.com/p/v8/issues/detail?id=487 289 // http://code.google.com/p/v8/issues/detail?id=487
272 if (!FLAG_prof_lazy) { 290 if (!FLAG_prof_lazy) {
273 OS::LogSharedLibraryAddresses(); 291 OS::LogSharedLibraryAddresses();
274 } 292 }
275 293
276 // Start thread processing the profiler buffer. 294 // Start thread processing the profiler buffer.
277 running_ = true; 295 running_ = true;
278 Start(); 296 Start();
279 297
280 // Register to get ticks. 298 // Register to get ticks.
281 Logger::ticker_->SetProfiler(this); 299 v8_context()->logger_data_.ticker_->SetProfiler(this);
282 300
283 Logger::ProfilerBeginEvent(); 301 Logger::ProfilerBeginEvent();
284 Logger::LogAliases(); 302 Logger::LogAliases();
285 } 303 }
286 304
287 305
288 void Profiler::Disengage() { 306 void Profiler::Disengage() {
289 if (!engaged_) return; 307 if (!engaged_) return;
290 308
291 // Stop receiving ticks. 309 // Stop receiving ticks.
292 Logger::ticker_->ClearProfiler(); 310 v8_context()->logger_data_.ticker_->ClearProfiler();
293 311
294 // Terminate the worker thread by setting running_ to false, 312 // Terminate the worker thread by setting running_ to false,
295 // inserting a fake element in the queue and then wait for 313 // inserting a fake element in the queue and then wait for
296 // the thread to terminate. 314 // the thread to terminate.
297 running_ = false; 315 running_ = false;
298 TickSample sample; 316 TickSample sample;
299 // Reset 'paused_' flag, otherwise semaphore may not be signalled. 317 // Reset 'paused_' flag, otherwise semaphore may not be signalled.
300 resume(); 318 resume();
301 Insert(&sample); 319 Insert(&sample);
302 Join(); 320 Join();
303 321
304 LOG(UncheckedStringEvent("profiler", "end")); 322 LOG(UncheckedStringEvent("profiler", "end"));
305 } 323 }
306 324
307 325
308 void Profiler::Run() { 326 void Profiler::Run() {
309 TickSample sample; 327 TickSample sample;
310 bool overflow = Logger::profiler_->Remove(&sample); 328 LoggerData& logger_data = v8_context()->logger_data_;
329 bool overflow = logger_data.profiler_->Remove(&sample);
311 while (running_) { 330 while (running_) {
312 LOG(TickEvent(&sample, overflow)); 331 LOG(TickEvent(&sample, overflow));
313 overflow = Logger::profiler_->Remove(&sample); 332 overflow = logger_data.profiler_->Remove(&sample);
314 } 333 }
315 } 334 }
316 335
317 336
318 // 337 //
319 // Logger class implementation. 338 // Logger class implementation.
320 // 339 //
321 Ticker* Logger::ticker_ = NULL; 340 LoggerData::LoggerData()
322 Profiler* Logger::profiler_ = NULL; 341 :private_data_(*new LoggerPrivateData()),
323 VMState* Logger::current_state_ = NULL; 342 ticker_(NULL),
324 VMState Logger::bottom_state_(EXTERNAL); 343 profiler_(NULL),
325 SlidingStateWindow* Logger::sliding_state_window_ = NULL; 344 current_state_(NULL),
326 const char** Logger::log_events_ = NULL; 345 sliding_state_window_(NULL),
327 CompressionHelper* Logger::compression_helper_ = NULL; 346 log_events_(NULL),
328 bool Logger::is_logging_ = false; 347 compression_helper_(NULL),
348 is_logging_(false),
349 bottom_state_(EXTERNAL) {
350 }
351
352 LoggerData::~LoggerData() {
353 delete &private_data_;
354 }
329 355
330 #define DECLARE_LONG_EVENT(ignore1, long_name, ignore2) long_name, 356 #define DECLARE_LONG_EVENT(ignore1, long_name, ignore2) long_name,
331 const char* kLongLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = { 357 const char* kLongLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = {
332 LOG_EVENTS_AND_TAGS_LIST(DECLARE_LONG_EVENT) 358 LOG_EVENTS_AND_TAGS_LIST(DECLARE_LONG_EVENT)
333 }; 359 };
334 #undef DECLARE_LONG_EVENT 360 #undef DECLARE_LONG_EVENT
335 361
336 #define DECLARE_SHORT_EVENT(ignore1, ignore2, short_name) short_name, 362 #define DECLARE_SHORT_EVENT(ignore1, ignore2, short_name) short_name,
337 const char* kCompressedLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = { 363 const char* kCompressedLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = {
338 LOG_EVENTS_AND_TAGS_LIST(DECLARE_SHORT_EVENT) 364 LOG_EVENTS_AND_TAGS_LIST(DECLARE_SHORT_EVENT)
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 bool HandleMessage(LogMessageBuilder* msg) { 684 bool HandleMessage(LogMessageBuilder* msg) {
659 if (!msg->StoreInCompressor(&compressor_)) { 685 if (!msg->StoreInCompressor(&compressor_)) {
660 // Current message repeats the previous one, don't write it. 686 // Current message repeats the previous one, don't write it.
661 ++repeat_count_; 687 ++repeat_count_;
662 return false; 688 return false;
663 } 689 }
664 if (repeat_count_ == 0) { 690 if (repeat_count_ == 0) {
665 return msg->RetrieveCompressedPrevious(&compressor_); 691 return msg->RetrieveCompressedPrevious(&compressor_);
666 } 692 }
667 OS::SNPrintF(prefix_, "%s,%d,", 693 OS::SNPrintF(prefix_, "%s,%d,",
668 Logger::log_events_[Logger::REPEAT_META_EVENT], 694 v8_context()->logger_data_.log_events_[Logger::REPEAT_META_EVENT],
669 repeat_count_ + 1); 695 repeat_count_ + 1);
670 repeat_count_ = 0; 696 repeat_count_ = 0;
671 return msg->RetrieveCompressedPrevious(&compressor_, prefix_.start()); 697 return msg->RetrieveCompressedPrevious(&compressor_, prefix_.start());
672 } 698 }
673 699
674 private: 700 private:
675 LogRecordCompressor compressor_; 701 LogRecordCompressor compressor_;
676 int repeat_count_; 702 int repeat_count_;
677 EmbeddedVector<char, 20> prefix_; 703 EmbeddedVector<char, 20> prefix_;
678 }; 704 };
679 705
680 #endif // ENABLE_LOGGING_AND_PROFILING 706 #endif // ENABLE_LOGGING_AND_PROFILING
681 707
682 708
683 #ifdef ENABLE_LOGGING_AND_PROFILING 709 #ifdef ENABLE_LOGGING_AND_PROFILING
684 void Logger::CallbackEventInternal(const char* prefix, const char* name, 710 void Logger::CallbackEventInternal(const char* prefix, const char* name,
685 Address entry_point) { 711 Address entry_point) {
686 if (!Log::IsEnabled() || !FLAG_log_code) return; 712 if (!Log::IsEnabled() || !FLAG_log_code) return;
687 LogMessageBuilder msg; 713 LogMessageBuilder msg;
688 msg.Append("%s,%s,", 714 LoggerData& logger_data = v8_context()->logger_data_;
689 log_events_[CODE_CREATION_EVENT], log_events_[CALLBACK_TAG]); 715 msg.Append("%s,%s,", logger_data.log_events_[CODE_CREATION_EVENT],
716 logger_data.log_events_[CALLBACK_TAG]);
690 msg.AppendAddress(entry_point); 717 msg.AppendAddress(entry_point);
691 msg.Append(",1,\"%s%s\"", prefix, name); 718 msg.Append(",1,\"%s%s\"", prefix, name);
692 if (FLAG_compress_log) { 719 if (FLAG_compress_log) {
693 ASSERT(compression_helper_ != NULL); 720 ASSERT(logger_data.compression_helper_ != NULL);
694 if (!compression_helper_->HandleMessage(&msg)) return; 721 if (!logger_data.compression_helper_->HandleMessage(&msg)) return;
695 } 722 }
696 msg.Append('\n'); 723 msg.Append('\n');
697 msg.WriteToLogFile(); 724 msg.WriteToLogFile();
698 } 725 }
699 #endif 726 #endif
700 727
701 728
702 void Logger::CallbackEvent(String* name, Address entry_point) { 729 void Logger::CallbackEvent(String* name, Address entry_point) {
703 #ifdef ENABLE_LOGGING_AND_PROFILING 730 #ifdef ENABLE_LOGGING_AND_PROFILING
704 if (!Log::IsEnabled() || !FLAG_log_code) return; 731 if (!Log::IsEnabled() || !FLAG_log_code) return;
(...skipping 23 matching lines...) Expand all
728 #endif 755 #endif
729 } 756 }
730 757
731 758
732 void Logger::CodeCreateEvent(LogEventsAndTags tag, 759 void Logger::CodeCreateEvent(LogEventsAndTags tag,
733 Code* code, 760 Code* code,
734 const char* comment) { 761 const char* comment) {
735 #ifdef ENABLE_LOGGING_AND_PROFILING 762 #ifdef ENABLE_LOGGING_AND_PROFILING
736 if (!Log::IsEnabled() || !FLAG_log_code) return; 763 if (!Log::IsEnabled() || !FLAG_log_code) return;
737 LogMessageBuilder msg; 764 LogMessageBuilder msg;
738 msg.Append("%s,%s,", log_events_[CODE_CREATION_EVENT], log_events_[tag]); 765 LoggerData& logger_data = v8_context()->logger_data_;
766 msg.Append("%s,%s,", logger_data.log_events_[CODE_CREATION_EVENT],
767 logger_data.log_events_[tag]);
739 msg.AppendAddress(code->address()); 768 msg.AppendAddress(code->address());
740 msg.Append(",%d,\"", code->ExecutableSize()); 769 msg.Append(",%d,\"", code->ExecutableSize());
741 for (const char* p = comment; *p != '\0'; p++) { 770 for (const char* p = comment; *p != '\0'; p++) {
742 if (*p == '"') { 771 if (*p == '"') {
743 msg.Append('\\'); 772 msg.Append('\\');
744 } 773 }
745 msg.Append(*p); 774 msg.Append(*p);
746 } 775 }
747 msg.Append('"'); 776 msg.Append('"');
748 if (FLAG_compress_log) { 777 if (FLAG_compress_log) {
749 ASSERT(compression_helper_ != NULL); 778 ASSERT(logger_data.compression_helper_ != NULL);
750 if (!compression_helper_->HandleMessage(&msg)) return; 779 if (!logger_data.compression_helper_->HandleMessage(&msg)) return;
751 } 780 }
752 msg.Append('\n'); 781 msg.Append('\n');
753 msg.WriteToLogFile(); 782 msg.WriteToLogFile();
754 #endif 783 #endif
755 } 784 }
756 785
757 786
758 void Logger::CodeCreateEvent(LogEventsAndTags tag, Code* code, String* name) { 787 void Logger::CodeCreateEvent(LogEventsAndTags tag, Code* code, String* name) {
759 #ifdef ENABLE_LOGGING_AND_PROFILING 788 #ifdef ENABLE_LOGGING_AND_PROFILING
760 if (!Log::IsEnabled() || !FLAG_log_code) return; 789 if (!Log::IsEnabled() || !FLAG_log_code) return;
761 LogMessageBuilder msg; 790 LogMessageBuilder msg;
762 SmartPointer<char> str = 791 SmartPointer<char> str =
763 name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); 792 name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
764 msg.Append("%s,%s,", log_events_[CODE_CREATION_EVENT], log_events_[tag]); 793 LoggerData& logger_data = v8_context()->logger_data_;
794 msg.Append("%s,%s,", logger_data.log_events_[CODE_CREATION_EVENT],
795 logger_data.log_events_[tag]);
765 msg.AppendAddress(code->address()); 796 msg.AppendAddress(code->address());
766 msg.Append(",%d,\"%s\"", code->ExecutableSize(), *str); 797 msg.Append(",%d,\"%s\"", code->ExecutableSize(), *str);
767 if (FLAG_compress_log) { 798 if (FLAG_compress_log) {
768 ASSERT(compression_helper_ != NULL); 799 ASSERT(logger_data.compression_helper_ != NULL);
769 if (!compression_helper_->HandleMessage(&msg)) return; 800 if (!logger_data.compression_helper_->HandleMessage(&msg)) return;
770 } 801 }
771 msg.Append('\n'); 802 msg.Append('\n');
772 msg.WriteToLogFile(); 803 msg.WriteToLogFile();
773 #endif 804 #endif
774 } 805 }
775 806
776 807
777 void Logger::CodeCreateEvent(LogEventsAndTags tag, 808 void Logger::CodeCreateEvent(LogEventsAndTags tag,
778 Code* code, String* name, 809 Code* code, String* name,
779 String* source, int line) { 810 String* source, int line) {
780 #ifdef ENABLE_LOGGING_AND_PROFILING 811 #ifdef ENABLE_LOGGING_AND_PROFILING
781 if (!Log::IsEnabled() || !FLAG_log_code) return; 812 if (!Log::IsEnabled() || !FLAG_log_code) return;
782 LogMessageBuilder msg; 813 LogMessageBuilder msg;
783 SmartPointer<char> str = 814 SmartPointer<char> str =
784 name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); 815 name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
785 SmartPointer<char> sourcestr = 816 SmartPointer<char> sourcestr =
786 source->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); 817 source->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
787 msg.Append("%s,%s,", log_events_[CODE_CREATION_EVENT], log_events_[tag]); 818 LoggerData& logger_data = v8_context()->logger_data_;
819 msg.Append("%s,%s,", logger_data.log_events_[CODE_CREATION_EVENT],
820 logger_data.log_events_[tag]);
788 msg.AppendAddress(code->address()); 821 msg.AppendAddress(code->address());
789 msg.Append(",%d,\"%s %s:%d\"", 822 msg.Append(",%d,\"%s %s:%d\"",
790 code->ExecutableSize(), *str, *sourcestr, line); 823 code->ExecutableSize(), *str, *sourcestr, line);
791 if (FLAG_compress_log) { 824 if (FLAG_compress_log) {
792 ASSERT(compression_helper_ != NULL); 825 ASSERT(logger_data.compression_helper_ != NULL);
793 if (!compression_helper_->HandleMessage(&msg)) return; 826 if (!logger_data.compression_helper_->HandleMessage(&msg)) return;
794 } 827 }
795 msg.Append('\n'); 828 msg.Append('\n');
796 msg.WriteToLogFile(); 829 msg.WriteToLogFile();
797 #endif 830 #endif
798 } 831 }
799 832
800 833
801 void Logger::CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count) { 834 void Logger::CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count) {
802 #ifdef ENABLE_LOGGING_AND_PROFILING 835 #ifdef ENABLE_LOGGING_AND_PROFILING
803 if (!Log::IsEnabled() || !FLAG_log_code) return; 836 if (!Log::IsEnabled() || !FLAG_log_code) return;
804 LogMessageBuilder msg; 837 LogMessageBuilder msg;
805 msg.Append("%s,%s,", log_events_[CODE_CREATION_EVENT], log_events_[tag]); 838 LoggerData& logger_data = v8_context()->logger_data_;
839 msg.Append("%s,%s,", logger_data.log_events_[CODE_CREATION_EVENT],
840 logger_data.log_events_[tag]);
806 msg.AppendAddress(code->address()); 841 msg.AppendAddress(code->address());
807 msg.Append(",%d,\"args_count: %d\"", code->ExecutableSize(), args_count); 842 msg.Append(",%d,\"args_count: %d\"", code->ExecutableSize(), args_count);
808 if (FLAG_compress_log) { 843 if (FLAG_compress_log) {
809 ASSERT(compression_helper_ != NULL); 844 ASSERT(logger_data.compression_helper_ != NULL);
810 if (!compression_helper_->HandleMessage(&msg)) return; 845 if (!logger_data.compression_helper_->HandleMessage(&msg)) return;
811 } 846 }
812 msg.Append('\n'); 847 msg.Append('\n');
813 msg.WriteToLogFile(); 848 msg.WriteToLogFile();
814 #endif 849 #endif
815 } 850 }
816 851
817 852
818 void Logger::RegExpCodeCreateEvent(Code* code, String* source) { 853 void Logger::RegExpCodeCreateEvent(Code* code, String* source) {
819 #ifdef ENABLE_LOGGING_AND_PROFILING 854 #ifdef ENABLE_LOGGING_AND_PROFILING
820 if (!Log::IsEnabled() || !FLAG_log_code) return; 855 if (!Log::IsEnabled() || !FLAG_log_code) return;
821 LogMessageBuilder msg; 856 LogMessageBuilder msg;
857 LoggerData& logger_data = v8_context()->logger_data_;
822 msg.Append("%s,%s,", 858 msg.Append("%s,%s,",
823 log_events_[CODE_CREATION_EVENT], log_events_[REG_EXP_TAG]); 859 logger_data.log_events_[CODE_CREATION_EVENT],
860 logger_data.log_events_[REG_EXP_TAG]);
824 msg.AppendAddress(code->address()); 861 msg.AppendAddress(code->address());
825 msg.Append(",%d,\"", code->ExecutableSize()); 862 msg.Append(",%d,\"", code->ExecutableSize());
826 msg.AppendDetailed(source, false); 863 msg.AppendDetailed(source, false);
827 msg.Append('\"'); 864 msg.Append('\"');
828 if (FLAG_compress_log) { 865 if (FLAG_compress_log) {
829 ASSERT(compression_helper_ != NULL); 866 ASSERT(logger_data.compression_helper_ != NULL);
830 if (!compression_helper_->HandleMessage(&msg)) return; 867 if (!logger_data.compression_helper_->HandleMessage(&msg)) return;
831 } 868 }
832 msg.Append('\n'); 869 msg.Append('\n');
833 msg.WriteToLogFile(); 870 msg.WriteToLogFile();
834 #endif 871 #endif
835 } 872 }
836 873
837 874
838 void Logger::CodeMoveEvent(Address from, Address to) { 875 void Logger::CodeMoveEvent(Address from, Address to) {
839 #ifdef ENABLE_LOGGING_AND_PROFILING 876 #ifdef ENABLE_LOGGING_AND_PROFILING
840 static Address prev_to_ = NULL;
841 if (!Log::IsEnabled() || !FLAG_log_code) return; 877 if (!Log::IsEnabled() || !FLAG_log_code) return;
842 LogMessageBuilder msg; 878 LogMessageBuilder msg;
843 msg.Append("%s,", log_events_[CODE_MOVE_EVENT]); 879 LoggerData& logger_data = v8_context()->logger_data_;
880 msg.Append("%s,", logger_data.log_events_[CODE_MOVE_EVENT]);
844 msg.AppendAddress(from); 881 msg.AppendAddress(from);
845 msg.Append(','); 882 msg.Append(',');
846 msg.AppendAddress(to, prev_to_); 883 msg.AppendAddress(to, logger_data.private_data_.prev_to_);
847 prev_to_ = to; 884 logger_data.private_data_.prev_to_ = to;
848 if (FLAG_compress_log) { 885 if (FLAG_compress_log) {
849 ASSERT(compression_helper_ != NULL); 886 ASSERT(logger_data.compression_helper_ != NULL);
850 if (!compression_helper_->HandleMessage(&msg)) return; 887 if (!logger_data.compression_helper_->HandleMessage(&msg)) return;
851 } 888 }
852 msg.Append('\n'); 889 msg.Append('\n');
853 msg.WriteToLogFile(); 890 msg.WriteToLogFile();
854 #endif 891 #endif
855 } 892 }
856 893
857 894
858 void Logger::CodeDeleteEvent(Address from) { 895 void Logger::CodeDeleteEvent(Address from) {
859 #ifdef ENABLE_LOGGING_AND_PROFILING 896 #ifdef ENABLE_LOGGING_AND_PROFILING
860 if (!Log::IsEnabled() || !FLAG_log_code) return; 897 if (!Log::IsEnabled() || !FLAG_log_code) return;
861 LogMessageBuilder msg; 898 LogMessageBuilder msg;
862 msg.Append("%s,", log_events_[CODE_DELETE_EVENT]); 899 LoggerData& logger_data = v8_context()->logger_data_;
900 msg.Append("%s,", logger_data.log_events_[CODE_DELETE_EVENT]);
863 msg.AppendAddress(from); 901 msg.AppendAddress(from);
864 if (FLAG_compress_log) { 902 if (FLAG_compress_log) {
865 ASSERT(compression_helper_ != NULL); 903 ASSERT(logger_data.compression_helper_ != NULL);
866 if (!compression_helper_->HandleMessage(&msg)) return; 904 if (!logger_data.compression_helper_->HandleMessage(&msg)) return;
867 } 905 }
868 msg.Append('\n'); 906 msg.Append('\n');
869 msg.WriteToLogFile(); 907 msg.WriteToLogFile();
870 #endif 908 #endif
871 } 909 }
872 910
873 911
874 void Logger::ResourceEvent(const char* name, const char* tag) { 912 void Logger::ResourceEvent(const char* name, const char* tag) {
875 #ifdef ENABLE_LOGGING_AND_PROFILING 913 #ifdef ENABLE_LOGGING_AND_PROFILING
876 if (!Log::IsEnabled() || !FLAG_log) return; 914 if (!Log::IsEnabled() || !FLAG_log) return;
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 parameter_string); 1082 parameter_string);
1045 DeleteArray(parameter_string); 1083 DeleteArray(parameter_string);
1046 msg.WriteToLogFile(); 1084 msg.WriteToLogFile();
1047 #endif 1085 #endif
1048 } 1086 }
1049 1087
1050 1088
1051 #ifdef ENABLE_LOGGING_AND_PROFILING 1089 #ifdef ENABLE_LOGGING_AND_PROFILING
1052 void Logger::TickEvent(TickSample* sample, bool overflow) { 1090 void Logger::TickEvent(TickSample* sample, bool overflow) {
1053 if (!Log::IsEnabled() || !FLAG_prof) return; 1091 if (!Log::IsEnabled() || !FLAG_prof) return;
1054 static Address prev_sp = NULL; 1092
1055 LogMessageBuilder msg; 1093 LogMessageBuilder msg;
1056 msg.Append("%s,", log_events_[TICK_EVENT]); 1094 LoggerData& logger_data = v8_context()->logger_data_;
1095 msg.Append("%s,", logger_data.log_events_[TICK_EVENT]);
1057 Address prev_addr = reinterpret_cast<Address>(sample->pc); 1096 Address prev_addr = reinterpret_cast<Address>(sample->pc);
1058 msg.AppendAddress(prev_addr); 1097 msg.AppendAddress(prev_addr);
1059 msg.Append(','); 1098 msg.Append(',');
1060 msg.AppendAddress(reinterpret_cast<Address>(sample->sp), prev_sp); 1099 msg.AppendAddress(reinterpret_cast<Address>(sample->sp),
1061 prev_sp = reinterpret_cast<Address>(sample->sp); 1100 logger_data.private_data_.prev_sp_);
1101 logger_data.private_data_.prev_sp_ = reinterpret_cast<Address>(sample->sp);
1062 msg.Append(",%d", static_cast<int>(sample->state)); 1102 msg.Append(",%d", static_cast<int>(sample->state));
1063 if (overflow) { 1103 if (overflow) {
1064 msg.Append(",overflow"); 1104 msg.Append(",overflow");
1065 } 1105 }
1066 for (int i = 0; i < sample->frames_count; ++i) { 1106 for (int i = 0; i < sample->frames_count; ++i) {
1067 msg.Append(','); 1107 msg.Append(',');
1068 msg.AppendAddress(sample->stack[i], prev_addr); 1108 msg.AppendAddress(sample->stack[i], prev_addr);
1069 prev_addr = sample->stack[i]; 1109 prev_addr = sample->stack[i];
1070 } 1110 }
1071 if (FLAG_compress_log) { 1111 if (FLAG_compress_log) {
1072 ASSERT(compression_helper_ != NULL); 1112 ASSERT(logger_data.compression_helper_ != NULL);
1073 if (!compression_helper_->HandleMessage(&msg)) return; 1113 if (!logger_data.compression_helper_->HandleMessage(&msg)) return;
1074 } 1114 }
1075 msg.Append('\n'); 1115 msg.Append('\n');
1076 msg.WriteToLogFile(); 1116 msg.WriteToLogFile();
1077 } 1117 }
1078 1118
1079 1119
1080 int Logger::GetActiveProfilerModules() { 1120 int Logger::GetActiveProfilerModules() {
1081 int result = PROFILER_MODULE_NONE; 1121 int result = PROFILER_MODULE_NONE;
1082 if (!profiler_->paused()) { 1122 if (!v8_context()->logger_data_.profiler_->paused()) {
1083 result |= PROFILER_MODULE_CPU; 1123 result |= PROFILER_MODULE_CPU;
1084 } 1124 }
1085 if (FLAG_log_gc) { 1125 if (FLAG_log_gc) {
1086 result |= PROFILER_MODULE_HEAP_STATS | PROFILER_MODULE_JS_CONSTRUCTORS; 1126 result |= PROFILER_MODULE_HEAP_STATS | PROFILER_MODULE_JS_CONSTRUCTORS;
1087 } 1127 }
1088 return result; 1128 return result;
1089 } 1129 }
1090 1130
1091 1131
1092 void Logger::PauseProfiler(int flags) { 1132 void Logger::PauseProfiler(int flags) {
1093 if (!Log::IsEnabled()) return; 1133 if (!Log::IsEnabled()) return;
1094 const int active_modules = GetActiveProfilerModules(); 1134 const int active_modules = GetActiveProfilerModules();
1095 const int modules_to_disable = active_modules & flags; 1135 const int modules_to_disable = active_modules & flags;
1096 if (modules_to_disable == PROFILER_MODULE_NONE) return; 1136 if (modules_to_disable == PROFILER_MODULE_NONE) return;
1097 1137
1138 LoggerData& logger_data = v8_context()->logger_data_;
1098 if (modules_to_disable & PROFILER_MODULE_CPU) { 1139 if (modules_to_disable & PROFILER_MODULE_CPU) {
1099 profiler_->pause(); 1140 logger_data.profiler_->pause();
1100 if (FLAG_prof_lazy) { 1141 if (FLAG_prof_lazy) {
1101 if (!FLAG_sliding_state_window) ticker_->Stop(); 1142 if (!FLAG_sliding_state_window) logger_data.ticker_->Stop();
1102 FLAG_log_code = false; 1143 FLAG_log_code = false;
1103 // Must be the same message as Log::kDynamicBufferSeal. 1144 // Must be the same message as Log::kDynamicBufferSeal.
1104 LOG(UncheckedStringEvent("profiler", "pause")); 1145 LOG(UncheckedStringEvent("profiler", "pause"));
1105 } 1146 }
1106 } 1147 }
1107 if (modules_to_disable & 1148 if (modules_to_disable &
1108 (PROFILER_MODULE_HEAP_STATS | PROFILER_MODULE_JS_CONSTRUCTORS)) { 1149 (PROFILER_MODULE_HEAP_STATS | PROFILER_MODULE_JS_CONSTRUCTORS)) {
1109 FLAG_log_gc = false; 1150 FLAG_log_gc = false;
1110 } 1151 }
1111 // Turn off logging if no active modules remain. 1152 // Turn off logging if no active modules remain.
1112 if ((active_modules & ~flags) == PROFILER_MODULE_NONE) { 1153 if ((active_modules & ~flags) == PROFILER_MODULE_NONE) {
1113 is_logging_ = false; 1154 logger_data.is_logging_ = false;
1114 } 1155 }
1115 } 1156 }
1116 1157
1117 1158
1118 void Logger::ResumeProfiler(int flags) { 1159 void Logger::ResumeProfiler(int flags) {
1119 if (!Log::IsEnabled()) return; 1160 if (!Log::IsEnabled()) return;
1120 const int modules_to_enable = ~GetActiveProfilerModules() & flags; 1161 const int modules_to_enable = ~GetActiveProfilerModules() & flags;
1162 LoggerData& logger_data = v8_context()->logger_data_;
1121 if (modules_to_enable != PROFILER_MODULE_NONE) { 1163 if (modules_to_enable != PROFILER_MODULE_NONE) {
1122 is_logging_ = true; 1164 logger_data.is_logging_ = true;
1123 } 1165 }
1124 if (modules_to_enable & PROFILER_MODULE_CPU) { 1166 if (modules_to_enable & PROFILER_MODULE_CPU) {
1125 if (FLAG_prof_lazy) { 1167 if (FLAG_prof_lazy) {
1126 profiler_->Engage(); 1168 logger_data.profiler_->Engage();
1127 LOG(UncheckedStringEvent("profiler", "resume")); 1169 LOG(UncheckedStringEvent("profiler", "resume"));
1128 FLAG_log_code = true; 1170 FLAG_log_code = true;
1129 LogCompiledFunctions(); 1171 LogCompiledFunctions();
1130 LogAccessorCallbacks(); 1172 LogAccessorCallbacks();
1131 if (!FLAG_sliding_state_window) ticker_->Start(); 1173 if (!FLAG_sliding_state_window) logger_data.ticker_->Start();
1132 } 1174 }
1133 profiler_->resume(); 1175 logger_data.profiler_->resume();
1134 } 1176 }
1135 if (modules_to_enable & 1177 if (modules_to_enable &
1136 (PROFILER_MODULE_HEAP_STATS | PROFILER_MODULE_JS_CONSTRUCTORS)) { 1178 (PROFILER_MODULE_HEAP_STATS | PROFILER_MODULE_JS_CONSTRUCTORS)) {
1137 FLAG_log_gc = true; 1179 FLAG_log_gc = true;
1138 } 1180 }
1139 } 1181 }
1140 1182
1141 1183
1142 // This function can be called when Log's mutex is acquired, 1184 // This function can be called when Log's mutex is acquired,
1143 // either from main or Profiler's thread. 1185 // either from main or Profiler's thread.
1144 void Logger::StopLoggingAndProfiling() { 1186 void Logger::StopLoggingAndProfiling() {
1145 Log::stop(); 1187 Log::stop();
1146 PauseProfiler(PROFILER_MODULE_CPU); 1188 PauseProfiler(PROFILER_MODULE_CPU);
1147 } 1189 }
1148 1190
1149 1191
1150 bool Logger::IsProfilerSamplerActive() { 1192 bool Logger::IsProfilerSamplerActive() {
1151 return ticker_->IsActive(); 1193 return v8_context()->logger_data_.ticker_->IsActive();
1152 } 1194 }
1153 1195
1154 1196
1155 int Logger::GetLogLines(int from_pos, char* dest_buf, int max_size) { 1197 int Logger::GetLogLines(int from_pos, char* dest_buf, int max_size) {
1156 return Log::GetLogLines(from_pos, dest_buf, max_size); 1198 return Log::GetLogLines(from_pos, dest_buf, max_size);
1157 } 1199 }
1158 1200
1159 1201
1160 static int EnumerateCompiledFunctions(Handle<SharedFunctionInfo>* sfis) { 1202 static int EnumerateCompiledFunctions(Handle<SharedFunctionInfo>* sfis) {
1161 AssertNoAllocation no_alloc; 1203 AssertNoAllocation no_alloc;
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 } else { 1406 } else {
1365 stream.Put(*p); 1407 stream.Put(*p);
1366 } 1408 }
1367 } 1409 }
1368 SmartPointer<const char> expanded = stream.ToCString(); 1410 SmartPointer<const char> expanded = stream.ToCString();
1369 Log::OpenFile(*expanded); 1411 Log::OpenFile(*expanded);
1370 } else { 1412 } else {
1371 Log::OpenFile(FLAG_logfile); 1413 Log::OpenFile(FLAG_logfile);
1372 } 1414 }
1373 } 1415 }
1416 LoggerData& logger_data = v8_context()->logger_data_;
1417 logger_data.current_state_ = &logger_data.bottom_state_;
1374 1418
1375 current_state_ = &bottom_state_; 1419 logger_data.ticker_ = new Ticker(kSamplingIntervalMs);
1376 1420
1377 ticker_ = new Ticker(kSamplingIntervalMs); 1421 if (FLAG_sliding_state_window && logger_data.sliding_state_window_ == NULL) {
1378 1422 logger_data.sliding_state_window_ = new SlidingStateWindow();
1379 if (FLAG_sliding_state_window && sliding_state_window_ == NULL) {
1380 sliding_state_window_ = new SlidingStateWindow();
1381 } 1423 }
1382 1424
1383 log_events_ = FLAG_compress_log ? 1425 logger_data.log_events_ = FLAG_compress_log ?
1384 kCompressedLogEventsNames : kLongLogEventsNames; 1426 kCompressedLogEventsNames : kLongLogEventsNames;
1385 if (FLAG_compress_log) { 1427 if (FLAG_compress_log) {
1386 compression_helper_ = new CompressionHelper(kCompressionWindowSize); 1428 logger_data.compression_helper_ =
1429 new CompressionHelper(kCompressionWindowSize);
1387 } 1430 }
1388 1431
1389 is_logging_ = start_logging; 1432 logger_data.is_logging_ = start_logging;
1390 1433
1391 if (FLAG_prof) { 1434 if (FLAG_prof) {
1392 profiler_ = new Profiler(); 1435 logger_data.profiler_ = new Profiler();
1393 if (!FLAG_prof_auto) { 1436 if (!FLAG_prof_auto) {
1394 profiler_->pause(); 1437 logger_data.profiler_->pause();
1395 } else { 1438 } else {
1396 is_logging_ = true; 1439 logger_data.is_logging_ = true;
1397 } 1440 }
1398 if (!FLAG_prof_lazy) { 1441 if (!FLAG_prof_lazy) {
1399 profiler_->Engage(); 1442 logger_data.profiler_->Engage();
1400 } 1443 }
1401 } 1444 }
1402 1445
1403 LogMessageBuilder::set_write_failure_handler(StopLoggingAndProfiling); 1446 v8_context()->log_data_.set_write_failure_handler(StopLoggingAndProfiling);
1404 1447
1405 return true; 1448 return true;
1406 1449
1407 #else 1450 #else
1408 return false; 1451 return false;
1409 #endif 1452 #endif
1410 } 1453 }
1411 1454
1412 1455
1413 void Logger::TearDown() { 1456 void Logger::TearDown() {
1414 #ifdef ENABLE_LOGGING_AND_PROFILING 1457 #ifdef ENABLE_LOGGING_AND_PROFILING
1415 LogMessageBuilder::set_write_failure_handler(NULL); 1458 LoggerData& logger_data = v8_context()->logger_data_;
1459 v8_context()->log_data_.set_write_failure_handler(NULL);
1416 1460
1417 // Stop the profiler before closing the file. 1461 // Stop the profiler before closing the file.
1418 if (profiler_ != NULL) { 1462 if (logger_data.profiler_ != NULL) {
1419 profiler_->Disengage(); 1463 logger_data.profiler_->Disengage();
1420 delete profiler_; 1464 delete logger_data.profiler_;
1421 profiler_ = NULL; 1465 logger_data.profiler_ = NULL;
1422 } 1466 }
1423 1467
1424 delete compression_helper_; 1468 delete logger_data.compression_helper_;
1425 compression_helper_ = NULL; 1469 logger_data.compression_helper_ = NULL;
1426 1470
1427 delete sliding_state_window_; 1471 delete logger_data.sliding_state_window_;
1428 sliding_state_window_ = NULL; 1472 logger_data.sliding_state_window_ = NULL;
1429 1473
1430 delete ticker_; 1474 delete logger_data.ticker_;
1431 ticker_ = NULL; 1475 logger_data.ticker_ = NULL;
1432 1476
1433 Log::Close(); 1477 Log::Close();
1434 #endif 1478 #endif
1435 } 1479 }
1436 1480
1437 1481
1438 void Logger::EnableSlidingStateWindow() { 1482 void Logger::EnableSlidingStateWindow() {
1439 #ifdef ENABLE_LOGGING_AND_PROFILING 1483 #ifdef ENABLE_LOGGING_AND_PROFILING
1484 LoggerData& logger_data = v8_context()->logger_data_;
1440 // If the ticker is NULL, Logger::Setup has not been called yet. In 1485 // If the ticker is NULL, Logger::Setup has not been called yet. In
1441 // that case, we set the sliding_state_window flag so that the 1486 // that case, we set the sliding_state_window flag so that the
1442 // sliding window computation will be started when Logger::Setup is 1487 // sliding window computation will be started when Logger::Setup is
1443 // called. 1488 // called.
1444 if (ticker_ == NULL) { 1489 if (logger_data.ticker_ == NULL) {
1445 FLAG_sliding_state_window = true; 1490 FLAG_sliding_state_window = true;
1446 return; 1491 return;
1447 } 1492 }
1448 // Otherwise, if the sliding state window computation has not been 1493 // Otherwise, if the sliding state window computation has not been
1449 // started we do it now. 1494 // started we do it now.
1450 if (sliding_state_window_ == NULL) { 1495 if (logger_data.sliding_state_window_ == NULL) {
1451 sliding_state_window_ = new SlidingStateWindow(); 1496 logger_data.sliding_state_window_ = new SlidingStateWindow();
1452 } 1497 }
1453 #endif 1498 #endif
1454 } 1499 }
1455 1500
1456 1501
1457 } } // namespace v8::internal 1502 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/log.h ('k') | src/log-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698