summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime/StructureTransitionTable.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/JavaScriptCore/runtime/StructureTransitionTable.h')
-rw-r--r--Source/JavaScriptCore/runtime/StructureTransitionTable.h30
1 files changed, 29 insertions, 1 deletions
diff --git a/Source/JavaScriptCore/runtime/StructureTransitionTable.h b/Source/JavaScriptCore/runtime/StructureTransitionTable.h
index 7c9d50894..59e7e94f3 100644
--- a/Source/JavaScriptCore/runtime/StructureTransitionTable.h
+++ b/Source/JavaScriptCore/runtime/StructureTransitionTable.h
@@ -26,6 +26,7 @@
#ifndef StructureTransitionTable_h
#define StructureTransitionTable_h
+#include "IndexingType.h"
#include "WeakGCMap.h"
#include <wtf/HashFunctions.h>
#include <wtf/OwnPtr.h>
@@ -37,6 +38,30 @@ namespace JSC {
class JSCell;
class Structure;
+static const unsigned FirstInternalAttribute = 1 << 6; // Use for transitions that don't have to do with property additions.
+
+// Support for attributes used to indicate transitions not related to properties.
+// If any of these are used, the string portion of the key should be 0.
+enum NonPropertyTransition {
+ AllocateArrayStorage
+};
+
+inline unsigned toAttributes(NonPropertyTransition transition)
+{
+ return transition + FirstInternalAttribute;
+}
+
+inline IndexingType newIndexingType(IndexingType oldType, NonPropertyTransition transition)
+{
+ switch (transition) {
+ case AllocateArrayStorage:
+ return oldType | HasArrayStorage;
+ default:
+ ASSERT_NOT_REACHED();
+ return oldType;
+ }
+}
+
class StructureTransitionTable {
static const intptr_t UsingSingleSlotFlag = 1;
@@ -44,7 +69,10 @@ class StructureTransitionTable {
typedef std::pair<RefPtr<StringImpl>, unsigned> Key;
static unsigned hash(const Key& p)
{
- return p.first->existingHash();
+ unsigned result = p.second;
+ if (p.first)
+ result += p.first->existingHash();
+ return result;
}
static bool equal(const Key& a, const Key& b)