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 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1553 } | 1553 } |
1554 | 1554 |
1555 | 1555 |
1556 // This function can be called when Log's mutex is acquired, | 1556 // This function can be called when Log's mutex is acquired, |
1557 // either from main or Profiler's thread. | 1557 // either from main or Profiler's thread. |
1558 void Logger::LogFailure() { | 1558 void Logger::LogFailure() { |
1559 PauseProfiler(); | 1559 PauseProfiler(); |
1560 } | 1560 } |
1561 | 1561 |
1562 | 1562 |
1563 bool Logger::IsProfilerSamplerActive() { | |
1564 return ticker_->IsActive(); | |
1565 } | |
1566 | |
1567 | |
1568 class EnumerateOptimizedFunctionsVisitor: public OptimizedFunctionVisitor { | 1563 class EnumerateOptimizedFunctionsVisitor: public OptimizedFunctionVisitor { |
1569 public: | 1564 public: |
1570 EnumerateOptimizedFunctionsVisitor(Handle<SharedFunctionInfo>* sfis, | 1565 EnumerateOptimizedFunctionsVisitor(Handle<SharedFunctionInfo>* sfis, |
1571 Handle<Code>* code_objects, | 1566 Handle<Code>* code_objects, |
1572 int* count) | 1567 int* count) |
1573 : sfis_(sfis), code_objects_(code_objects), count_(count) { } | 1568 : sfis_(sfis), code_objects_(code_objects), count_(count) { } |
1574 | 1569 |
1575 virtual void EnterContext(Context* context) {} | 1570 virtual void EnterContext(Context* context) {} |
1576 virtual void LeaveContext(Context* context) {} | 1571 virtual void LeaveContext(Context* context) {} |
1577 | 1572 |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1930 LogCompiledFunctions(); | 1925 LogCompiledFunctions(); |
1931 } | 1926 } |
1932 } | 1927 } |
1933 | 1928 |
1934 | 1929 |
1935 Sampler* Logger::sampler() { | 1930 Sampler* Logger::sampler() { |
1936 return ticker_; | 1931 return ticker_; |
1937 } | 1932 } |
1938 | 1933 |
1939 | 1934 |
1940 void Logger::EnsureTickerStarted() { | |
1941 ASSERT(ticker_ != NULL); | |
1942 if (!ticker_->IsActive()) ticker_->Start(); | |
1943 } | |
1944 | |
1945 | |
1946 void Logger::EnsureTickerStopped() { | |
1947 if (ticker_ != NULL && ticker_->IsActive()) ticker_->Stop(); | |
1948 } | |
1949 | |
1950 | |
1951 FILE* Logger::TearDown() { | 1935 FILE* Logger::TearDown() { |
1952 if (!is_initialized_) return NULL; | 1936 if (!is_initialized_) return NULL; |
1953 is_initialized_ = false; | 1937 is_initialized_ = false; |
1954 | 1938 |
1955 // Stop the profiler before closing the file. | 1939 // Stop the profiler before closing the file. |
1956 if (profiler_ != NULL) { | 1940 if (profiler_ != NULL) { |
1957 profiler_->Disengage(); | 1941 profiler_->Disengage(); |
1958 delete profiler_; | 1942 delete profiler_; |
1959 profiler_ = NULL; | 1943 profiler_ = NULL; |
1960 } | 1944 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2020 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { | 2004 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { |
2021 ASSERT(sampler->IsActive()); | 2005 ASSERT(sampler->IsActive()); |
2022 ScopedLock lock(active_samplers_mutex); | 2006 ScopedLock lock(active_samplers_mutex); |
2023 ASSERT(active_samplers_ != NULL); | 2007 ASSERT(active_samplers_ != NULL); |
2024 bool removed = active_samplers_->RemoveElement(sampler); | 2008 bool removed = active_samplers_->RemoveElement(sampler); |
2025 ASSERT(removed); | 2009 ASSERT(removed); |
2026 USE(removed); | 2010 USE(removed); |
2027 } | 2011 } |
2028 | 2012 |
2029 } } // namespace v8::internal | 2013 } } // namespace v8::internal |
OLD | NEW |