| 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 if (engaged_) return; | 209 if (engaged_) return; |
| 210 engaged_ = true; | 210 engaged_ = true; |
| 211 | 211 |
| 212 OS::LogSharedLibraryAddresses(); | 212 OS::LogSharedLibraryAddresses(); |
| 213 | 213 |
| 214 // Start thread processing the profiler buffer. | 214 // Start thread processing the profiler buffer. |
| 215 running_ = true; | 215 running_ = true; |
| 216 Start(); | 216 Start(); |
| 217 | 217 |
| 218 // Register to get ticks. | 218 // Register to get ticks. |
| 219 LOGGER->ticker_->SetProfiler(this); | 219 Logger* logger = isolate_->logger(); |
| 220 logger->ticker_->SetProfiler(this); |
| 220 | 221 |
| 221 LOGGER->ProfilerBeginEvent(); | 222 logger->ProfilerBeginEvent(); |
| 222 } | 223 } |
| 223 | 224 |
| 224 | 225 |
| 225 void Profiler::Disengage() { | 226 void Profiler::Disengage() { |
| 226 if (!engaged_) return; | 227 if (!engaged_) return; |
| 227 | 228 |
| 228 // Stop receiving ticks. | 229 // Stop receiving ticks. |
| 229 LOGGER->ticker_->ClearProfiler(); | 230 isolate_->logger()->ticker_->ClearProfiler(); |
| 230 | 231 |
| 231 // Terminate the worker thread by setting running_ to false, | 232 // Terminate the worker thread by setting running_ to false, |
| 232 // inserting a fake element in the queue and then wait for | 233 // inserting a fake element in the queue and then wait for |
| 233 // the thread to terminate. | 234 // the thread to terminate. |
| 234 running_ = false; | 235 running_ = false; |
| 235 TickSample sample; | 236 TickSample sample; |
| 236 // Reset 'paused_' flag, otherwise semaphore may not be signalled. | 237 // Reset 'paused_' flag, otherwise semaphore may not be signalled. |
| 237 resume(); | 238 resume(); |
| 238 Insert(&sample); | 239 Insert(&sample); |
| 239 Join(); | 240 Join(); |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 void Logger::RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache) { | 772 void Logger::RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache) { |
| 772 if (!log_->IsEnabled() || !FLAG_log_regexp) return; | 773 if (!log_->IsEnabled() || !FLAG_log_regexp) return; |
| 773 LogMessageBuilder msg(this); | 774 LogMessageBuilder msg(this); |
| 774 msg.Append("regexp-compile,"); | 775 msg.Append("regexp-compile,"); |
| 775 LogRegExpSource(regexp); | 776 LogRegExpSource(regexp); |
| 776 msg.Append(in_cache ? ",hit\n" : ",miss\n"); | 777 msg.Append(in_cache ? ",hit\n" : ",miss\n"); |
| 777 msg.WriteToLogFile(); | 778 msg.WriteToLogFile(); |
| 778 } | 779 } |
| 779 | 780 |
| 780 | 781 |
| 781 void Logger::LogRuntime(Isolate* isolate, | 782 void Logger::LogRuntime(Vector<const char> format, |
| 782 Vector<const char> format, | |
| 783 JSArray* args) { | 783 JSArray* args) { |
| 784 if (!log_->IsEnabled() || !FLAG_log_runtime) return; | 784 if (!log_->IsEnabled() || !FLAG_log_runtime) return; |
| 785 HandleScope scope(isolate); | 785 HandleScope scope(isolate_); |
| 786 LogMessageBuilder msg(this); | 786 LogMessageBuilder msg(this); |
| 787 for (int i = 0; i < format.length(); i++) { | 787 for (int i = 0; i < format.length(); i++) { |
| 788 char c = format[i]; | 788 char c = format[i]; |
| 789 if (c == '%' && i <= format.length() - 2) { | 789 if (c == '%' && i <= format.length() - 2) { |
| 790 i++; | 790 i++; |
| 791 ASSERT('0' <= format[i] && format[i] <= '9'); | 791 ASSERT('0' <= format[i] && format[i] <= '9'); |
| 792 MaybeObject* maybe = args->GetElement(format[i] - '0'); | 792 MaybeObject* maybe = args->GetElement(format[i] - '0'); |
| 793 Object* obj; | 793 Object* obj; |
| 794 if (!maybe->ToObject(&obj)) { | 794 if (!maybe->ToObject(&obj)) { |
| 795 msg.Append("<exception>"); | 795 msg.Append("<exception>"); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 | 892 |
| 893 void Logger::DeleteEvent(const char* name, void* object) { | 893 void Logger::DeleteEvent(const char* name, void* object) { |
| 894 if (!log_->IsEnabled() || !FLAG_log) return; | 894 if (!log_->IsEnabled() || !FLAG_log) return; |
| 895 LogMessageBuilder msg(this); | 895 LogMessageBuilder msg(this); |
| 896 msg.Append("delete,%s,0x%" V8PRIxPTR "\n", name, object); | 896 msg.Append("delete,%s,0x%" V8PRIxPTR "\n", name, object); |
| 897 msg.WriteToLogFile(); | 897 msg.WriteToLogFile(); |
| 898 } | 898 } |
| 899 | 899 |
| 900 | 900 |
| 901 void Logger::NewEventStatic(const char* name, void* object, size_t size) { | 901 void Logger::NewEventStatic(const char* name, void* object, size_t size) { |
| 902 LOGGER->NewEvent(name, object, size); | 902 Isolate::Current()->logger()->NewEvent(name, object, size); |
| 903 } | 903 } |
| 904 | 904 |
| 905 | 905 |
| 906 void Logger::DeleteEventStatic(const char* name, void* object) { | 906 void Logger::DeleteEventStatic(const char* name, void* object) { |
| 907 LOGGER->DeleteEvent(name, object); | 907 Isolate::Current()->logger()->DeleteEvent(name, object); |
| 908 } | 908 } |
| 909 | 909 |
| 910 void Logger::CallbackEventInternal(const char* prefix, Name* name, | 910 void Logger::CallbackEventInternal(const char* prefix, Name* name, |
| 911 Address entry_point) { | 911 Address entry_point) { |
| 912 if (!log_->IsEnabled() || !FLAG_log_code) return; | 912 if (!log_->IsEnabled() || !FLAG_log_code) return; |
| 913 LogMessageBuilder msg(this); | 913 LogMessageBuilder msg(this); |
| 914 msg.Append("%s,%s,-3,", | 914 msg.Append("%s,%s,-3,", |
| 915 kLogEventsNames[CODE_CREATION_EVENT], | 915 kLogEventsNames[CODE_CREATION_EVENT], |
| 916 kLogEventsNames[CALLBACK_TAG]); | 916 kLogEventsNames[CALLBACK_TAG]); |
| 917 msg.AppendAddress(entry_point); | 917 msg.AppendAddress(entry_point); |
| (...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2004 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { | 2004 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { |
| 2005 ASSERT(sampler->IsActive()); | 2005 ASSERT(sampler->IsActive()); |
| 2006 ScopedLock lock(active_samplers_mutex); | 2006 ScopedLock lock(active_samplers_mutex); |
| 2007 ASSERT(active_samplers_ != NULL); | 2007 ASSERT(active_samplers_ != NULL); |
| 2008 bool removed = active_samplers_->RemoveElement(sampler); | 2008 bool removed = active_samplers_->RemoveElement(sampler); |
| 2009 ASSERT(removed); | 2009 ASSERT(removed); |
| 2010 USE(removed); | 2010 USE(removed); |
| 2011 } | 2011 } |
| 2012 | 2012 |
| 2013 } } // namespace v8::internal | 2013 } } // namespace v8::internal |
| OLD | NEW |