Changeset 213883 in webkit for trunk/Source/JavaScriptCore/tools/CellProfile.h
- Timestamp:
- Mar 13, 2017, 5:39:24 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/tools/CellProfile.h
r213675 r213883 26 26 #pragma once 27 27 28 #include "JSCell.h" 29 #include "StackTrace.h" 30 #include "Structure.h" 31 #include <wtf/MonotonicTime.h> 32 28 33 namespace JSC { 29 34 30 class JSCell; 35 struct CellProfile { 36 enum Liveness { 37 Unknown, 38 Dead, 39 Live 40 }; 31 41 32 struct CellProfile { 33 CellProfile(JSCell* cell, bool isConfirmedDead = false) 34 : cell(cell) 35 , isConfirmedDead(isConfirmedDead) 42 CellProfile(HeapCell* cell, HeapCell::Kind kind, Liveness liveness) 43 : m_cell(cell) 44 , m_kind(kind) 45 , m_liveness(liveness) 46 , m_timestamp(MonotonicTime::now()) 36 47 { 48 if (m_kind == HeapCell::JSCell && m_liveness != Dead) 49 m_className = jsCell()->structure()->classInfo()->className; 37 50 } 51 52 CellProfile(CellProfile&& other) 53 : m_cell(other.m_cell) 54 , m_kind(other.m_kind) 55 , m_liveness(other.m_liveness) 56 , m_timestamp(other.m_timestamp) 57 , m_className(other.m_className) 58 , m_stackTrace(WTFMove(other.m_stackTrace)) 59 { } 60 61 HeapCell* cell() const { return m_cell; } 62 JSCell* jsCell() const 63 { 64 ASSERT(isJSCell()); 65 return static_cast<JSCell*>(m_cell); 66 } 67 68 bool isJSCell() const { return m_kind == HeapCell::JSCell; } 38 69 39 JSCell* cell; 40 bool isConfirmedDead; 70 HeapCell::Kind kind() const { return m_kind; } 71 72 bool isLive() const { return m_liveness == Live; } 73 bool isDead() const { return m_liveness == Dead; } 74 75 void setIsLive() { m_liveness = Live; } 76 void setIsDead() { m_liveness = Dead; } 77 78 MonotonicTime timestamp() const { return m_timestamp; } 79 80 const char* className() const { return m_className; } 81 82 StackTrace* stackTrace() const { return m_stackTrace.get(); } 83 void setStackTrace(StackTrace* trace) { m_stackTrace = std::unique_ptr<StackTrace>(trace); } 84 85 private: 86 HeapCell* m_cell; 87 HeapCell::Kind m_kind; 88 Liveness m_liveness { Unknown }; 89 MonotonicTime m_timestamp; 90 const char* m_className { nullptr }; 91 std::unique_ptr<StackTrace> m_stackTrace; 41 92 }; 42 93
Note:
See TracChangeset
for help on using the changeset viewer.