Commit 626b9525 authored by Peter Marshall's avatar Peter Marshall Committed by Commit Bot

[cleanup] Remove name from ElementsAccessor

This is only used by ElementsKindToString(!).

Implement ElementsKindToString with a big 'ol switch. The compiler
will give us an error if we forget an ElementsKind.

Bug: v8:9183
Change-Id: I1ed73ecac33aa7318a97f31794473d9afa16961c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1624802
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: 's avatarSimon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61773}
parent 130f9192
...@@ -66,8 +66,47 @@ int GetDefaultHeaderSizeForElementsKind(ElementsKind elements_kind) { ...@@ -66,8 +66,47 @@ int GetDefaultHeaderSizeForElementsKind(ElementsKind elements_kind) {
} }
const char* ElementsKindToString(ElementsKind kind) { const char* ElementsKindToString(ElementsKind kind) {
ElementsAccessor* accessor = ElementsAccessor::ForKind(kind); switch (kind) {
return accessor->name(); case PACKED_SMI_ELEMENTS:
return "PACKED_SMI_ELEMENTS";
case HOLEY_SMI_ELEMENTS:
return "HOLEY_SMI_ELEMENTS";
case PACKED_ELEMENTS:
return "PACKED_ELEMENTS";
case HOLEY_ELEMENTS:
return "HOLEY_ELEMENTS";
case PACKED_DOUBLE_ELEMENTS:
return "PACKED_DOUBLE_ELEMENTS";
case HOLEY_DOUBLE_ELEMENTS:
return "HOLEY_DOUBLE_ELEMENTS";
case PACKED_SEALED_ELEMENTS:
return "PACKED_SEALED_ELEMENTS";
case HOLEY_SEALED_ELEMENTS:
return "HOLEY_SEALED_ELEMENTS";
case PACKED_FROZEN_ELEMENTS:
return "PACKED_FROZEN_ELEMENTS";
case HOLEY_FROZEN_ELEMENTS:
return "HOLEY_FROZEN_ELEMENTS";
case DICTIONARY_ELEMENTS:
return "DICTIONARY_ELEMENTS";
case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
return "FAST_SLOPPY_ARGUMENTS_ELEMENTS";
case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
return "SLOW_SLOPPY_ARGUMENTS_ELEMENTS";
case FAST_STRING_WRAPPER_ELEMENTS:
return "FAST_STRING_WRAPPER_ELEMENTS";
case SLOW_STRING_WRAPPER_ELEMENTS:
return "SLOW_STRING_WRAPPER_ELEMENTS";
#define PRINT_NAME(Type, type, TYPE, _) \
case TYPE##_ELEMENTS: \
return #TYPE "ELEMENTS";
TYPED_ARRAYS(PRINT_NAME);
#undef PRINT_NAME
case NO_ELEMENTS:
return "NO_ELEMENTS";
}
} }
ElementsKind kFastElementsKindSequence[kFastElementsKindCount] = { ElementsKind kFastElementsKindSequence[kFastElementsKindCount] = {
......
...@@ -540,9 +540,6 @@ static Maybe<int64_t> IndexOfValueSlowPath(Isolate* isolate, ...@@ -540,9 +540,6 @@ static Maybe<int64_t> IndexOfValueSlowPath(Isolate* isolate,
// that take an entry (instead of an index) as an argument. // that take an entry (instead of an index) as an argument.
class InternalElementsAccessor : public ElementsAccessor { class InternalElementsAccessor : public ElementsAccessor {
public: public:
explicit InternalElementsAccessor(const char* name)
: ElementsAccessor(name) {}
uint32_t GetEntryForIndex(Isolate* isolate, JSObject holder, uint32_t GetEntryForIndex(Isolate* isolate, JSObject holder,
FixedArrayBase backing_store, FixedArrayBase backing_store,
uint32_t index) override = 0; uint32_t index) override = 0;
...@@ -570,8 +567,7 @@ class InternalElementsAccessor : public ElementsAccessor { ...@@ -570,8 +567,7 @@ class InternalElementsAccessor : public ElementsAccessor {
template <typename Subclass, typename ElementsTraitsParam> template <typename Subclass, typename ElementsTraitsParam>
class ElementsAccessorBase : public InternalElementsAccessor { class ElementsAccessorBase : public InternalElementsAccessor {
public: public:
explicit ElementsAccessorBase(const char* name) ElementsAccessorBase() = default;
: InternalElementsAccessor(name) {}
typedef ElementsTraitsParam ElementsTraits; typedef ElementsTraitsParam ElementsTraits;
typedef typename ElementsTraitsParam::BackingStore BackingStore; typedef typename ElementsTraitsParam::BackingStore BackingStore;
...@@ -1396,10 +1392,6 @@ class DictionaryElementsAccessor ...@@ -1396,10 +1392,6 @@ class DictionaryElementsAccessor
: public ElementsAccessorBase<DictionaryElementsAccessor, : public ElementsAccessorBase<DictionaryElementsAccessor,
ElementsKindTraits<DICTIONARY_ELEMENTS>> { ElementsKindTraits<DICTIONARY_ELEMENTS>> {
public: public:
explicit DictionaryElementsAccessor(const char* name)
: ElementsAccessorBase<DictionaryElementsAccessor,
ElementsKindTraits<DICTIONARY_ELEMENTS>>(name) {}
static uint32_t GetMaxIndex(JSObject receiver, FixedArrayBase elements) { static uint32_t GetMaxIndex(JSObject receiver, FixedArrayBase elements) {
// We cannot properly estimate this for dictionaries. // We cannot properly estimate this for dictionaries.
UNREACHABLE(); UNREACHABLE();
...@@ -1895,9 +1887,6 @@ class DictionaryElementsAccessor ...@@ -1895,9 +1887,6 @@ class DictionaryElementsAccessor
template <typename Subclass, typename KindTraits> template <typename Subclass, typename KindTraits>
class FastElementsAccessor : public ElementsAccessorBase<Subclass, KindTraits> { class FastElementsAccessor : public ElementsAccessorBase<Subclass, KindTraits> {
public: public:
explicit FastElementsAccessor(const char* name)
: ElementsAccessorBase<Subclass, KindTraits>(name) {}
typedef typename KindTraits::BackingStore BackingStore; typedef typename KindTraits::BackingStore BackingStore;
static Handle<NumberDictionary> NormalizeImpl(Handle<JSObject> object, static Handle<NumberDictionary> NormalizeImpl(Handle<JSObject> object,
...@@ -2462,9 +2451,6 @@ template <typename Subclass, typename KindTraits> ...@@ -2462,9 +2451,6 @@ template <typename Subclass, typename KindTraits>
class FastSmiOrObjectElementsAccessor class FastSmiOrObjectElementsAccessor
: public FastElementsAccessor<Subclass, KindTraits> { : public FastElementsAccessor<Subclass, KindTraits> {
public: public:
explicit FastSmiOrObjectElementsAccessor(const char* name)
: FastElementsAccessor<Subclass, KindTraits>(name) {}
static inline void SetImpl(Handle<JSObject> holder, uint32_t entry, static inline void SetImpl(Handle<JSObject> holder, uint32_t entry,
Object value) { Object value) {
SetImpl(holder->elements(), entry, value); SetImpl(holder->elements(), entry, value);
...@@ -2602,43 +2588,22 @@ class FastSmiOrObjectElementsAccessor ...@@ -2602,43 +2588,22 @@ class FastSmiOrObjectElementsAccessor
class FastPackedSmiElementsAccessor class FastPackedSmiElementsAccessor
: public FastSmiOrObjectElementsAccessor< : public FastSmiOrObjectElementsAccessor<
FastPackedSmiElementsAccessor, FastPackedSmiElementsAccessor,
ElementsKindTraits<PACKED_SMI_ELEMENTS>> { ElementsKindTraits<PACKED_SMI_ELEMENTS>> {};
public:
explicit FastPackedSmiElementsAccessor(const char* name)
: FastSmiOrObjectElementsAccessor<
FastPackedSmiElementsAccessor,
ElementsKindTraits<PACKED_SMI_ELEMENTS>>(name) {}
};
class FastHoleySmiElementsAccessor class FastHoleySmiElementsAccessor
: public FastSmiOrObjectElementsAccessor< : public FastSmiOrObjectElementsAccessor<
FastHoleySmiElementsAccessor, FastHoleySmiElementsAccessor,
ElementsKindTraits<HOLEY_SMI_ELEMENTS>> { ElementsKindTraits<HOLEY_SMI_ELEMENTS>> {};
public:
explicit FastHoleySmiElementsAccessor(const char* name)
: FastSmiOrObjectElementsAccessor<FastHoleySmiElementsAccessor,
ElementsKindTraits<HOLEY_SMI_ELEMENTS>>(
name) {}
};
class FastPackedObjectElementsAccessor class FastPackedObjectElementsAccessor
: public FastSmiOrObjectElementsAccessor< : public FastSmiOrObjectElementsAccessor<
FastPackedObjectElementsAccessor, FastPackedObjectElementsAccessor,
ElementsKindTraits<PACKED_ELEMENTS>> { ElementsKindTraits<PACKED_ELEMENTS>> {};
public:
explicit FastPackedObjectElementsAccessor(const char* name)
: FastSmiOrObjectElementsAccessor<FastPackedObjectElementsAccessor,
ElementsKindTraits<PACKED_ELEMENTS>>(
name) {}
};
template <typename Subclass, typename KindTraits> template <typename Subclass, typename KindTraits>
class FastSealedObjectElementsAccessor class FastSealedObjectElementsAccessor
: public FastSmiOrObjectElementsAccessor<Subclass, KindTraits> { : public FastSmiOrObjectElementsAccessor<Subclass, KindTraits> {
public: public:
explicit FastSealedObjectElementsAccessor(const char* name)
: FastSmiOrObjectElementsAccessor<Subclass, KindTraits>(name) {}
typedef typename KindTraits::BackingStore BackingStore; typedef typename KindTraits::BackingStore BackingStore;
static Handle<Object> RemoveElement(Handle<JSArray> receiver, static Handle<Object> RemoveElement(Handle<JSArray> receiver,
...@@ -2721,31 +2686,18 @@ class FastPackedSealedObjectElementsAccessor ...@@ -2721,31 +2686,18 @@ class FastPackedSealedObjectElementsAccessor
: public FastSealedObjectElementsAccessor< : public FastSealedObjectElementsAccessor<
FastPackedSealedObjectElementsAccessor, FastPackedSealedObjectElementsAccessor,
ElementsKindTraits<PACKED_SEALED_ELEMENTS>> { ElementsKindTraits<PACKED_SEALED_ELEMENTS>> {
public:
explicit FastPackedSealedObjectElementsAccessor(const char* name)
: FastSealedObjectElementsAccessor<
FastPackedSealedObjectElementsAccessor,
ElementsKindTraits<PACKED_SEALED_ELEMENTS>>(name) {}
}; };
class FastHoleySealedObjectElementsAccessor class FastHoleySealedObjectElementsAccessor
: public FastSealedObjectElementsAccessor< : public FastSealedObjectElementsAccessor<
FastHoleySealedObjectElementsAccessor, FastHoleySealedObjectElementsAccessor,
ElementsKindTraits<HOLEY_SEALED_ELEMENTS>> { ElementsKindTraits<HOLEY_SEALED_ELEMENTS>> {
public:
explicit FastHoleySealedObjectElementsAccessor(const char* name)
: FastSealedObjectElementsAccessor<
FastHoleySealedObjectElementsAccessor,
ElementsKindTraits<HOLEY_SEALED_ELEMENTS>>(name) {}
}; };
template <typename Subclass, typename KindTraits> template <typename Subclass, typename KindTraits>
class FastFrozenObjectElementsAccessor class FastFrozenObjectElementsAccessor
: public FastSmiOrObjectElementsAccessor<Subclass, KindTraits> { : public FastSmiOrObjectElementsAccessor<Subclass, KindTraits> {
public: public:
explicit FastFrozenObjectElementsAccessor(const char* name)
: FastSmiOrObjectElementsAccessor<Subclass, KindTraits>(name) {}
typedef typename KindTraits::BackingStore BackingStore; typedef typename KindTraits::BackingStore BackingStore;
static inline void SetImpl(Handle<JSObject> holder, uint32_t entry, static inline void SetImpl(Handle<JSObject> holder, uint32_t entry,
...@@ -2806,41 +2758,23 @@ class FastPackedFrozenObjectElementsAccessor ...@@ -2806,41 +2758,23 @@ class FastPackedFrozenObjectElementsAccessor
: public FastFrozenObjectElementsAccessor< : public FastFrozenObjectElementsAccessor<
FastPackedFrozenObjectElementsAccessor, FastPackedFrozenObjectElementsAccessor,
ElementsKindTraits<PACKED_FROZEN_ELEMENTS>> { ElementsKindTraits<PACKED_FROZEN_ELEMENTS>> {
public:
explicit FastPackedFrozenObjectElementsAccessor(const char* name)
: FastFrozenObjectElementsAccessor<
FastPackedFrozenObjectElementsAccessor,
ElementsKindTraits<PACKED_FROZEN_ELEMENTS>>(name) {}
}; };
class FastHoleyFrozenObjectElementsAccessor class FastHoleyFrozenObjectElementsAccessor
: public FastFrozenObjectElementsAccessor< : public FastFrozenObjectElementsAccessor<
FastHoleyFrozenObjectElementsAccessor, FastHoleyFrozenObjectElementsAccessor,
ElementsKindTraits<HOLEY_FROZEN_ELEMENTS>> { ElementsKindTraits<HOLEY_FROZEN_ELEMENTS>> {
public:
explicit FastHoleyFrozenObjectElementsAccessor(const char* name)
: FastFrozenObjectElementsAccessor<
FastHoleyFrozenObjectElementsAccessor,
ElementsKindTraits<HOLEY_FROZEN_ELEMENTS>>(name) {}
}; };
class FastHoleyObjectElementsAccessor class FastHoleyObjectElementsAccessor
: public FastSmiOrObjectElementsAccessor< : public FastSmiOrObjectElementsAccessor<
FastHoleyObjectElementsAccessor, ElementsKindTraits<HOLEY_ELEMENTS>> { FastHoleyObjectElementsAccessor, ElementsKindTraits<HOLEY_ELEMENTS>> {
public:
explicit FastHoleyObjectElementsAccessor(const char* name)
: FastSmiOrObjectElementsAccessor<FastHoleyObjectElementsAccessor,
ElementsKindTraits<HOLEY_ELEMENTS>>(
name) {}
}; };
template <typename Subclass, typename KindTraits> template <typename Subclass, typename KindTraits>
class FastDoubleElementsAccessor class FastDoubleElementsAccessor
: public FastElementsAccessor<Subclass, KindTraits> { : public FastElementsAccessor<Subclass, KindTraits> {
public: public:
explicit FastDoubleElementsAccessor(const char* name)
: FastElementsAccessor<Subclass, KindTraits>(name) {}
static Handle<Object> GetImpl(Isolate* isolate, FixedArrayBase backing_store, static Handle<Object> GetImpl(Isolate* isolate, FixedArrayBase backing_store,
uint32_t entry) { uint32_t entry) {
return FixedDoubleArray::get(FixedDoubleArray::cast(backing_store), entry, return FixedDoubleArray::get(FixedDoubleArray::cast(backing_store), entry,
...@@ -2962,24 +2896,12 @@ class FastDoubleElementsAccessor ...@@ -2962,24 +2896,12 @@ class FastDoubleElementsAccessor
class FastPackedDoubleElementsAccessor class FastPackedDoubleElementsAccessor
: public FastDoubleElementsAccessor< : public FastDoubleElementsAccessor<
FastPackedDoubleElementsAccessor, FastPackedDoubleElementsAccessor,
ElementsKindTraits<PACKED_DOUBLE_ELEMENTS>> { ElementsKindTraits<PACKED_DOUBLE_ELEMENTS>> {};
public:
explicit FastPackedDoubleElementsAccessor(const char* name)
: FastDoubleElementsAccessor<FastPackedDoubleElementsAccessor,
ElementsKindTraits<PACKED_DOUBLE_ELEMENTS>>(
name) {}
};
class FastHoleyDoubleElementsAccessor class FastHoleyDoubleElementsAccessor
: public FastDoubleElementsAccessor< : public FastDoubleElementsAccessor<
FastHoleyDoubleElementsAccessor, FastHoleyDoubleElementsAccessor,
ElementsKindTraits<HOLEY_DOUBLE_ELEMENTS>> { ElementsKindTraits<HOLEY_DOUBLE_ELEMENTS>> {};
public:
explicit FastHoleyDoubleElementsAccessor(const char* name)
: FastDoubleElementsAccessor<FastHoleyDoubleElementsAccessor,
ElementsKindTraits<HOLEY_DOUBLE_ELEMENTS>>(
name) {}
};
// Super class for all external element arrays. // Super class for all external element arrays.
template <ElementsKind Kind, typename ctype> template <ElementsKind Kind, typename ctype>
...@@ -2987,9 +2909,6 @@ class TypedElementsAccessor ...@@ -2987,9 +2909,6 @@ class TypedElementsAccessor
: public ElementsAccessorBase<TypedElementsAccessor<Kind, ctype>, : public ElementsAccessorBase<TypedElementsAccessor<Kind, ctype>,
ElementsKindTraits<Kind>> { ElementsKindTraits<Kind>> {
public: public:
explicit TypedElementsAccessor(const char* name)
: ElementsAccessorBase<AccessorClass, ElementsKindTraits<Kind>>(name) {}
typedef typename ElementsKindTraits<Kind>::BackingStore BackingStore; typedef typename ElementsKindTraits<Kind>::BackingStore BackingStore;
typedef TypedElementsAccessor<Kind, ctype> AccessorClass; typedef TypedElementsAccessor<Kind, ctype> AccessorClass;
...@@ -3677,11 +3596,6 @@ template <typename Subclass, typename ArgumentsAccessor, typename KindTraits> ...@@ -3677,11 +3596,6 @@ template <typename Subclass, typename ArgumentsAccessor, typename KindTraits>
class SloppyArgumentsElementsAccessor class SloppyArgumentsElementsAccessor
: public ElementsAccessorBase<Subclass, KindTraits> { : public ElementsAccessorBase<Subclass, KindTraits> {
public: public:
explicit SloppyArgumentsElementsAccessor(const char* name)
: ElementsAccessorBase<Subclass, KindTraits>(name) {
USE(KindTraits::Kind);
}
static void ConvertArgumentsStoreResult( static void ConvertArgumentsStoreResult(
Handle<SloppyArgumentsElements> elements, Handle<Object> result) { Handle<SloppyArgumentsElements> elements, Handle<Object> result) {
UNREACHABLE(); UNREACHABLE();
...@@ -4023,11 +3937,6 @@ class SlowSloppyArgumentsElementsAccessor ...@@ -4023,11 +3937,6 @@ class SlowSloppyArgumentsElementsAccessor
SlowSloppyArgumentsElementsAccessor, DictionaryElementsAccessor, SlowSloppyArgumentsElementsAccessor, DictionaryElementsAccessor,
ElementsKindTraits<SLOW_SLOPPY_ARGUMENTS_ELEMENTS>> { ElementsKindTraits<SLOW_SLOPPY_ARGUMENTS_ELEMENTS>> {
public: public:
explicit SlowSloppyArgumentsElementsAccessor(const char* name)
: SloppyArgumentsElementsAccessor<
SlowSloppyArgumentsElementsAccessor, DictionaryElementsAccessor,
ElementsKindTraits<SLOW_SLOPPY_ARGUMENTS_ELEMENTS>>(name) {}
static Handle<Object> ConvertArgumentsStoreResult( static Handle<Object> ConvertArgumentsStoreResult(
Isolate* isolate, Handle<SloppyArgumentsElements> elements, Isolate* isolate, Handle<SloppyArgumentsElements> elements,
Handle<Object> result) { Handle<Object> result) {
...@@ -4122,12 +4031,6 @@ class FastSloppyArgumentsElementsAccessor ...@@ -4122,12 +4031,6 @@ class FastSloppyArgumentsElementsAccessor
FastSloppyArgumentsElementsAccessor, FastHoleyObjectElementsAccessor, FastSloppyArgumentsElementsAccessor, FastHoleyObjectElementsAccessor,
ElementsKindTraits<FAST_SLOPPY_ARGUMENTS_ELEMENTS>> { ElementsKindTraits<FAST_SLOPPY_ARGUMENTS_ELEMENTS>> {
public: public:
explicit FastSloppyArgumentsElementsAccessor(const char* name)
: SloppyArgumentsElementsAccessor<
FastSloppyArgumentsElementsAccessor,
FastHoleyObjectElementsAccessor,
ElementsKindTraits<FAST_SLOPPY_ARGUMENTS_ELEMENTS>>(name) {}
static Handle<Object> ConvertArgumentsStoreResult( static Handle<Object> ConvertArgumentsStoreResult(
Isolate* isolate, Handle<SloppyArgumentsElements> paramtere_map, Isolate* isolate, Handle<SloppyArgumentsElements> paramtere_map,
Handle<Object> result) { Handle<Object> result) {
...@@ -4246,11 +4149,6 @@ template <typename Subclass, typename BackingStoreAccessor, typename KindTraits> ...@@ -4246,11 +4149,6 @@ template <typename Subclass, typename BackingStoreAccessor, typename KindTraits>
class StringWrapperElementsAccessor class StringWrapperElementsAccessor
: public ElementsAccessorBase<Subclass, KindTraits> { : public ElementsAccessorBase<Subclass, KindTraits> {
public: public:
explicit StringWrapperElementsAccessor(const char* name)
: ElementsAccessorBase<Subclass, KindTraits>(name) {
USE(KindTraits::Kind);
}
static Handle<Object> GetInternalImpl(Handle<JSObject> holder, static Handle<Object> GetInternalImpl(Handle<JSObject> holder,
uint32_t entry) { uint32_t entry) {
return GetImpl(holder, entry); return GetImpl(holder, entry);
...@@ -4425,11 +4323,6 @@ class FastStringWrapperElementsAccessor ...@@ -4425,11 +4323,6 @@ class FastStringWrapperElementsAccessor
FastStringWrapperElementsAccessor, FastHoleyObjectElementsAccessor, FastStringWrapperElementsAccessor, FastHoleyObjectElementsAccessor,
ElementsKindTraits<FAST_STRING_WRAPPER_ELEMENTS>> { ElementsKindTraits<FAST_STRING_WRAPPER_ELEMENTS>> {
public: public:
explicit FastStringWrapperElementsAccessor(const char* name)
: StringWrapperElementsAccessor<
FastStringWrapperElementsAccessor, FastHoleyObjectElementsAccessor,
ElementsKindTraits<FAST_STRING_WRAPPER_ELEMENTS>>(name) {}
static Handle<NumberDictionary> NormalizeImpl( static Handle<NumberDictionary> NormalizeImpl(
Handle<JSObject> object, Handle<FixedArrayBase> elements) { Handle<JSObject> object, Handle<FixedArrayBase> elements) {
return FastHoleyObjectElementsAccessor::NormalizeImpl(object, elements); return FastHoleyObjectElementsAccessor::NormalizeImpl(object, elements);
...@@ -4441,11 +4334,6 @@ class SlowStringWrapperElementsAccessor ...@@ -4441,11 +4334,6 @@ class SlowStringWrapperElementsAccessor
SlowStringWrapperElementsAccessor, DictionaryElementsAccessor, SlowStringWrapperElementsAccessor, DictionaryElementsAccessor,
ElementsKindTraits<SLOW_STRING_WRAPPER_ELEMENTS>> { ElementsKindTraits<SLOW_STRING_WRAPPER_ELEMENTS>> {
public: public:
explicit SlowStringWrapperElementsAccessor(const char* name)
: StringWrapperElementsAccessor<
SlowStringWrapperElementsAccessor, DictionaryElementsAccessor,
ElementsKindTraits<SLOW_STRING_WRAPPER_ELEMENTS>>(name) {}
static bool HasAccessorsImpl(JSObject holder, FixedArrayBase backing_store) { static bool HasAccessorsImpl(JSObject holder, FixedArrayBase backing_store) {
return DictionaryElementsAccessor::HasAccessorsImpl(holder, backing_store); return DictionaryElementsAccessor::HasAccessorsImpl(holder, backing_store);
} }
...@@ -4632,7 +4520,7 @@ void CopyTypedArrayElementsSlice(Address raw_source, Address raw_destination, ...@@ -4632,7 +4520,7 @@ void CopyTypedArrayElementsSlice(Address raw_source, Address raw_destination,
void ElementsAccessor::InitializeOncePerProcess() { void ElementsAccessor::InitializeOncePerProcess() {
static ElementsAccessor* accessor_array[] = { static ElementsAccessor* accessor_array[] = {
#define ACCESSOR_ARRAY(Class, Kind, Store) new Class(#Kind), #define ACCESSOR_ARRAY(Class, Kind, Store) new Class(),
ELEMENTS_LIST(ACCESSOR_ARRAY) ELEMENTS_LIST(ACCESSOR_ARRAY)
#undef ACCESSOR_ARRAY #undef ACCESSOR_ARRAY
}; };
......
...@@ -18,11 +18,9 @@ class JSTypedArray; ...@@ -18,11 +18,9 @@ class JSTypedArray;
// ElementsKinds. // ElementsKinds.
class ElementsAccessor { class ElementsAccessor {
public: public:
explicit ElementsAccessor(const char* name) : name_(name) {} ElementsAccessor() = default;
virtual ~ElementsAccessor() = default; virtual ~ElementsAccessor() = default;
const char* name() const { return name_; }
// Returns a shared ElementsAccessor for the specified ElementsKind. // Returns a shared ElementsAccessor for the specified ElementsKind.
static ElementsAccessor* ForKind(ElementsKind elements_kind) { static ElementsAccessor* ForKind(ElementsKind elements_kind) {
DCHECK_LT(static_cast<int>(elements_kind), kElementsKindCount); DCHECK_LT(static_cast<int>(elements_kind), kElementsKindCount);
...@@ -213,7 +211,6 @@ class ElementsAccessor { ...@@ -213,7 +211,6 @@ class ElementsAccessor {
private: private:
static ElementsAccessor** elements_accessors_; static ElementsAccessor** elements_accessors_;
const char* name_;
DISALLOW_COPY_AND_ASSIGN(ElementsAccessor); DISALLOW_COPY_AND_ASSIGN(ElementsAccessor);
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment