v8/src/vector-slot-pair.cc
Florian Sattler a072e666f6 [cleanup] Refactor first batch of general classes to use default members.
Fixing clang-tidy warning.

Bug: v8:8015
Change-Id: Ibc5a81aea25f797e90db891e90b2977f27e13990
Reviewed-on: https://chromium-review.googlesource.com/1224410
Commit-Queue: Florian Sattler <sattlerf@google.com>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56015}
2018-09-19 08:32:08 +00:00

42 lines
1.1 KiB
C++

// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/vector-slot-pair.h"
#include "src/feedback-vector.h"
namespace v8 {
namespace internal {
VectorSlotPair::VectorSlotPair() = default;
int VectorSlotPair::index() const {
return vector_.is_null() ? -1 : FeedbackVector::GetIndex(slot_);
}
bool operator==(VectorSlotPair const& lhs, VectorSlotPair const& rhs) {
return lhs.slot() == rhs.slot() &&
lhs.vector().location() == rhs.vector().location() &&
lhs.ic_state() == rhs.ic_state();
}
bool operator!=(VectorSlotPair const& lhs, VectorSlotPair const& rhs) {
return !(lhs == rhs);
}
std::ostream& operator<<(std::ostream& os, const VectorSlotPair& p) {
if (p.IsValid()) {
return os << "VectorSlotPair(" << p.slot() << ", "
<< InlineCacheState2String(p.ic_state()) << ")";
}
return os << "VectorSlotPair(INVALID)";
}
size_t hash_value(VectorSlotPair const& p) {
return base::hash_combine(p.slot(), p.vector().location(), p.ic_state());
}
} // namespace internal
} // namespace v8