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

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

Issue 23039014: Hook-allocation on bleeding edge (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « src/heap.cc ('k') | src/heap-profiler.cc » ('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 2009-2010 the V8 project authors. All rights reserved. 1 // Copyright 2009-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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 const char* name, 56 const char* name,
57 v8::ActivityControl* control, 57 v8::ActivityControl* control,
58 v8::HeapProfiler::ObjectNameResolver* resolver); 58 v8::HeapProfiler::ObjectNameResolver* resolver);
59 HeapSnapshot* TakeSnapshot( 59 HeapSnapshot* TakeSnapshot(
60 String* name, 60 String* name,
61 v8::ActivityControl* control, 61 v8::ActivityControl* control,
62 v8::HeapProfiler::ObjectNameResolver* resolver); 62 v8::HeapProfiler::ObjectNameResolver* resolver);
63 63
64 void StartHeapObjectsTracking(); 64 void StartHeapObjectsTracking();
65 void StopHeapObjectsTracking(); 65 void StopHeapObjectsTracking();
66
67 INLINE(void RecordObjectAllocation(Address obj, size_t size)) {
68 if (is_tracking_allocations_) {
69 NewObjectEvent(obj, size);
70 }
71 }
72
73 static void RecordObjectAllocationFromMasm(Isolate* isolate,
74 Address obj,
75 int size) {
76 // Set the lsb to 0 if needed.
77 obj = reinterpret_cast<Address>(
78 reinterpret_cast<uintptr_t>(obj) & ~kHeapObjectTag);
79 isolate->heap_profiler()->NewObjectEvent(obj, size);
80 }
81
66 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream); 82 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream);
67 int GetSnapshotsCount(); 83 int GetSnapshotsCount();
68 HeapSnapshot* GetSnapshot(int index); 84 HeapSnapshot* GetSnapshot(int index);
69 SnapshotObjectId GetSnapshotObjectId(Handle<Object> obj); 85 SnapshotObjectId GetSnapshotObjectId(Handle<Object> obj);
70 void DeleteAllSnapshots(); 86 void DeleteAllSnapshots();
71 87
72 void ObjectMoveEvent(Address from, Address to); 88 void ObjectMoveEvent(Address from, Address to, int size);
89
90 void NewObjectEvent(Address addr, int size);
73 91
74 void DefineWrapperClass( 92 void DefineWrapperClass(
75 uint16_t class_id, v8::HeapProfiler::WrapperInfoCallback callback); 93 uint16_t class_id, v8::HeapProfiler::WrapperInfoCallback callback);
76 94
77 v8::RetainedObjectInfo* ExecuteWrapperClassCallback(uint16_t class_id, 95 v8::RetainedObjectInfo* ExecuteWrapperClassCallback(uint16_t class_id,
78 Object** wrapper); 96 Object** wrapper);
79 INLINE(bool is_profiling()) { 97 INLINE(bool is_profiling()) {
80 return snapshots_->is_tracking_objects(); 98 return snapshots_->is_tracking_objects();
81 } 99 }
82 100
83 void SetRetainedObjectInfo(UniqueId id, RetainedObjectInfo* info); 101 void SetRetainedObjectInfo(UniqueId id, RetainedObjectInfo* info);
84 102
103 int* is_tracking_allocations_address();
104
105 int CheckAllocationsTracking();
106
85 private: 107 private:
86 Heap* heap() const { return snapshots_->heap(); } 108 Heap* heap() const { return snapshots_->heap(); }
87 109
88 HeapSnapshotsCollection* snapshots_; 110 HeapSnapshotsCollection* snapshots_;
89 unsigned next_snapshot_uid_; 111 unsigned next_snapshot_uid_;
90 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_; 112 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_;
113 int is_tracking_allocations_;
91 }; 114 };
92 115
93 } } // namespace v8::internal 116 } } // namespace v8::internal
94 117
95 #endif // V8_HEAP_PROFILER_H_ 118 #endif // V8_HEAP_PROFILER_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698