Changeset 190113 in webkit for trunk/Source/JavaScriptCore/heap/WeakImpl.h
- Timestamp:
- Sep 22, 2015, 5:21:31 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/heap/WeakImpl.h
r189616 r190113 1 1 /* 2 * Copyright (C) 2012 -2015Apple Inc. All rights reserved.2 * Copyright (C) 2012 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 47 47 48 48 WeakImpl(); 49 WeakImpl(JS Cell&, WeakHandleOwner*, void* context);49 WeakImpl(JSValue, WeakHandleOwner*, void* context); 50 50 51 State state() const;51 State state(); 52 52 void setState(State); 53 53 54 JSCell* cell();54 const JSValue& jsValue(); 55 55 WeakHandleOwner* weakHandleOwner(); 56 56 void* context(); 57 57 58 static WeakImpl* asWeakImpl(JS Cell**);58 static WeakImpl* asWeakImpl(JSValue*); 59 59 60 60 private: 61 friend class WeakBlock; 62 63 JSCell* m_cell { nullptr }; 64 WeakHandleOwner* m_weakHandleOwner { nullptr }; 65 void* m_context { nullptr }; 61 const JSValue m_jsValue; 62 WeakHandleOwner* m_weakHandleOwner; 63 void* m_context; 66 64 }; 67 65 68 66 inline WeakImpl::WeakImpl() 67 : m_weakHandleOwner(0) 68 , m_context(0) 69 69 { 70 70 setState(Deallocated); 71 71 } 72 72 73 inline WeakImpl::WeakImpl(JS Cell& cell, WeakHandleOwner* weakHandleOwner, void* context)74 : m_ cell(&cell)73 inline WeakImpl::WeakImpl(JSValue jsValue, WeakHandleOwner* weakHandleOwner, void* context) 74 : m_jsValue(jsValue) 75 75 , m_weakHandleOwner(weakHandleOwner) 76 76 , m_context(context) 77 77 { 78 78 ASSERT(state() == Live); 79 ASSERT(m_jsValue && m_jsValue.isCell()); 79 80 } 80 81 81 inline WeakImpl::State WeakImpl::state() const82 inline WeakImpl::State WeakImpl::state() 82 83 { 83 84 return static_cast<State>(reinterpret_cast<uintptr_t>(m_weakHandleOwner) & StateMask); … … 90 91 } 91 92 92 inline JSCell* WeakImpl::cell()93 inline const JSValue& WeakImpl::jsValue() 93 94 { 94 return m_ cell;95 return m_jsValue; 95 96 } 96 97 … … 105 106 } 106 107 107 inline WeakImpl* WeakImpl::asWeakImpl(JS Cell** slot)108 inline WeakImpl* WeakImpl::asWeakImpl(JSValue* slot) 108 109 { 109 return reinterpret_cast_ptr<WeakImpl*>(reinterpret_cast_ptr<char*>(slot) );110 return reinterpret_cast_ptr<WeakImpl*>(reinterpret_cast_ptr<char*>(slot) + OBJECT_OFFSETOF(WeakImpl, m_jsValue)); 110 111 } 111 112
Note:
See TracChangeset
for help on using the changeset viewer.