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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 } | 155 } |
156 | 156 |
157 const Address functionAddr = | 157 const Address functionAddr = |
158 sample->fp + JavaScriptFrameConstants::kFunctionOffset; | 158 sample->fp + JavaScriptFrameConstants::kFunctionOffset; |
159 if (SafeStackFrameIterator::IsWithinBounds(sample->sp, js_entry_sp, | 159 if (SafeStackFrameIterator::IsWithinBounds(sample->sp, js_entry_sp, |
160 functionAddr)) { | 160 functionAddr)) { |
161 sample->function = Memory::Address_at(functionAddr) - kHeapObjectTag; | 161 sample->function = Memory::Address_at(functionAddr) - kHeapObjectTag; |
162 } | 162 } |
163 | 163 |
164 int i = 0; | 164 int i = 0; |
165 const Address callback = Logger::current_state_ != NULL ? | 165 const Address callback = VMState::external_callback(); |
166 Logger::current_state_->external_callback() : NULL; | |
167 if (callback != NULL) { | 166 if (callback != NULL) { |
168 sample->stack[i++] = callback; | 167 sample->stack[i++] = callback; |
169 } | 168 } |
170 | 169 |
171 SafeStackTraceFrameIterator it(sample->fp, sample->sp, | 170 SafeStackTraceFrameIterator it(sample->fp, sample->sp, |
172 sample->sp, js_entry_sp); | 171 sample->sp, js_entry_sp); |
173 while (!it.done() && i < TickSample::kMaxFramesCount) { | 172 while (!it.done() && i < TickSample::kMaxFramesCount) { |
174 sample->stack[i++] = it.frame()->pc(); | 173 sample->stack[i++] = it.frame()->pc(); |
175 it.Advance(); | 174 it.Advance(); |
176 } | 175 } |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 overflow = Logger::profiler_->Remove(&sample); | 319 overflow = Logger::profiler_->Remove(&sample); |
321 } | 320 } |
322 } | 321 } |
323 | 322 |
324 | 323 |
325 // | 324 // |
326 // Logger class implementation. | 325 // Logger class implementation. |
327 // | 326 // |
328 Ticker* Logger::ticker_ = NULL; | 327 Ticker* Logger::ticker_ = NULL; |
329 Profiler* Logger::profiler_ = NULL; | 328 Profiler* Logger::profiler_ = NULL; |
330 VMState* Logger::current_state_ = NULL; | |
331 VMState Logger::bottom_state_(EXTERNAL); | |
332 SlidingStateWindow* Logger::sliding_state_window_ = NULL; | 329 SlidingStateWindow* Logger::sliding_state_window_ = NULL; |
333 const char** Logger::log_events_ = NULL; | 330 const char** Logger::log_events_ = NULL; |
334 CompressionHelper* Logger::compression_helper_ = NULL; | 331 CompressionHelper* Logger::compression_helper_ = NULL; |
335 int Logger::logging_nesting_ = 0; | 332 int Logger::logging_nesting_ = 0; |
336 int Logger::cpu_profiler_nesting_ = 0; | 333 int Logger::cpu_profiler_nesting_ = 0; |
337 int Logger::heap_profiler_nesting_ = 0; | 334 int Logger::heap_profiler_nesting_ = 0; |
338 | 335 |
339 #define DECLARE_LONG_EVENT(ignore1, long_name, ignore2) long_name, | 336 #define DECLARE_LONG_EVENT(ignore1, long_name, ignore2) long_name, |
340 const char* kLongLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = { | 337 const char* kLongLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = { |
341 LOG_EVENTS_AND_TAGS_LIST(DECLARE_LONG_EVENT) | 338 LOG_EVENTS_AND_TAGS_LIST(DECLARE_LONG_EVENT) |
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1474 stream.Put(*p); | 1471 stream.Put(*p); |
1475 } | 1472 } |
1476 } | 1473 } |
1477 SmartPointer<const char> expanded = stream.ToCString(); | 1474 SmartPointer<const char> expanded = stream.ToCString(); |
1478 Log::OpenFile(*expanded); | 1475 Log::OpenFile(*expanded); |
1479 } else { | 1476 } else { |
1480 Log::OpenFile(FLAG_logfile); | 1477 Log::OpenFile(FLAG_logfile); |
1481 } | 1478 } |
1482 } | 1479 } |
1483 | 1480 |
1484 current_state_ = &bottom_state_; | 1481 ASSERT(VMState::current_state_ == NULL); // NULL implies outermost external. |
1485 | 1482 |
1486 ticker_ = new Ticker(kSamplingIntervalMs); | 1483 ticker_ = new Ticker(kSamplingIntervalMs); |
1487 | 1484 |
1488 if (FLAG_sliding_state_window && sliding_state_window_ == NULL) { | 1485 if (FLAG_sliding_state_window && sliding_state_window_ == NULL) { |
1489 sliding_state_window_ = new SlidingStateWindow(); | 1486 sliding_state_window_ = new SlidingStateWindow(); |
1490 } | 1487 } |
1491 | 1488 |
1492 log_events_ = FLAG_compress_log ? | 1489 log_events_ = FLAG_compress_log ? |
1493 kCompressedLogEventsNames : kLongLogEventsNames; | 1490 kCompressedLogEventsNames : kLongLogEventsNames; |
1494 if (FLAG_compress_log) { | 1491 if (FLAG_compress_log) { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1563 } | 1560 } |
1564 // Otherwise, if the sliding state window computation has not been | 1561 // Otherwise, if the sliding state window computation has not been |
1565 // started we do it now. | 1562 // started we do it now. |
1566 if (sliding_state_window_ == NULL) { | 1563 if (sliding_state_window_ == NULL) { |
1567 sliding_state_window_ = new SlidingStateWindow(); | 1564 sliding_state_window_ = new SlidingStateWindow(); |
1568 } | 1565 } |
1569 #endif | 1566 #endif |
1570 } | 1567 } |
1571 | 1568 |
1572 } } // namespace v8::internal | 1569 } } // namespace v8::internal |
OLD | NEW |