Commit a5cea1bf authored by Lei Zhang's avatar Lei Zhang Committed by V8 LUCI CQ

Mark Node::opcode() and Operator::opcode() as constexpr.

Without the explicit constexpr keyword, Clang seems to be able to treat
these methods as constexpr, whereas MSVC will not.

Bug: v8:11760
Change-Id: I9f6492f38fb50dcaf7a4f09da0bd79c0da6a50eb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2912916Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74791}
parent db245ed8
......@@ -50,7 +50,7 @@ class V8_EXPORT_PRIVATE Node final {
const Operator* op() const { return op_; }
IrOpcode::Value opcode() const {
constexpr IrOpcode::Value opcode() const {
DCHECK_GE(IrOpcode::kLast, op_->opcode());
return static_cast<IrOpcode::Value>(op_->opcode());
}
......
......@@ -73,7 +73,7 @@ class V8_EXPORT_PRIVATE Operator : public NON_EXPORTED_BASE(ZoneObject) {
// A small integer unique to all instances of a particular kind of operator,
// useful for quick matching for specific kinds of operators. For fast access
// the opcode is stored directly in the operator object.
Opcode opcode() const { return opcode_; }
constexpr Opcode opcode() const { return opcode_; }
// Returns a constant string representing the mnemonic of the operator,
// without the static parameters. Useful for debugging.
......
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