From 588986e4d3589bc8ae950de5fca94bd60066c3da Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Wed, 22 Feb 2023 13:50:42 +0100 Subject: [Backport] 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 Review-URL: https://chromium-review.googlesource.com/c/v8/v8/+/2912916 Cr-Commit-Position: refs/heads/master@{#74791} Change-Id: I75a9bdf0fa455940f8703988438e99ffc6b3be8b Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/462017 Reviewed-by: Allan Sandfeld Jensen --- chromium/v8/src/compiler/node.h | 2 +- chromium/v8/src/compiler/operator.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/chromium/v8/src/compiler/node.h b/chromium/v8/src/compiler/node.h index 1936f06457e..83ff9e256ce 100644 --- a/chromium/v8/src/compiler/node.h +++ b/chromium/v8/src/compiler/node.h @@ -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(op_->opcode()); } diff --git a/chromium/v8/src/compiler/operator.h b/chromium/v8/src/compiler/operator.h index 7227c92cd86..94d70588672 100644 --- a/chromium/v8/src/compiler/operator.h +++ b/chromium/v8/src/compiler/operator.h @@ -69,7 +69,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. -- cgit v1.2.1