Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 13 matching lines...) Expand all Loading... | |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_CPU_PROFILER_INL_H_ | 28 #ifndef V8_CPU_PROFILER_INL_H_ |
| 29 #define V8_CPU_PROFILER_INL_H_ | 29 #define V8_CPU_PROFILER_INL_H_ |
| 30 | 30 |
| 31 #include "cpu-profiler.h" | 31 #include "cpu-profiler.h" |
| 32 | 32 |
| 33 #include <new> | 33 #include <new> |
| 34 #include "circular-queue-inl.h" | |
| 35 #include "profile-generator-inl.h" | 34 #include "profile-generator-inl.h" |
| 36 #include "unbound-queue-inl.h" | 35 #include "unbound-queue-inl.h" |
| 37 | 36 |
| 38 namespace v8 { | 37 namespace v8 { |
| 39 namespace internal { | 38 namespace internal { |
| 40 | 39 |
| 41 void CodeCreateEventRecord::UpdateCodeMap(CodeMap* code_map) { | 40 void CodeCreateEventRecord::UpdateCodeMap(CodeMap* code_map) { |
| 42 code_map->AddCode(start, entry, size); | 41 code_map->AddCode(start, entry, size); |
| 43 if (shared != NULL) { | 42 if (shared != NULL) { |
| 44 entry->set_shared_id(code_map->GetSharedId(shared)); | 43 entry->set_shared_id(code_map->GetSharedId(shared)); |
| 45 } | 44 } |
| 46 } | 45 } |
| 47 | 46 |
| 48 | 47 |
| 49 void CodeMoveEventRecord::UpdateCodeMap(CodeMap* code_map) { | 48 void CodeMoveEventRecord::UpdateCodeMap(CodeMap* code_map) { |
| 50 code_map->MoveCode(from, to); | 49 code_map->MoveCode(from, to); |
| 51 } | 50 } |
| 52 | 51 |
| 53 | 52 |
| 54 void SharedFunctionInfoMoveEventRecord::UpdateCodeMap(CodeMap* code_map) { | 53 void SharedFunctionInfoMoveEventRecord::UpdateCodeMap(CodeMap* code_map) { |
| 55 code_map->MoveCode(from, to); | 54 code_map->MoveCode(from, to); |
| 56 } | 55 } |
| 57 | 56 |
| 58 | 57 |
| 59 TickSample* ProfilerEventsProcessor::TickSampleEvent() { | 58 TickSample* ProfilerEventsProcessor::StartTickSampleEvent() { |
| 59 if (!ticks_buffer_is_empty_ || ticks_buffer_is_initialized_) return NULL; | |
| 60 ticks_buffer_is_initialized_ = true; | |
| 60 generator_->Tick(); | 61 generator_->Tick(); |
| 61 TickSampleEventRecord* evt = | 62 ticks_buffer_ = TickSampleEventRecord(enqueue_order_); |
| 62 new(ticks_buffer_.Enqueue()) TickSampleEventRecord(enqueue_order_); | 63 return &ticks_buffer_.sample; |
| 63 return &evt->sample; | |
| 64 } | 64 } |
| 65 | 65 |
| 66 | 66 |
| 67 void ProfilerEventsProcessor::FinishTickSampleEvent() { | |
| 68 ASSERT(ticks_buffer_is_initialized && ticks_buffer_is_empty_); | |
|
Jakob Kummerow
2012/10/02 10:56:51
typo: ticks_buffer_is_initialized_ is missing its
| |
| 69 ticks_buffer_is_empty_ = false; | |
| 70 } | |
| 71 | |
| 72 | |
| 67 bool ProfilerEventsProcessor::FilterOutCodeCreateEvent( | 73 bool ProfilerEventsProcessor::FilterOutCodeCreateEvent( |
| 68 Logger::LogEventsAndTags tag) { | 74 Logger::LogEventsAndTags tag) { |
| 69 return FLAG_prof_browser_mode | 75 return FLAG_prof_browser_mode |
| 70 && (tag != Logger::CALLBACK_TAG | 76 && (tag != Logger::CALLBACK_TAG |
| 71 && tag != Logger::FUNCTION_TAG | 77 && tag != Logger::FUNCTION_TAG |
| 72 && tag != Logger::LAZY_COMPILE_TAG | 78 && tag != Logger::LAZY_COMPILE_TAG |
| 73 && tag != Logger::REG_EXP_TAG | 79 && tag != Logger::REG_EXP_TAG |
| 74 && tag != Logger::SCRIPT_TAG); | 80 && tag != Logger::SCRIPT_TAG); |
| 75 } | 81 } |
| 76 | 82 |
| 77 } } // namespace v8::internal | 83 } } // namespace v8::internal |
| 78 | 84 |
| 79 #endif // V8_CPU_PROFILER_INL_H_ | 85 #endif // V8_CPU_PROFILER_INL_H_ |
| OLD | NEW |