Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Side by Side Diff: src/heap/heap-inl.h

Issue 1104353003: Add flag to print stack-trace after n allocations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: trace stack for allocations Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/flag-definitions.h ('k') | src/isolate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #ifndef V8_HEAP_HEAP_INL_H_ 5 #ifndef V8_HEAP_HEAP_INL_H_
6 #define V8_HEAP_HEAP_INL_H_ 6 #define V8_HEAP_HEAP_INL_H_
7 7
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 return allocation; 206 return allocation;
207 } 207 }
208 208
209 209
210 void Heap::OnAllocationEvent(HeapObject* object, int size_in_bytes) { 210 void Heap::OnAllocationEvent(HeapObject* object, int size_in_bytes) {
211 HeapProfiler* profiler = isolate_->heap_profiler(); 211 HeapProfiler* profiler = isolate_->heap_profiler();
212 if (profiler->is_tracking_allocations()) { 212 if (profiler->is_tracking_allocations()) {
213 profiler->AllocationEvent(object->address(), size_in_bytes); 213 profiler->AllocationEvent(object->address(), size_in_bytes);
214 } 214 }
215 215
216 ++allocations_count_;
217
216 if (FLAG_verify_predictable) { 218 if (FLAG_verify_predictable) {
217 ++allocations_count_;
218
219 UpdateAllocationsHash(object); 219 UpdateAllocationsHash(object);
220 UpdateAllocationsHash(size_in_bytes); 220 UpdateAllocationsHash(size_in_bytes);
221 221
222 if ((FLAG_dump_allocations_digest_at_alloc > 0) && 222 if ((FLAG_dump_allocations_digest_at_alloc > 0) &&
223 (--dump_allocations_hash_countdown_ == 0)) { 223 (--dump_allocations_hash_countdown_ == 0)) {
224 dump_allocations_hash_countdown_ = FLAG_dump_allocations_digest_at_alloc; 224 dump_allocations_hash_countdown_ = FLAG_dump_allocations_digest_at_alloc;
225 PrintAlloctionsHash(); 225 PrintAlloctionsHash();
226 } 226 }
227 } 227 }
228
229 if (FLAG_trace_allocation_stack_interval > 0) {
230 if (allocations_count_ % FLAG_trace_allocation_stack_interval == 0) {
231 isolate()->PrintStack(stdout, Isolate::kPrintStackConcise);
232 }
233 }
228 } 234 }
229 235
230 236
231 void Heap::OnMoveEvent(HeapObject* target, HeapObject* source, 237 void Heap::OnMoveEvent(HeapObject* target, HeapObject* source,
232 int size_in_bytes) { 238 int size_in_bytes) {
233 HeapProfiler* heap_profiler = isolate_->heap_profiler(); 239 HeapProfiler* heap_profiler = isolate_->heap_profiler();
234 if (heap_profiler->is_tracking_object_moves()) { 240 if (heap_profiler->is_tracking_object_moves()) {
235 heap_profiler->ObjectMoveEvent(source->address(), target->address(), 241 heap_profiler->ObjectMoveEvent(source->address(), target->address(),
236 size_in_bytes); 242 size_in_bytes);
237 } 243 }
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 687
682 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { 688 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) {
683 for (Object** current = start; current < end; current++) { 689 for (Object** current = start; current < end; current++) {
684 CHECK((*current)->IsSmi()); 690 CHECK((*current)->IsSmi());
685 } 691 }
686 } 692 }
687 } 693 }
688 } // namespace v8::internal 694 } // namespace v8::internal
689 695
690 #endif // V8_HEAP_HEAP_INL_H_ 696 #endif // V8_HEAP_HEAP_INL_H_
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698