Index: src/objects.h |
diff --git a/src/objects.h b/src/objects.h |
index 486303d48930a46ac61f6a0130b20cca11f979ba..ee0dff3d737d13a655b19680173b07832c7f6918 100644 |
--- a/src/objects.h |
+++ b/src/objects.h |
@@ -135,6 +135,37 @@ enum PropertyAttributes { |
namespace v8 { |
namespace internal { |
+enum ElementsKind { |
+ // The "fast" kind for tagged values. Must be first to make it possible |
+ // to efficiently check maps if they have fast elements. |
+ FAST_ELEMENTS, |
+ |
+ // The "fast" kind for unwrapped, non-tagged double values. |
+ FAST_DOUBLE_ELEMENTS, |
+ |
+ // The "slow" kind. |
+ DICTIONARY_ELEMENTS, |
+ NON_STRICT_ARGUMENTS_ELEMENTS, |
+ // The "fast" kind for external arrays |
+ EXTERNAL_BYTE_ELEMENTS, |
+ EXTERNAL_UNSIGNED_BYTE_ELEMENTS, |
+ EXTERNAL_SHORT_ELEMENTS, |
+ EXTERNAL_UNSIGNED_SHORT_ELEMENTS, |
+ EXTERNAL_INT_ELEMENTS, |
+ EXTERNAL_UNSIGNED_INT_ELEMENTS, |
+ EXTERNAL_FLOAT_ELEMENTS, |
+ EXTERNAL_DOUBLE_ELEMENTS, |
+ EXTERNAL_PIXEL_ELEMENTS, |
+ |
+ // Derived constants from ElementsKind |
+ FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND = EXTERNAL_BYTE_ELEMENTS, |
+ LAST_EXTERNAL_ARRAY_ELEMENTS_KIND = EXTERNAL_PIXEL_ELEMENTS, |
+ FIRST_ELEMENTS_KIND = FAST_ELEMENTS, |
+ LAST_ELEMENTS_KIND = EXTERNAL_PIXEL_ELEMENTS |
+}; |
+ |
+static const int kElementsKindCount = |
+ LAST_ELEMENTS_KIND - FIRST_ELEMENTS_KIND + 1; |
// PropertyDetails captures type and attributes for a property. |
// They are used both in property dictionaries and instance descriptors. |
@@ -1463,38 +1494,6 @@ class JSReceiver: public HeapObject { |
// caching. |
class JSObject: public JSReceiver { |
public: |
- enum ElementsKind { |
- // The "fast" kind for tagged values. Must be first to make it possible |
- // to efficiently check maps if they have fast elements. |
- FAST_ELEMENTS, |
- |
- // The "fast" kind for unwrapped, non-tagged double values. |
- FAST_DOUBLE_ELEMENTS, |
- |
- // The "slow" kind. |
- DICTIONARY_ELEMENTS, |
- NON_STRICT_ARGUMENTS_ELEMENTS, |
- // The "fast" kind for external arrays |
- EXTERNAL_BYTE_ELEMENTS, |
- EXTERNAL_UNSIGNED_BYTE_ELEMENTS, |
- EXTERNAL_SHORT_ELEMENTS, |
- EXTERNAL_UNSIGNED_SHORT_ELEMENTS, |
- EXTERNAL_INT_ELEMENTS, |
- EXTERNAL_UNSIGNED_INT_ELEMENTS, |
- EXTERNAL_FLOAT_ELEMENTS, |
- EXTERNAL_DOUBLE_ELEMENTS, |
- EXTERNAL_PIXEL_ELEMENTS, |
- |
- // Derived constants from ElementsKind |
- FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND = EXTERNAL_BYTE_ELEMENTS, |
- LAST_EXTERNAL_ARRAY_ELEMENTS_KIND = EXTERNAL_PIXEL_ELEMENTS, |
- FIRST_ELEMENTS_KIND = FAST_ELEMENTS, |
- LAST_ELEMENTS_KIND = EXTERNAL_PIXEL_ELEMENTS |
- }; |
- |
- static const int kElementsKindCount = |
- LAST_ELEMENTS_KIND - FIRST_ELEMENTS_KIND + 1; |
- |
// [properties]: Backing storage for properties. |
// properties is a FixedArray in the fast case and a Dictionary in the |
// slow case. |
@@ -4020,37 +4019,37 @@ class Map: public HeapObject { |
inline void set_is_extensible(bool value); |
inline bool is_extensible(); |
- inline void set_elements_kind(JSObject::ElementsKind elements_kind) { |
- ASSERT(elements_kind < JSObject::kElementsKindCount); |
- ASSERT(JSObject::kElementsKindCount <= (1 << kElementsKindBitCount)); |
+ inline void set_elements_kind(ElementsKind elements_kind) { |
+ ASSERT(elements_kind < kElementsKindCount); |
+ ASSERT(kElementsKindCount <= (1 << kElementsKindBitCount)); |
set_bit_field2((bit_field2() & ~kElementsKindMask) | |
(elements_kind << kElementsKindShift)); |
ASSERT(this->elements_kind() == elements_kind); |
} |
- inline JSObject::ElementsKind elements_kind() { |
- return static_cast<JSObject::ElementsKind>( |
+ inline ElementsKind elements_kind() { |
+ return static_cast<ElementsKind>( |
(bit_field2() & kElementsKindMask) >> kElementsKindShift); |
} |
// Tells whether the instance has fast elements. |
// Equivalent to instance->GetElementsKind() == FAST_ELEMENTS. |
inline bool has_fast_elements() { |
- return elements_kind() == JSObject::FAST_ELEMENTS; |
+ return elements_kind() == FAST_ELEMENTS; |
} |
inline bool has_fast_double_elements() { |
- return elements_kind() == JSObject::FAST_DOUBLE_ELEMENTS; |
+ return elements_kind() == FAST_DOUBLE_ELEMENTS; |
} |
inline bool has_external_array_elements() { |
- JSObject::ElementsKind kind(elements_kind()); |
- return kind >= JSObject::FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND && |
- kind <= JSObject::LAST_EXTERNAL_ARRAY_ELEMENTS_KIND; |
+ ElementsKind kind(elements_kind()); |
+ return kind >= FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND && |
+ kind <= LAST_EXTERNAL_ARRAY_ELEMENTS_KIND; |
} |
inline bool has_dictionary_elements() { |
- return elements_kind() == JSObject::DICTIONARY_ELEMENTS; |
+ return elements_kind() == DICTIONARY_ELEMENTS; |
} |
// Tells whether the map is attached to SharedFunctionInfo |
@@ -4322,7 +4321,7 @@ class Map: public HeapObject { |
static const int kElementsKindMask = (-1 << kElementsKindShift) & |
((1 << (kElementsKindShift + kElementsKindBitCount)) - 1); |
static const int8_t kMaximumBitField2FastElementValue = static_cast<int8_t>( |
- (JSObject::FAST_ELEMENTS + 1) << Map::kElementsKindShift) - 1; |
+ (FAST_ELEMENTS + 1) << Map::kElementsKindShift) - 1; |
// Bit positions for bit field 3 |
static const int kIsShared = 0; |