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,
HeapObject object) {
ConcreteVisitor* visitor = static_cast<ConcreteVisitor*>(this);
switch (map.visitor_id()) {
#define CASE(TypeName, Type) \
#define CASE(TypeName) \
case kVisit##TypeName: \
return visitor->Visit##TypeName( \
map, ConcreteVisitor::template Cast<TypeName>(object));
......@@ -77,10 +77,10 @@ void HeapVisitor<ResultType, ConcreteVisitor>::VisitMapPointer(
static_cast<ConcreteVisitor*>(this)->VisitPointer(host, host.map_slot());
}
#define VISIT(TypeName, Type) \
#define VISIT(TypeName) \
template <typename ResultType, typename ConcreteVisitor> \
ResultType HeapVisitor<ResultType, ConcreteVisitor>::Visit##TypeName( \
Map map, Type object) { \
Map map, TypeName object) { \
ConcreteVisitor* visitor = static_cast<ConcreteVisitor*>(this); \
if (!visitor->ShouldVisit(object)) return ResultType(); \
if (!visitor->AllowDefaultJSObjectVisit()) { \
......
......@@ -13,59 +13,58 @@
namespace v8 {
namespace internal {
// TODO(jkummerow): Drop the duplication: V(x, x) -> V(x).
#define TYPED_VISITOR_ID_LIST(V) \
V(AllocationSite, AllocationSite) \
V(BigInt, BigInt) \
V(ByteArray, ByteArray) \
V(BytecodeArray, BytecodeArray) \
V(Cell, Cell) \
V(Code, Code) \
V(CodeDataContainer, CodeDataContainer) \
V(ConsString, ConsString) \
V(Context, Context) \
V(DataHandler, DataHandler) \
V(DescriptorArray, DescriptorArray) \
V(EmbedderDataArray, EmbedderDataArray) \
V(EphemeronHashTable, EphemeronHashTable) \
V(FeedbackCell, FeedbackCell) \
V(FeedbackVector, FeedbackVector) \
V(FixedArray, FixedArray) \
V(FixedDoubleArray, FixedDoubleArray) \
V(JSArrayBuffer, JSArrayBuffer) \
V(JSDataView, JSDataView) \
V(JSFunction, JSFunction) \
V(JSObject, JSObject) \
V(JSTypedArray, JSTypedArray) \
V(WeakCell, WeakCell) \
V(JSWeakCollection, JSWeakCollection) \
V(JSWeakRef, JSWeakRef) \
V(Map, Map) \
V(NativeContext, NativeContext) \
V(Oddball, Oddball) \
V(PreparseData, PreparseData) \
V(PropertyArray, PropertyArray) \
V(PropertyCell, PropertyCell) \
V(PrototypeInfo, PrototypeInfo) \
V(SeqOneByteString, SeqOneByteString) \
V(SeqTwoByteString, SeqTwoByteString) \
V(SharedFunctionInfo, SharedFunctionInfo) \
V(SlicedString, SlicedString) \
V(SmallOrderedHashMap, SmallOrderedHashMap) \
V(SmallOrderedHashSet, SmallOrderedHashSet) \
V(SmallOrderedNameDictionary, SmallOrderedNameDictionary) \
V(SourceTextModule, SourceTextModule) \
V(Symbol, Symbol) \
V(SyntheticModule, SyntheticModule) \
V(ThinString, ThinString) \
V(TransitionArray, TransitionArray) \
V(UncompiledDataWithoutPreparseData, UncompiledDataWithoutPreparseData) \
V(UncompiledDataWithPreparseData, UncompiledDataWithPreparseData) \
V(WasmCapiFunctionData, WasmCapiFunctionData) \
V(WasmIndirectFunctionTable, WasmIndirectFunctionTable) \
V(WasmInstanceObject, WasmInstanceObject)
#define FORWARD_DECLARE(TypeName, Type) class Type;
#define TYPED_VISITOR_ID_LIST(V) \
V(AllocationSite) \
V(BigInt) \
V(ByteArray) \
V(BytecodeArray) \
V(Cell) \
V(Code) \
V(CodeDataContainer) \
V(ConsString) \
V(Context) \
V(DataHandler) \
V(DescriptorArray) \
V(EmbedderDataArray) \
V(EphemeronHashTable) \
V(FeedbackCell) \
V(FeedbackVector) \
V(FixedArray) \
V(FixedDoubleArray) \
V(JSArrayBuffer) \
V(JSDataView) \
V(JSFunction) \
V(JSObject) \
V(JSTypedArray) \
V(WeakCell) \
V(JSWeakCollection) \
V(JSWeakRef) \
V(Map) \
V(NativeContext) \
V(Oddball) \
V(PreparseData) \
V(PropertyArray) \
V(PropertyCell) \
V(PrototypeInfo) \
V(SeqOneByteString) \
V(SeqTwoByteString) \
V(SharedFunctionInfo) \
V(SlicedString) \
V(SmallOrderedHashMap) \
V(SmallOrderedHashSet) \
V(SmallOrderedNameDictionary) \
V(SourceTextModule) \
V(Symbol) \
V(SyntheticModule) \
V(ThinString) \
V(TransitionArray) \
V(UncompiledDataWithoutPreparseData) \
V(UncompiledDataWithPreparseData) \
V(WasmCapiFunctionData) \
V(WasmIndirectFunctionTable) \
V(WasmInstanceObject)
#define FORWARD_DECLARE(TypeName) class TypeName;
TYPED_VISITOR_ID_LIST(FORWARD_DECLARE)
#undef FORWARD_DECLARE
......@@ -99,8 +98,8 @@ class HeapVisitor : public ObjectVisitor {
// in default Visit implemention for subclasses of JSObject.
V8_INLINE bool AllowDefaultJSObjectVisit() { return true; }
#define VISIT(TypeName, Type) \
V8_INLINE ResultType Visit##TypeName(Map map, Type object);
#define VISIT(TypeName) \
V8_INLINE ResultType Visit##TypeName(Map map, TypeName object);
TYPED_VISITOR_ID_LIST(VISIT)
#undef VISIT
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