Commit 9fa61a96 authored by Ting Shao's avatar Ting Shao Committed by Commit Bot

[node] Optimize the method Node::OwnedBy(Node const* owner)

Optimize the implementation of this method by removing unnecessary
bitwise OR operation.

Change-Id: Ic16e0d556d7fca6883aed77e592faa2fdd602624
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2709558Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73039}
parent 14558e02
......@@ -314,15 +314,12 @@ void Node::ReplaceUses(Node* that) {
}
bool Node::OwnedBy(Node const* owner) const {
unsigned mask = 0;
for (Use* use = first_use_; use; use = use->next) {
if (use->from() == owner) {
mask |= 1;
} else {
if (use->from() != owner) {
return false;
}
}
return mask == 1;
return first_use_ != nullptr;
}
bool Node::OwnedBy(Node const* owner1, Node const* owner2) const {
......
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