Move DCHECK() in JSCallOrConstructNode ctor into a helper function.

As is, the DCHECK() has a #if inside, and MSVC has trouble
pre-processing that. Fix this by moving the conditional inside the
DCHECK() into a separate helper function.

Bug: v8:11760
Change-Id: Ib4ae0fe263029bb426da378afa5b6881557ce652
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2919421
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74807}
This commit is contained in:
Lei Zhang 2021-05-26 10:17:26 -07:00 committed by V8 LUCI CQ
parent dfdc8f6879
commit 7ff6609a53

View File

@ -1284,16 +1284,7 @@ class JSCallOrConstructNode : public JSNodeWrapperBase {
public:
explicit constexpr JSCallOrConstructNode(Node* node)
: JSNodeWrapperBase(node) {
DCHECK(node->opcode() == IrOpcode::kJSCall ||
node->opcode() == IrOpcode::kJSCallWithArrayLike ||
node->opcode() == IrOpcode::kJSCallWithSpread ||
node->opcode() == IrOpcode::kJSConstruct ||
node->opcode() == IrOpcode::kJSConstructWithArrayLike ||
node->opcode() == IrOpcode::kJSConstructWithSpread
#if V8_ENABLE_WEBASSEMBLY
|| node->opcode() == IrOpcode::kJSWasmCall
#endif // V8_ENABLE_WEBASSEMBLY
); // NOLINT(whitespace/parens)
DCHECK(IsValidNode(node));
}
#define INPUTS(V) \
@ -1367,6 +1358,20 @@ class JSCallOrConstructNode : public JSNodeWrapperBase {
return TNode<HeapObject>::UncheckedCast(
NodeProperties::GetValueInput(node(), FeedbackVectorIndex()));
}
private:
static constexpr bool IsValidNode(Node* node) {
return node->opcode() == IrOpcode::kJSCall ||
node->opcode() == IrOpcode::kJSCallWithArrayLike ||
node->opcode() == IrOpcode::kJSCallWithSpread ||
node->opcode() == IrOpcode::kJSConstruct ||
node->opcode() == IrOpcode::kJSConstructWithArrayLike ||
node->opcode() == IrOpcode::kJSConstructWithSpread
#if V8_ENABLE_WEBASSEMBLY
|| node->opcode() == IrOpcode::kJSWasmCall
#endif // V8_ENABLE_WEBASSEMBLY
; // NOLINT(whitespace/semicolon)
}
};
template <int kOpcode>