Skip to content

Commit

Permalink
Mark Node::opcode() and Operator::opcode() as constexpr.
Browse files Browse the repository at this point in the history
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/+/2912916
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74791}
  • Loading branch information
leizleiz authored and V8 LUCI CQ committed May 26, 2021
1 parent db245ed commit a5cea1b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/compiler/node.h
Expand Up @@ -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());
}
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/operator.h
Expand Up @@ -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.
Expand Down

0 comments on commit a5cea1b

Please sign in to comment.