| 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 14 matching lines...) Expand all Loading... |
| 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 #ifdef ENABLE_LOGGING_AND_PROFILING | 33 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 34 | 34 |
| 35 #include <new> |
| 35 #include "circular-queue-inl.h" | 36 #include "circular-queue-inl.h" |
| 36 #include "profile-generator-inl.h" | 37 #include "profile-generator-inl.h" |
| 37 #include "unbound-queue-inl.h" | 38 #include "unbound-queue-inl.h" |
| 38 | 39 |
| 39 namespace v8 { | 40 namespace v8 { |
| 40 namespace internal { | 41 namespace internal { |
| 41 | 42 |
| 42 void CodeCreateEventRecord::UpdateCodeMap(CodeMap* code_map) { | 43 void CodeCreateEventRecord::UpdateCodeMap(CodeMap* code_map) { |
| 43 code_map->AddCode(start, entry, size); | 44 code_map->AddCode(start, entry, size); |
| 44 if (shared != NULL) { | 45 if (shared != NULL) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 55 void CodeDeleteEventRecord::UpdateCodeMap(CodeMap* code_map) { | 56 void CodeDeleteEventRecord::UpdateCodeMap(CodeMap* code_map) { |
| 56 code_map->DeleteCode(start); | 57 code_map->DeleteCode(start); |
| 57 } | 58 } |
| 58 | 59 |
| 59 | 60 |
| 60 void SharedFunctionInfoMoveEventRecord::UpdateCodeMap(CodeMap* code_map) { | 61 void SharedFunctionInfoMoveEventRecord::UpdateCodeMap(CodeMap* code_map) { |
| 61 code_map->MoveCode(from, to); | 62 code_map->MoveCode(from, to); |
| 62 } | 63 } |
| 63 | 64 |
| 64 | 65 |
| 65 TickSampleEventRecord* TickSampleEventRecord::init(void* value) { | |
| 66 TickSampleEventRecord* result = | |
| 67 reinterpret_cast<TickSampleEventRecord*>(value); | |
| 68 result->filler = 1; | |
| 69 ASSERT(result->filler != SamplingCircularQueue::kClear); | |
| 70 // Init the required fields only. | |
| 71 result->sample.pc = NULL; | |
| 72 result->sample.frames_count = 0; | |
| 73 result->sample.has_external_callback = false; | |
| 74 return result; | |
| 75 } | |
| 76 | |
| 77 | |
| 78 TickSample* ProfilerEventsProcessor::TickSampleEvent() { | 66 TickSample* ProfilerEventsProcessor::TickSampleEvent() { |
| 79 generator_->Tick(); | 67 generator_->Tick(); |
| 80 TickSampleEventRecord* evt = | 68 TickSampleEventRecord* evt = |
| 81 TickSampleEventRecord::init(ticks_buffer_.Enqueue()); | 69 new(ticks_buffer_.Enqueue()) TickSampleEventRecord(); |
| 82 evt->order = enqueue_order_; // No increment! | 70 evt->order = enqueue_order_; // No increment! |
| 83 return &evt->sample; | 71 return &evt->sample; |
| 84 } | 72 } |
| 85 | 73 |
| 86 | 74 |
| 87 bool ProfilerEventsProcessor::FilterOutCodeCreateEvent( | 75 bool ProfilerEventsProcessor::FilterOutCodeCreateEvent( |
| 88 Logger::LogEventsAndTags tag) { | 76 Logger::LogEventsAndTags tag) { |
| 89 return FLAG_prof_browser_mode | 77 return FLAG_prof_browser_mode |
| 90 && (tag != Logger::CALLBACK_TAG | 78 && (tag != Logger::CALLBACK_TAG |
| 91 && tag != Logger::FUNCTION_TAG | 79 && tag != Logger::FUNCTION_TAG |
| 92 && tag != Logger::LAZY_COMPILE_TAG | 80 && tag != Logger::LAZY_COMPILE_TAG |
| 93 && tag != Logger::REG_EXP_TAG | 81 && tag != Logger::REG_EXP_TAG |
| 94 && tag != Logger::SCRIPT_TAG); | 82 && tag != Logger::SCRIPT_TAG); |
| 95 } | 83 } |
| 96 | 84 |
| 97 } } // namespace v8::internal | 85 } } // namespace v8::internal |
| 98 | 86 |
| 99 #endif // ENABLE_LOGGING_AND_PROFILING | 87 #endif // ENABLE_LOGGING_AND_PROFILING |
| 100 | 88 |
| 101 #endif // V8_CPU_PROFILER_INL_H_ | 89 #endif // V8_CPU_PROFILER_INL_H_ |
| OLD | NEW |