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" |
34 #include "profile-generator-inl.h" | 35 #include "profile-generator-inl.h" |
35 #include "unbound-queue-inl.h" | 36 #include "unbound-queue-inl.h" |
36 | 37 |
37 namespace v8 { | 38 namespace v8 { |
38 namespace internal { | 39 namespace internal { |
39 | 40 |
40 void CodeCreateEventRecord::UpdateCodeMap(CodeMap* code_map) { | 41 void CodeCreateEventRecord::UpdateCodeMap(CodeMap* code_map) { |
41 code_map->AddCode(start, entry, size); | 42 code_map->AddCode(start, entry, size); |
42 if (shared != NULL) { | 43 if (shared != NULL) { |
43 entry->set_shared_id(code_map->GetSharedId(shared)); | 44 entry->set_shared_id(code_map->GetSharedId(shared)); |
44 } | 45 } |
45 } | 46 } |
46 | 47 |
47 | 48 |
48 void CodeMoveEventRecord::UpdateCodeMap(CodeMap* code_map) { | 49 void CodeMoveEventRecord::UpdateCodeMap(CodeMap* code_map) { |
49 code_map->MoveCode(from, to); | 50 code_map->MoveCode(from, to); |
50 } | 51 } |
51 | 52 |
52 | 53 |
53 void SharedFunctionInfoMoveEventRecord::UpdateCodeMap(CodeMap* code_map) { | 54 void SharedFunctionInfoMoveEventRecord::UpdateCodeMap(CodeMap* code_map) { |
54 code_map->MoveCode(from, to); | 55 code_map->MoveCode(from, to); |
55 } | 56 } |
56 | 57 |
57 | 58 |
58 TickSample* ProfilerEventsProcessor::StartTickSampleEvent() { | 59 TickSample* ProfilerEventsProcessor::TickSampleEvent() { |
59 if (!ticks_buffer_is_empty_ || ticks_buffer_is_initialized_) return NULL; | |
60 ticks_buffer_is_initialized_ = true; | |
61 generator_->Tick(); | 60 generator_->Tick(); |
62 ticks_buffer_ = TickSampleEventRecord(enqueue_order_); | 61 TickSampleEventRecord* evt = |
63 return &ticks_buffer_.sample; | 62 new(ticks_buffer_.Enqueue()) TickSampleEventRecord(enqueue_order_); |
| 63 return &evt->sample; |
64 } | 64 } |
65 | 65 |
66 | 66 |
67 void ProfilerEventsProcessor::FinishTickSampleEvent() { | |
68 ASSERT(ticks_buffer_is_initialized_ && ticks_buffer_is_empty_); | |
69 ticks_buffer_is_empty_ = false; | |
70 } | |
71 | |
72 | |
73 bool ProfilerEventsProcessor::FilterOutCodeCreateEvent( | 67 bool ProfilerEventsProcessor::FilterOutCodeCreateEvent( |
74 Logger::LogEventsAndTags tag) { | 68 Logger::LogEventsAndTags tag) { |
75 return FLAG_prof_browser_mode | 69 return FLAG_prof_browser_mode |
76 && (tag != Logger::CALLBACK_TAG | 70 && (tag != Logger::CALLBACK_TAG |
77 && tag != Logger::FUNCTION_TAG | 71 && tag != Logger::FUNCTION_TAG |
78 && tag != Logger::LAZY_COMPILE_TAG | 72 && tag != Logger::LAZY_COMPILE_TAG |
79 && tag != Logger::REG_EXP_TAG | 73 && tag != Logger::REG_EXP_TAG |
80 && tag != Logger::SCRIPT_TAG); | 74 && tag != Logger::SCRIPT_TAG); |
81 } | 75 } |
82 | 76 |
83 } } // namespace v8::internal | 77 } } // namespace v8::internal |
84 | 78 |
85 #endif // V8_CPU_PROFILER_INL_H_ | 79 #endif // V8_CPU_PROFILER_INL_H_ |
OLD | NEW |