]>
Commit | Line | Data |
---|---|---|
93a37866 A |
1 | #ifndef JSDestructibleObject_h |
2 | #define JSDestructibleObject_h | |
3 | ||
4 | #include "JSObject.h" | |
5 | ||
6 | namespace JSC { | |
7 | ||
8 | struct ClassInfo; | |
9 | ||
10 | class JSDestructibleObject : public JSNonFinalObject { | |
11 | public: | |
12 | typedef JSNonFinalObject Base; | |
13 | ||
14 | static const bool needsDestruction = true; | |
15 | ||
16 | const ClassInfo* classInfo() const { return m_classInfo; } | |
17 | ||
18 | static ptrdiff_t classInfoOffset() { return OBJECT_OFFSETOF(JSDestructibleObject, m_classInfo); } | |
19 | ||
20 | protected: | |
21 | JSDestructibleObject(VM& vm, Structure* structure, Butterfly* butterfly = 0) | |
22 | : JSNonFinalObject(vm, structure, butterfly) | |
23 | , m_classInfo(structure->classInfo()) | |
24 | { | |
25 | ASSERT(m_classInfo); | |
26 | } | |
27 | ||
28 | private: | |
29 | const ClassInfo* m_classInfo; | |
30 | }; | |
31 | ||
32 | inline const ClassInfo* JSCell::classInfo() const | |
33 | { | |
34 | if (MarkedBlock::blockFor(this)->destructorType() == MarkedBlock::Normal) | |
35 | return static_cast<const JSDestructibleObject*>(this)->classInfo(); | |
36 | #if ENABLE(GC_VALIDATION) | |
37 | return m_structure.unvalidatedGet()->classInfo(); | |
38 | #else | |
39 | return m_structure->classInfo(); | |
40 | #endif | |
41 | } | |
42 | ||
43 | } // namespace JSC | |
44 | ||
45 | #endif |