| OLD | NEW |
| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 v8::ActivityControl* control); | 61 v8::ActivityControl* control); |
| 62 static HeapSnapshot* TakeSnapshot(String* name, | 62 static HeapSnapshot* TakeSnapshot(String* name, |
| 63 int type, | 63 int type, |
| 64 v8::ActivityControl* control); | 64 v8::ActivityControl* control); |
| 65 static int GetSnapshotsCount(); | 65 static int GetSnapshotsCount(); |
| 66 static HeapSnapshot* GetSnapshot(int index); | 66 static HeapSnapshot* GetSnapshot(int index); |
| 67 static HeapSnapshot* FindSnapshot(unsigned uid); | 67 static HeapSnapshot* FindSnapshot(unsigned uid); |
| 68 | 68 |
| 69 static void ObjectMoveEvent(Address from, Address to); | 69 static void ObjectMoveEvent(Address from, Address to); |
| 70 | 70 |
| 71 static void DefineWrapperClass( |
| 72 uint16_t class_id, v8::HeapProfiler::WrapperInfoCallback callback); |
| 73 static v8::RetainedObjectInfo* ExecuteWrapperClassCallback(uint16_t class_id, |
| 74 Object** wrapper); |
| 75 |
| 71 static INLINE(bool is_profiling()) { | 76 static INLINE(bool is_profiling()) { |
| 72 return singleton_ != NULL && singleton_->snapshots_->is_tracking_objects(); | 77 return singleton_ != NULL && singleton_->snapshots_->is_tracking_objects(); |
| 73 } | 78 } |
| 74 | 79 |
| 75 // Obsolete interface. | 80 // Obsolete interface. |
| 76 // Write a single heap sample to the log file. | 81 // Write a single heap sample to the log file. |
| 77 static void WriteSample(); | 82 static void WriteSample(); |
| 78 | 83 |
| 79 private: | 84 private: |
| 80 HeapProfiler(); | 85 HeapProfiler(); |
| 81 ~HeapProfiler(); | 86 ~HeapProfiler(); |
| 82 HeapSnapshot* TakeSnapshotImpl(const char* name, | 87 HeapSnapshot* TakeSnapshotImpl(const char* name, |
| 83 int type, | 88 int type, |
| 84 v8::ActivityControl* control); | 89 v8::ActivityControl* control); |
| 85 HeapSnapshot* TakeSnapshotImpl(String* name, | 90 HeapSnapshot* TakeSnapshotImpl(String* name, |
| 86 int type, | 91 int type, |
| 87 v8::ActivityControl* control); | 92 v8::ActivityControl* control); |
| 88 | 93 |
| 89 HeapSnapshotsCollection* snapshots_; | 94 HeapSnapshotsCollection* snapshots_; |
| 90 unsigned next_snapshot_uid_; | 95 unsigned next_snapshot_uid_; |
| 96 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_; |
| 91 | 97 |
| 92 static HeapProfiler* singleton_; | 98 static HeapProfiler* singleton_; |
| 93 #endif // ENABLE_LOGGING_AND_PROFILING | 99 #endif // ENABLE_LOGGING_AND_PROFILING |
| 94 }; | 100 }; |
| 95 | 101 |
| 96 | 102 |
| 97 #ifdef ENABLE_LOGGING_AND_PROFILING | 103 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 98 | 104 |
| 99 // JSObjectsCluster describes a group of JS objects that are | 105 // JSObjectsCluster describes a group of JS objects that are |
| 100 // considered equivalent in terms of a particular profile. | 106 // considered equivalent in terms of a particular profile. |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 private: | 378 private: |
| 373 static void DoRecordJSObjectAllocation(Object* obj); | 379 static void DoRecordJSObjectAllocation(Object* obj); |
| 374 static bool can_log_; | 380 static bool can_log_; |
| 375 }; | 381 }; |
| 376 | 382 |
| 377 #endif // ENABLE_LOGGING_AND_PROFILING | 383 #endif // ENABLE_LOGGING_AND_PROFILING |
| 378 | 384 |
| 379 } } // namespace v8::internal | 385 } } // namespace v8::internal |
| 380 | 386 |
| 381 #endif // V8_HEAP_PROFILER_H_ | 387 #endif // V8_HEAP_PROFILER_H_ |
| OLD | NEW |