| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/profiler/sampling-heap-profiler.h" | 5 #include "src/profiler/sampling-heap-profiler.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/base/ieee754.h" | 10 #include "src/base/ieee754.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 heap->isolate()->random_number_generator())), | 58 heap->isolate()->random_number_generator())), |
| 59 other_spaces_observer_(new SamplingAllocationObserver( | 59 other_spaces_observer_(new SamplingAllocationObserver( |
| 60 heap_, static_cast<intptr_t>(rate), rate, this, | 60 heap_, static_cast<intptr_t>(rate), rate, this, |
| 61 heap->isolate()->random_number_generator())), | 61 heap->isolate()->random_number_generator())), |
| 62 names_(names), | 62 names_(names), |
| 63 profile_root_(nullptr, "(root)", v8::UnboundScript::kNoScriptId, 0), | 63 profile_root_(nullptr, "(root)", v8::UnboundScript::kNoScriptId, 0), |
| 64 samples_(), | 64 samples_(), |
| 65 stack_depth_(stack_depth), | 65 stack_depth_(stack_depth), |
| 66 rate_(rate), | 66 rate_(rate), |
| 67 flags_(flags) { | 67 flags_(flags) { |
| 68 CHECK_GT(rate_, 0); | 68 CHECK_GT(rate_, 0u); |
| 69 heap->new_space()->AddAllocationObserver(new_space_observer_.get()); | 69 heap->new_space()->AddAllocationObserver(new_space_observer_.get()); |
| 70 AllSpaces spaces(heap); | 70 AllSpaces spaces(heap); |
| 71 for (Space* space = spaces.next(); space != nullptr; space = spaces.next()) { | 71 for (Space* space = spaces.next(); space != nullptr; space = spaces.next()) { |
| 72 if (space != heap->new_space()) { | 72 if (space != heap->new_space()) { |
| 73 space->AddAllocationObserver(other_spaces_observer_.get()); | 73 space->AddAllocationObserver(other_spaces_observer_.get()); |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 | 77 |
| 78 | 78 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 } | 272 } |
| 273 } | 273 } |
| 274 auto profile = new v8::internal::AllocationProfile(); | 274 auto profile = new v8::internal::AllocationProfile(); |
| 275 TranslateAllocationNode(profile, &profile_root_, scripts); | 275 TranslateAllocationNode(profile, &profile_root_, scripts); |
| 276 return profile; | 276 return profile; |
| 277 } | 277 } |
| 278 | 278 |
| 279 | 279 |
| 280 } // namespace internal | 280 } // namespace internal |
| 281 } // namespace v8 | 281 } // namespace v8 |
| OLD | NEW |