#ifndef IndexingType_h
#define IndexingType_h
#include "SpeculatedType.h"
#include <wtf/StdLibExtras.h>
namespace JSC {
typedef uint8_t IndexingType;
static const IndexingType IsArray = 0x01;
static const IndexingType IndexingShapeMask = 0x1E;
static const IndexingType NoIndexingShape = 0x00;
static const IndexingType UndecidedShape = 0x02; static const IndexingType Int32Shape = 0x14;
static const IndexingType DoubleShape = 0x16;
static const IndexingType ContiguousShape = 0x1A;
static const IndexingType ArrayStorageShape = 0x1C;
static const IndexingType SlowPutArrayStorageShape = 0x1E;
static const IndexingType IndexingShapeShift = 1;
static const IndexingType NumberOfIndexingShapes = 16;
static const IndexingType MayHaveIndexedAccessors = 0x20;
static const IndexingType NonArray = 0x0;
static const IndexingType NonArrayWithInt32 = Int32Shape;
static const IndexingType NonArrayWithDouble = DoubleShape;
static const IndexingType NonArrayWithContiguous = ContiguousShape;
static const IndexingType NonArrayWithArrayStorage = ArrayStorageShape;
static const IndexingType NonArrayWithSlowPutArrayStorage = SlowPutArrayStorageShape;
static const IndexingType ArrayClass = IsArray; static const IndexingType ArrayWithUndecided = IsArray | UndecidedShape;
static const IndexingType ArrayWithInt32 = IsArray | Int32Shape;
static const IndexingType ArrayWithDouble = IsArray | DoubleShape;
static const IndexingType ArrayWithContiguous = IsArray | ContiguousShape;
static const IndexingType ArrayWithArrayStorage = IsArray | ArrayStorageShape;
static const IndexingType ArrayWithSlowPutArrayStorage = IsArray | SlowPutArrayStorageShape;
#define ALL_BLANK_INDEXING_TYPES \
NonArray: \
case ArrayClass
#define ALL_UNDECIDED_INDEXING_TYPES \
ArrayWithUndecided
#define ALL_INT32_INDEXING_TYPES \
NonArrayWithInt32: \
case ArrayWithInt32
#define ALL_DOUBLE_INDEXING_TYPES \
NonArrayWithDouble: \
case ArrayWithDouble
#define ALL_CONTIGUOUS_INDEXING_TYPES \
NonArrayWithContiguous: \
case ArrayWithContiguous
#define ARRAY_WITH_ARRAY_STORAGE_INDEXING_TYPES \
ArrayWithArrayStorage: \
case ArrayWithSlowPutArrayStorage
#define ALL_ARRAY_STORAGE_INDEXING_TYPES \
NonArrayWithArrayStorage: \
case NonArrayWithSlowPutArrayStorage: \
case ARRAY_WITH_ARRAY_STORAGE_INDEXING_TYPES
static inline bool hasIndexedProperties(IndexingType indexingType)
{
return (indexingType & IndexingShapeMask) != NoIndexingShape;
}
static inline bool hasUndecided(IndexingType indexingType)
{
return (indexingType & IndexingShapeMask) == UndecidedShape;
}
static inline bool hasInt32(IndexingType indexingType)
{
return (indexingType & IndexingShapeMask) == Int32Shape;
}
static inline bool hasDouble(IndexingType indexingType)
{
return (indexingType & IndexingShapeMask) == DoubleShape;
}
static inline bool hasContiguous(IndexingType indexingType)
{
return (indexingType & IndexingShapeMask) == ContiguousShape;
}
static inline bool hasArrayStorage(IndexingType indexingType)
{
return (indexingType & IndexingShapeMask) == ArrayStorageShape;
}
static inline bool hasAnyArrayStorage(IndexingType indexingType)
{
return static_cast<uint8_t>((indexingType & IndexingShapeMask) - ArrayStorageShape) <= static_cast<uint8_t>(SlowPutArrayStorageShape - ArrayStorageShape);
}
static inline bool shouldUseSlowPut(IndexingType indexingType)
{
return (indexingType & IndexingShapeMask) == SlowPutArrayStorageShape;
}
IndexingType leastUpperBoundOfIndexingTypes(IndexingType, IndexingType);
IndexingType leastUpperBoundOfIndexingTypeAndType(IndexingType, SpeculatedType);
IndexingType leastUpperBoundOfIndexingTypeAndValue(IndexingType, JSValue);
void dumpIndexingType(PrintStream&, IndexingType);
MAKE_PRINT_ADAPTOR(IndexingTypeDump, IndexingType, dumpIndexingType);
static const IndexingType AllArrayTypes = 31;
static const IndexingType AllArrayTypesAndHistory = 127;
}
#endif // IndexingType_h