Line data Source code
1 : // Copyright 2017 the V8 project authors. All rights reserved.
2 : // Use of this source code is governed by a BSD-style license that can be
3 : // found in the LICENSE file.
4 :
5 : #include "src/vector-slot-pair.h"
6 :
7 : #include "src/feedback-vector.h"
8 :
9 : namespace v8 {
10 : namespace internal {
11 :
12 : VectorSlotPair::VectorSlotPair() = default;
13 :
14 1265498 : int VectorSlotPair::index() const {
15 1265498 : return vector_.is_null() ? -1 : FeedbackVector::GetIndex(slot_);
16 : }
17 :
18 0 : bool operator==(VectorSlotPair const& lhs, VectorSlotPair const& rhs) {
19 0 : return lhs.slot() == rhs.slot() &&
20 0 : lhs.vector().location() == rhs.vector().location() &&
21 0 : lhs.ic_state() == rhs.ic_state();
22 : }
23 :
24 0 : bool operator!=(VectorSlotPair const& lhs, VectorSlotPair const& rhs) {
25 0 : return !(lhs == rhs);
26 : }
27 :
28 473 : std::ostream& operator<<(std::ostream& os, const VectorSlotPair& p) {
29 473 : if (p.IsValid()) {
30 298 : return os << "VectorSlotPair(" << p.slot() << ", "
31 894 : << InlineCacheState2String(p.ic_state()) << ")";
32 : }
33 175 : return os << "VectorSlotPair(INVALID)";
34 : }
35 :
36 0 : size_t hash_value(VectorSlotPair const& p) {
37 0 : return base::hash_combine(p.slot(), p.vector().location(), p.ic_state());
38 : }
39 :
40 : } // namespace internal
41 122036 : } // namespace v8
|