| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 // Avoid collecting traces while doing GC. | 120 // Avoid collecting traces while doing GC. |
| 121 if (sample->state == GC) return; | 121 if (sample->state == GC) return; |
| 122 | 122 |
| 123 const Address js_entry_sp = | 123 const Address js_entry_sp = |
| 124 Isolate::js_entry_sp(isolate->thread_local_top()); | 124 Isolate::js_entry_sp(isolate->thread_local_top()); |
| 125 if (js_entry_sp == 0) { | 125 if (js_entry_sp == 0) { |
| 126 // Not executing JS now. | 126 // Not executing JS now. |
| 127 return; | 127 return; |
| 128 } | 128 } |
| 129 | 129 |
| 130 const Address callback = isolate->external_callback(); | 130 sample->external_callback = isolate->external_callback(); |
| 131 if (callback != NULL) { | |
| 132 sample->external_callback = callback; | |
| 133 sample->has_external_callback = true; | |
| 134 } else { | |
| 135 // Sample potential return address value for frameless invocation of | |
| 136 // stubs (we'll figure out later, if this value makes sense). | |
| 137 sample->tos = Memory::Address_at(sample->sp); | |
| 138 sample->has_external_callback = false; | |
| 139 } | |
| 140 | 131 |
| 141 SafeStackTraceFrameIterator it(isolate, | 132 SafeStackTraceFrameIterator it(isolate, |
| 142 sample->fp, sample->sp, | 133 sample->fp, sample->sp, |
| 143 sample->sp, js_entry_sp); | 134 sample->sp, js_entry_sp); |
| 144 int i = 0; | 135 int i = 0; |
| 145 while (!it.done() && i < TickSample::kMaxFramesCount) { | 136 while (!it.done() && i < TickSample::kMaxFramesCount) { |
| 146 sample->stack[i++] = it.frame()->pc(); | 137 sample->stack[i++] = it.frame()->pc(); |
| 147 it.Advance(); | 138 it.Advance(); |
| 148 } | 139 } |
| 149 sample->frames_count = i; | 140 sample->frames_count = i; |
| (...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1485 | 1476 |
| 1486 | 1477 |
| 1487 void Logger::TickEvent(TickSample* sample, bool overflow) { | 1478 void Logger::TickEvent(TickSample* sample, bool overflow) { |
| 1488 if (!log_->IsEnabled() || !FLAG_prof) return; | 1479 if (!log_->IsEnabled() || !FLAG_prof) return; |
| 1489 LogMessageBuilder msg(this); | 1480 LogMessageBuilder msg(this); |
| 1490 msg.Append("%s,", kLogEventsNames[TICK_EVENT]); | 1481 msg.Append("%s,", kLogEventsNames[TICK_EVENT]); |
| 1491 msg.AppendAddress(sample->pc); | 1482 msg.AppendAddress(sample->pc); |
| 1492 msg.Append(','); | 1483 msg.Append(','); |
| 1493 msg.AppendAddress(sample->sp); | 1484 msg.AppendAddress(sample->sp); |
| 1494 msg.Append(",%ld", static_cast<int>(OS::Ticks() - epoch_)); | 1485 msg.Append(",%ld", static_cast<int>(OS::Ticks() - epoch_)); |
| 1495 if (sample->has_external_callback) { | 1486 msg.AppendAddress(sample->external_callback); |
| 1496 msg.Append(",1,"); | |
| 1497 msg.AppendAddress(sample->external_callback); | |
| 1498 } else { | |
| 1499 msg.Append(",0,"); | |
| 1500 msg.AppendAddress(sample->tos); | |
| 1501 } | |
| 1502 msg.Append(",%d", static_cast<int>(sample->state)); | 1487 msg.Append(",%d", static_cast<int>(sample->state)); |
| 1503 if (overflow) { | 1488 if (overflow) { |
| 1504 msg.Append(",overflow"); | 1489 msg.Append(",overflow"); |
| 1505 } | 1490 } |
| 1506 for (int i = 0; i < sample->frames_count; ++i) { | 1491 for (int i = 0; i < sample->frames_count; ++i) { |
| 1507 msg.Append(','); | 1492 msg.Append(','); |
| 1508 msg.AppendAddress(sample->stack[i]); | 1493 msg.AppendAddress(sample->stack[i]); |
| 1509 } | 1494 } |
| 1510 msg.Append('\n'); | 1495 msg.Append('\n'); |
| 1511 msg.WriteToLogFile(); | 1496 msg.WriteToLogFile(); |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2004 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { | 1989 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { |
| 2005 ASSERT(sampler->IsActive()); | 1990 ASSERT(sampler->IsActive()); |
| 2006 ScopedLock lock(active_samplers_mutex); | 1991 ScopedLock lock(active_samplers_mutex); |
| 2007 ASSERT(active_samplers_ != NULL); | 1992 ASSERT(active_samplers_ != NULL); |
| 2008 bool removed = active_samplers_->RemoveElement(sampler); | 1993 bool removed = active_samplers_->RemoveElement(sampler); |
| 2009 ASSERT(removed); | 1994 ASSERT(removed); |
| 2010 USE(removed); | 1995 USE(removed); |
| 2011 } | 1996 } |
| 2012 | 1997 |
| 2013 } } // namespace v8::internal | 1998 } } // namespace v8::internal |
| OLD | NEW |