Add output operator to VectorSlotPair

Bug: v8:7127
Change-Id: Ibdbf6c5627f3fe8a29ae44cc0c284896c344a0ae
Reviewed-on: https://chromium-review.googlesource.com/817295
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49967}
This commit is contained in:
Sigurd Schneider 2017-12-08 15:36:38 +01:00 committed by Commit Bot
parent eb62a4aba4
commit 0afbcdfac1
2 changed files with 10 additions and 0 deletions

View File

@ -24,6 +24,14 @@ bool operator!=(VectorSlotPair const& lhs, VectorSlotPair const& rhs) {
return !(lhs == rhs);
}
std::ostream& operator<<(std::ostream& os, const VectorSlotPair& pair) {
if (pair.IsValid()) {
return os << "VectorSlotPair(" << pair.vector().address() << pair.slot()
<< ")";
}
return os << "VectorSlotPair(INVALID)";
}
size_t hash_value(VectorSlotPair const& p) {
return base::hash_combine(p.slot(), p.vector().location());
}

View File

@ -37,6 +37,8 @@ class V8_EXPORT_PRIVATE VectorSlotPair {
bool operator==(VectorSlotPair const&, VectorSlotPair const&);
bool operator!=(VectorSlotPair const&, VectorSlotPair const&);
std::ostream& operator<<(std::ostream& os, const VectorSlotPair& pair);
size_t hash_value(VectorSlotPair const&);
} // namespace internal