summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime/Butterfly.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-10-17 16:21:14 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-10-17 16:21:14 +0200
commit8995b83bcbfbb68245f779b64e5517627c6cc6ea (patch)
tree17985605dab9263cc2444bd4d45f189e142cca7c /Source/JavaScriptCore/runtime/Butterfly.h
parentb9c9652036d5e9f1e29c574f40bc73a35c81ace6 (diff)
downloadqtwebkit-8995b83bcbfbb68245f779b64e5517627c6cc6ea.tar.gz
Imported WebKit commit cf4f8fc6f19b0629f51860cb2d4b25e139d07e00 (http://svn.webkit.org/repository/webkit/trunk@131592)
New snapshot that includes the build fixes for Mac OS X 10.6 and earlier as well as the previously cherry-picked changes
Diffstat (limited to 'Source/JavaScriptCore/runtime/Butterfly.h')
-rw-r--r--Source/JavaScriptCore/runtime/Butterfly.h25
1 files changed, 23 insertions, 2 deletions
diff --git a/Source/JavaScriptCore/runtime/Butterfly.h b/Source/JavaScriptCore/runtime/Butterfly.h
index 1926169ba..cb93aea8a 100644
--- a/Source/JavaScriptCore/runtime/Butterfly.h
+++ b/Source/JavaScriptCore/runtime/Butterfly.h
@@ -35,7 +35,7 @@
namespace JSC {
class JSGlobalData;
-class SlotVisitor;
+class CopyVisitor;
struct ArrayStorage;
class Butterfly {
@@ -56,6 +56,15 @@ public:
return reinterpret_cast<Butterfly*>(static_cast<EncodedJSValue*>(base) + preCapacity + propertyCapacity + 1);
}
+ // This method is here not just because it's handy, but to remind you that
+ // the whole point of butterflies is to do evil pointer arithmetic.
+ static Butterfly* fromPointer(char* ptr)
+ {
+ return reinterpret_cast<Butterfly*>(ptr);
+ }
+
+ char* pointer() { return reinterpret_cast<char*>(this); }
+
static ptrdiff_t offsetOfIndexingHeader() { return IndexingHeader::offsetOfIndexingHeader(); }
static ptrdiff_t offsetOfPublicLength() { return offsetOfIndexingHeader() + IndexingHeader::offsetOfPublicLength(); }
static ptrdiff_t offsetOfVectorLength() { return offsetOfIndexingHeader() + IndexingHeader::offsetOfVectorLength(); }
@@ -64,15 +73,27 @@ public:
static Butterfly* create(JSGlobalData&, size_t preCapacity, size_t propertyCapacity, bool hasIndexingHeader, const IndexingHeader&, size_t indexingPayloadSizeInBytes);
static Butterfly* create(JSGlobalData&, Structure*);
- static Butterfly* createUninitializedDuringCollection(SlotVisitor&, size_t preCapacity, size_t propertyCapacity, bool hasIndexingHeader, size_t indexingPayloadSizeInBytes);
+ static Butterfly* createUninitializedDuringCollection(CopyVisitor&, size_t preCapacity, size_t propertyCapacity, bool hasIndexingHeader, size_t indexingPayloadSizeInBytes);
IndexingHeader* indexingHeader() { return IndexingHeader::from(this); }
const IndexingHeader* indexingHeader() const { return IndexingHeader::from(this); }
PropertyStorage propertyStorage() { return indexingHeader()->propertyStorage(); }
ConstPropertyStorage propertyStorage() const { return indexingHeader()->propertyStorage(); }
+
+ uint32_t publicLength() { return indexingHeader()->publicLength(); }
+ uint32_t vectorLength() { return indexingHeader()->vectorLength(); }
+ void setPublicLength(uint32_t value) { indexingHeader()->setPublicLength(value); }
+ void setVectorLength(uint32_t value) { indexingHeader()->setVectorLength(value); }
+
template<typename T>
T* indexingPayload() { return reinterpret_cast<T*>(this); }
ArrayStorage* arrayStorage() { return indexingPayload<ArrayStorage>(); }
+ WriteBarrier<Unknown>* contiguous() { return indexingPayload<WriteBarrier<Unknown> >(); }
+
+ static Butterfly* fromContiguous(WriteBarrier<Unknown>* contiguous)
+ {
+ return reinterpret_cast<Butterfly*>(contiguous);
+ }
static ptrdiff_t offsetOfPropertyStorage() { return -static_cast<ptrdiff_t>(sizeof(IndexingHeader)); }
static int indexOfPropertyStorage()