Commit 6de03835 authored by Irina Yatsenko's avatar Irina Yatsenko Committed by Commit Bot

[cleanup] Remove duplication from TYPED_VISITOR_ID_LIST

Bug: v8:9810
Change-Id: I03a54464742b734890737d61f3accd3a581b91f5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1849207Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Irina Yatsenko <irinayat@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#64220}
parent 4e8c6281
...@@ -38,7 +38,7 @@ ResultType HeapVisitor<ResultType, ConcreteVisitor>::Visit(Map map, ...@@ -38,7 +38,7 @@ ResultType HeapVisitor<ResultType, ConcreteVisitor>::Visit(Map map,
HeapObject object) { HeapObject object) {
ConcreteVisitor* visitor = static_cast<ConcreteVisitor*>(this); ConcreteVisitor* visitor = static_cast<ConcreteVisitor*>(this);
switch (map.visitor_id()) { switch (map.visitor_id()) {
#define CASE(TypeName, Type) \ #define CASE(TypeName) \
case kVisit##TypeName: \ case kVisit##TypeName: \
return visitor->Visit##TypeName( \ return visitor->Visit##TypeName( \
map, ConcreteVisitor::template Cast<TypeName>(object)); map, ConcreteVisitor::template Cast<TypeName>(object));
...@@ -77,10 +77,10 @@ void HeapVisitor<ResultType, ConcreteVisitor>::VisitMapPointer( ...@@ -77,10 +77,10 @@ void HeapVisitor<ResultType, ConcreteVisitor>::VisitMapPointer(
static_cast<ConcreteVisitor*>(this)->VisitPointer(host, host.map_slot()); static_cast<ConcreteVisitor*>(this)->VisitPointer(host, host.map_slot());
} }
#define VISIT(TypeName, Type) \ #define VISIT(TypeName) \
template <typename ResultType, typename ConcreteVisitor> \ template <typename ResultType, typename ConcreteVisitor> \
ResultType HeapVisitor<ResultType, ConcreteVisitor>::Visit##TypeName( \ ResultType HeapVisitor<ResultType, ConcreteVisitor>::Visit##TypeName( \
Map map, Type object) { \ Map map, TypeName object) { \
ConcreteVisitor* visitor = static_cast<ConcreteVisitor*>(this); \ ConcreteVisitor* visitor = static_cast<ConcreteVisitor*>(this); \
if (!visitor->ShouldVisit(object)) return ResultType(); \ if (!visitor->ShouldVisit(object)) return ResultType(); \
if (!visitor->AllowDefaultJSObjectVisit()) { \ if (!visitor->AllowDefaultJSObjectVisit()) { \
......
...@@ -13,59 +13,58 @@ ...@@ -13,59 +13,58 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
// TODO(jkummerow): Drop the duplication: V(x, x) -> V(x). #define TYPED_VISITOR_ID_LIST(V) \
#define TYPED_VISITOR_ID_LIST(V) \ V(AllocationSite) \
V(AllocationSite, AllocationSite) \ V(BigInt) \
V(BigInt, BigInt) \ V(ByteArray) \
V(ByteArray, ByteArray) \ V(BytecodeArray) \
V(BytecodeArray, BytecodeArray) \ V(Cell) \
V(Cell, Cell) \ V(Code) \
V(Code, Code) \ V(CodeDataContainer) \
V(CodeDataContainer, CodeDataContainer) \ V(ConsString) \
V(ConsString, ConsString) \ V(Context) \
V(Context, Context) \ V(DataHandler) \
V(DataHandler, DataHandler) \ V(DescriptorArray) \
V(DescriptorArray, DescriptorArray) \ V(EmbedderDataArray) \
V(EmbedderDataArray, EmbedderDataArray) \ V(EphemeronHashTable) \
V(EphemeronHashTable, EphemeronHashTable) \ V(FeedbackCell) \
V(FeedbackCell, FeedbackCell) \ V(FeedbackVector) \
V(FeedbackVector, FeedbackVector) \ V(FixedArray) \
V(FixedArray, FixedArray) \ V(FixedDoubleArray) \
V(FixedDoubleArray, FixedDoubleArray) \ V(JSArrayBuffer) \
V(JSArrayBuffer, JSArrayBuffer) \ V(JSDataView) \
V(JSDataView, JSDataView) \ V(JSFunction) \
V(JSFunction, JSFunction) \ V(JSObject) \
V(JSObject, JSObject) \ V(JSTypedArray) \
V(JSTypedArray, JSTypedArray) \ V(WeakCell) \
V(WeakCell, WeakCell) \ V(JSWeakCollection) \
V(JSWeakCollection, JSWeakCollection) \ V(JSWeakRef) \
V(JSWeakRef, JSWeakRef) \ V(Map) \
V(Map, Map) \ V(NativeContext) \
V(NativeContext, NativeContext) \ V(Oddball) \
V(Oddball, Oddball) \ V(PreparseData) \
V(PreparseData, PreparseData) \ V(PropertyArray) \
V(PropertyArray, PropertyArray) \ V(PropertyCell) \
V(PropertyCell, PropertyCell) \ V(PrototypeInfo) \
V(PrototypeInfo, PrototypeInfo) \ V(SeqOneByteString) \
V(SeqOneByteString, SeqOneByteString) \ V(SeqTwoByteString) \
V(SeqTwoByteString, SeqTwoByteString) \ V(SharedFunctionInfo) \
V(SharedFunctionInfo, SharedFunctionInfo) \ V(SlicedString) \
V(SlicedString, SlicedString) \ V(SmallOrderedHashMap) \
V(SmallOrderedHashMap, SmallOrderedHashMap) \ V(SmallOrderedHashSet) \
V(SmallOrderedHashSet, SmallOrderedHashSet) \ V(SmallOrderedNameDictionary) \
V(SmallOrderedNameDictionary, SmallOrderedNameDictionary) \ V(SourceTextModule) \
V(SourceTextModule, SourceTextModule) \ V(Symbol) \
V(Symbol, Symbol) \ V(SyntheticModule) \
V(SyntheticModule, SyntheticModule) \ V(ThinString) \
V(ThinString, ThinString) \ V(TransitionArray) \
V(TransitionArray, TransitionArray) \ V(UncompiledDataWithoutPreparseData) \
V(UncompiledDataWithoutPreparseData, UncompiledDataWithoutPreparseData) \ V(UncompiledDataWithPreparseData) \
V(UncompiledDataWithPreparseData, UncompiledDataWithPreparseData) \ V(WasmCapiFunctionData) \
V(WasmCapiFunctionData, WasmCapiFunctionData) \ V(WasmIndirectFunctionTable) \
V(WasmIndirectFunctionTable, WasmIndirectFunctionTable) \ V(WasmInstanceObject)
V(WasmInstanceObject, WasmInstanceObject)
#define FORWARD_DECLARE(TypeName) class TypeName;
#define FORWARD_DECLARE(TypeName, Type) class Type;
TYPED_VISITOR_ID_LIST(FORWARD_DECLARE) TYPED_VISITOR_ID_LIST(FORWARD_DECLARE)
#undef FORWARD_DECLARE #undef FORWARD_DECLARE
...@@ -99,8 +98,8 @@ class HeapVisitor : public ObjectVisitor { ...@@ -99,8 +98,8 @@ class HeapVisitor : public ObjectVisitor {
// in default Visit implemention for subclasses of JSObject. // in default Visit implemention for subclasses of JSObject.
V8_INLINE bool AllowDefaultJSObjectVisit() { return true; } V8_INLINE bool AllowDefaultJSObjectVisit() { return true; }
#define VISIT(TypeName, Type) \ #define VISIT(TypeName) \
V8_INLINE ResultType Visit##TypeName(Map map, Type object); V8_INLINE ResultType Visit##TypeName(Map map, TypeName object);
TYPED_VISITOR_ID_LIST(VISIT) TYPED_VISITOR_ID_LIST(VISIT)
#undef VISIT #undef VISIT
V8_INLINE ResultType VisitShortcutCandidate(Map map, ConsString object); V8_INLINE ResultType VisitShortcutCandidate(Map map, ConsString object);
......
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