| Index: src/objects.h
|
| diff --git a/src/objects.h b/src/objects.h
|
| index 22993f25689011328c0fb2ced90bad4ba57d1689..2373e54707d74456a35ee48c173054ae6b07e9bc 100644
|
| --- a/src/objects.h
|
| +++ b/src/objects.h
|
| @@ -30,6 +30,7 @@
|
|
|
| #include "allocation.h"
|
| #include "builtins.h"
|
| +#include "elements-kind.h"
|
| #include "list.h"
|
| #include "property-details.h"
|
| #include "smart-array-pointer.h"
|
| @@ -131,40 +132,6 @@
|
| namespace v8 {
|
| namespace internal {
|
|
|
| -enum ElementsKind {
|
| - // The "fast" kind for elements that only contain SMI values. Must be first
|
| - // to make it possible to efficiently check maps for this kind.
|
| - FAST_SMI_ONLY_ELEMENTS,
|
| -
|
| - // The "fast" kind for tagged values. Must be second to make it possible to
|
| - // efficiently check maps for this and the FAST_SMI_ONLY_ELEMENTS kind
|
| - // together at once.
|
| - 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_SMI_ONLY_ELEMENTS,
|
| - LAST_ELEMENTS_KIND = EXTERNAL_PIXEL_ELEMENTS
|
| -};
|
| -
|
| enum CompareMapMode {
|
| REQUIRE_EXACT_MAP,
|
| ALLOW_ELEMENT_TRANSITION_MAPS
|
| @@ -175,13 +142,6 @@ enum KeyedAccessGrowMode {
|
| ALLOW_JSARRAY_GROWTH
|
| };
|
|
|
| -const int kElementsKindCount = LAST_ELEMENTS_KIND - FIRST_ELEMENTS_KIND + 1;
|
| -
|
| -void PrintElementsKind(FILE* out, ElementsKind kind);
|
| -
|
| -inline bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind,
|
| - ElementsKind to_kind);
|
| -
|
| // Setter that skips the write barrier if mode is SKIP_WRITE_BARRIER.
|
| enum WriteBarrierMode { SKIP_WRITE_BARRIER, UPDATE_WRITE_BARRIER };
|
|
|
| @@ -1510,13 +1470,19 @@ class JSObject: public JSReceiver {
|
| MUST_USE_RESULT inline MaybeObject* ResetElements();
|
| inline ElementsKind GetElementsKind();
|
| inline ElementsAccessor* GetElementsAccessor();
|
| - inline bool HasFastSmiOnlyElements();
|
| - inline bool HasFastElements();
|
| - // Returns if an object has either FAST_ELEMENT or FAST_SMI_ONLY_ELEMENT
|
| - // elements. TODO(danno): Rename HasFastTypeElements to HasFastElements() and
|
| - // HasFastElements to HasFastObjectElements.
|
| - inline bool HasFastTypeElements();
|
| + // Returns true if an object has elements of FAST_SMI_ELEMENTS ElementsKind.
|
| + inline bool HasFastSmiElements();
|
| + // Returns true if an object has elements of FAST_ELEMENTS ElementsKind.
|
| + inline bool HasFastObjectElements();
|
| + // Returns true if an object has elements of FAST_ELEMENTS or
|
| + // FAST_SMI_ONLY_ELEMENTS.
|
| + inline bool HasFastSmiOrObjectElements();
|
| + // Returns true if an object has elements of FAST_DOUBLE_ELEMENTS
|
| + // ElementsKind.
|
| inline bool HasFastDoubleElements();
|
| + // Returns true if an object has elements of FAST_HOLEY_*_ELEMENTS
|
| + // ElementsKind.
|
| + inline bool HasFastHoleyElements();
|
| inline bool HasNonStrictArgumentsElements();
|
| inline bool HasDictionaryElements();
|
| inline bool HasExternalPixelElements();
|
| @@ -1719,7 +1685,7 @@ class JSObject: public JSReceiver {
|
| static Handle<Object> DeleteElement(Handle<JSObject> obj, uint32_t index);
|
| MUST_USE_RESULT MaybeObject* DeleteElement(uint32_t index, DeleteMode mode);
|
|
|
| - inline void ValidateSmiOnlyElements();
|
| + inline void ValidateElements();
|
|
|
| // Makes sure that this object can contain HeapObject as elements.
|
| MUST_USE_RESULT inline MaybeObject* EnsureCanContainHeapObjectElements();
|
| @@ -1731,6 +1697,7 @@ class JSObject: public JSReceiver {
|
| EnsureElementsMode mode);
|
| MUST_USE_RESULT inline MaybeObject* EnsureCanContainElements(
|
| FixedArrayBase* elements,
|
| + uint32_t length,
|
| EnsureElementsMode mode);
|
| MUST_USE_RESULT MaybeObject* EnsureCanContainElements(
|
| Arguments* arguments,
|
| @@ -1829,10 +1796,10 @@ class JSObject: public JSReceiver {
|
| MUST_USE_RESULT MaybeObject* GetElementWithInterceptor(Object* receiver,
|
| uint32_t index);
|
|
|
| - enum SetFastElementsCapacityMode {
|
| - kAllowSmiOnlyElements,
|
| - kForceSmiOnlyElements,
|
| - kDontAllowSmiOnlyElements
|
| + enum SetFastElementsCapacitySmiMode {
|
| + kAllowSmiElements,
|
| + kForceSmiElements,
|
| + kDontAllowSmiElements
|
| };
|
|
|
| // Replace the elements' backing store with fast elements of the given
|
| @@ -1841,7 +1808,7 @@ class JSObject: public JSReceiver {
|
| MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength(
|
| int capacity,
|
| int length,
|
| - SetFastElementsCapacityMode set_capacity_mode);
|
| + SetFastElementsCapacitySmiMode smi_mode);
|
| MUST_USE_RESULT MaybeObject* SetFastDoubleElementsCapacityAndLength(
|
| int capacity,
|
| int length);
|
| @@ -4647,17 +4614,21 @@ class Map: public HeapObject {
|
| }
|
|
|
| // Tells whether the instance has fast elements that are only Smis.
|
| - inline bool has_fast_smi_only_elements() {
|
| - return elements_kind() == FAST_SMI_ONLY_ELEMENTS;
|
| + inline bool has_fast_smi_elements() {
|
| + return IsFastSmiElementsKind(elements_kind());
|
| }
|
|
|
| // Tells whether the instance has fast elements.
|
| - inline bool has_fast_elements() {
|
| - return elements_kind() == FAST_ELEMENTS;
|
| + inline bool has_fast_object_elements() {
|
| + return IsFastObjectElementsKind(elements_kind());
|
| + }
|
| +
|
| + inline bool has_fast_smi_or_object_elements() {
|
| + return IsFastSmiOrObjectElementsKind(elements_kind());
|
| }
|
|
|
| inline bool has_fast_double_elements() {
|
| - return elements_kind() == FAST_DOUBLE_ELEMENTS;
|
| + return IsFastDoubleElementsKind(elements_kind());
|
| }
|
|
|
| inline bool has_non_strict_arguments_elements() {
|
| @@ -4945,25 +4916,31 @@ class Map: public HeapObject {
|
|
|
| // Bit positions for bit field 2
|
| static const int kIsExtensible = 0;
|
| - static const int kFunctionWithPrototype = 1;
|
| - static const int kStringWrapperSafeForDefaultValueOf = 2;
|
| - static const int kAttachedToSharedFunctionInfo = 3;
|
| + static const int kStringWrapperSafeForDefaultValueOf = 1;
|
| + static const int kAttachedToSharedFunctionInfo = 2;
|
| // No bits can be used after kElementsKindFirstBit, they are all reserved for
|
| // storing ElementKind.
|
| - static const int kElementsKindShift = 4;
|
| - static const int kElementsKindBitCount = 4;
|
| + static const int kElementsKindShift = 3;
|
| + static const int kElementsKindBitCount = 5;
|
|
|
| // Derived values from bit field 2
|
| static const int kElementsKindMask = (-1 << kElementsKindShift) &
|
| ((1 << (kElementsKindShift + kElementsKindBitCount)) - 1);
|
| static const int8_t kMaximumBitField2FastElementValue = static_cast<int8_t>(
|
| (FAST_ELEMENTS + 1) << Map::kElementsKindShift) - 1;
|
| - static const int8_t kMaximumBitField2FastSmiOnlyElementValue =
|
| - static_cast<int8_t>((FAST_SMI_ONLY_ELEMENTS + 1) <<
|
| + static const int8_t kMaximumBitField2FastSmiElementValue =
|
| + static_cast<int8_t>((FAST_SMI_ELEMENTS + 1) <<
|
| + Map::kElementsKindShift) - 1;
|
| + static const int8_t kMaximumBitField2FastHoleyElementValue =
|
| + static_cast<int8_t>((FAST_HOLEY_ELEMENTS + 1) <<
|
| + Map::kElementsKindShift) - 1;
|
| + static const int8_t kMaximumBitField2FastHoleySmiElementValue =
|
| + static_cast<int8_t>((FAST_HOLEY_SMI_ELEMENTS + 1) <<
|
| Map::kElementsKindShift) - 1;
|
|
|
| // Bit positions for bit field 3
|
| static const int kIsShared = 0;
|
| + static const int kFunctionWithPrototype = 1;
|
|
|
| // Layout of the default cache. It holds alternating name and code objects.
|
| static const int kCodeCacheEntrySize = 2;
|
|
|