summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime/JSCell.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-10-15 16:08:57 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-10-15 16:08:57 +0200
commit5466563f4b5b6b86523e3f89bb7f77e5b5270c78 (patch)
tree8caccf7cd03a15207cde3ba282c88bf132482a91 /Source/JavaScriptCore/runtime/JSCell.h
parent33b26980cb24288b5a9f2590ccf32a949281bb79 (diff)
downloadqtwebkit-5466563f4b5b6b86523e3f89bb7f77e5b5270c78.tar.gz
Imported WebKit commit 0dc6cd75e1d4836eaffbb520be96fac4847cc9d2 (http://svn.webkit.org/repository/webkit/trunk@131300)
WebKit update which introduces the QtWebKitWidgets module that contains the WK1 widgets based API. (In fact it renames QtWebKit to QtWebKitWidgets while we're working on completing the entire split as part of https://bugs.webkit.org/show_bug.cgi?id=99314
Diffstat (limited to 'Source/JavaScriptCore/runtime/JSCell.h')
-rw-r--r--Source/JavaScriptCore/runtime/JSCell.h59
1 files changed, 18 insertions, 41 deletions
diff --git a/Source/JavaScriptCore/runtime/JSCell.h b/Source/JavaScriptCore/runtime/JSCell.h
index cf6f4ec45..a39af1283 100644
--- a/Source/JavaScriptCore/runtime/JSCell.h
+++ b/Source/JavaScriptCore/runtime/JSCell.h
@@ -31,12 +31,15 @@
#include "JSValueInlineMethods.h"
#include "SlotVisitor.h"
#include "SlotVisitorInlineMethods.h"
+#include "TypedArrayDescriptor.h"
#include "WriteBarrier.h"
#include <wtf/Noncopyable.h>
#include <wtf/TypeTraits.h>
namespace JSC {
+ class CopyVisitor;
+ class JSDestructibleObject;
class JSGlobalObject;
class LLIntOffsetsExtractor;
class PropertyDescriptor;
@@ -48,19 +51,6 @@ namespace JSC {
IncludeDontEnumProperties
};
- enum TypedArrayType {
- TypedArrayNone,
- TypedArrayInt8,
- TypedArrayInt16,
- TypedArrayInt32,
- TypedArrayUint8,
- TypedArrayUint8Clamped,
- TypedArrayUint16,
- TypedArrayUint32,
- TypedArrayFloat32,
- TypedArrayFloat64
- };
-
class JSCell {
friend class JSValue;
friend class MarkedBlock;
@@ -70,6 +60,9 @@ namespace JSC {
public:
static const unsigned StructureFlags = 0;
+ static const bool needsDestruction = false;
+ static const bool hasImmortalStructure = false;
+
enum CreatingEarlyCellTag { CreatingEarlyCell };
JSCell(CreatingEarlyCellTag);
@@ -108,6 +101,7 @@ namespace JSC {
JS_EXPORT_PRIVATE JSObject* toObject(ExecState*, JSGlobalObject*) const;
static void visitChildren(JSCell*, SlotVisitor&);
+ JS_EXPORT_PRIVATE static void copyBackingStore(JSCell*, CopyVisitor&);
// Object operations, with the toObject operation included.
const ClassInfo* classInfo() const;
@@ -309,46 +303,29 @@ namespace JSC {
return isCell() ? asCell()->toObject(exec, globalObject) : toObjectSlowCase(exec, globalObject);
}
- template<class T>
- struct NeedsDestructor {
- static const bool value = !WTF::HasTrivialDestructor<T>::value;
- };
-
template<typename T>
- void* allocateCell(Heap& heap)
+ void* allocateCell(Heap& heap, size_t size)
{
+ ASSERT(size >= sizeof(T));
#if ENABLE(GC_VALIDATION)
ASSERT(!heap.globalData()->isInitializingObject());
heap.globalData()->setInitializingObjectClass(&T::s_info);
#endif
JSCell* result = 0;
- if (NeedsDestructor<T>::value)
- result = static_cast<JSCell*>(heap.allocateWithDestructor(sizeof(T)));
- else {
- ASSERT(T::s_info.methodTable.destroy == JSCell::destroy);
- result = static_cast<JSCell*>(heap.allocateWithoutDestructor(sizeof(T)));
- }
+ if (T::needsDestruction && T::hasImmortalStructure)
+ result = static_cast<JSCell*>(heap.allocateWithImmortalStructureDestructor(size));
+ else if (T::needsDestruction && !T::hasImmortalStructure)
+ result = static_cast<JSCell*>(heap.allocateWithNormalDestructor(size));
+ else
+ result = static_cast<JSCell*>(heap.allocateWithoutDestructor(size));
result->clearStructure();
return result;
}
template<typename T>
- void* allocateCell(Heap& heap, size_t size)
+ void* allocateCell(Heap& heap)
{
- ASSERT(size >= sizeof(T));
-#if ENABLE(GC_VALIDATION)
- ASSERT(!heap.globalData()->isInitializingObject());
- heap.globalData()->setInitializingObjectClass(&T::s_info);
-#endif
- JSCell* result = 0;
- if (NeedsDestructor<T>::value)
- result = static_cast<JSCell*>(heap.allocateWithDestructor(size));
- else {
- ASSERT(T::s_info.methodTable.destroy == JSCell::destroy);
- result = static_cast<JSCell*>(heap.allocateWithoutDestructor(size));
- }
- result->clearStructure();
- return result;
+ return allocateCell<T>(heap, sizeof(T));
}
inline bool isZapped(const JSCell* cell)
@@ -362,7 +339,7 @@ namespace JSC {
ASSERT(!from || from->JSCell::inherits(&WTF::RemovePointer<To>::Type::s_info));
return static_cast<To>(from);
}
-
+
template<typename To>
inline To jsCast(JSValue from)
{