V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
vector-slot-pair.cc
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 int VectorSlotPair::index() const {
15  return vector_.is_null() ? -1 : FeedbackVector::GetIndex(slot_);
16 }
17 
18 bool operator==(VectorSlotPair const& lhs, VectorSlotPair const& rhs) {
19  return lhs.slot() == rhs.slot() &&
20  lhs.vector().location() == rhs.vector().location() &&
21  lhs.ic_state() == rhs.ic_state();
22 }
23 
24 bool operator!=(VectorSlotPair const& lhs, VectorSlotPair const& rhs) {
25  return !(lhs == rhs);
26 }
27 
28 std::ostream& operator<<(std::ostream& os, const VectorSlotPair& p) {
29  if (p.IsValid()) {
30  return os << "VectorSlotPair(" << p.slot() << ", "
31  << InlineCacheState2String(p.ic_state()) << ")";
32  }
33  return os << "VectorSlotPair(INVALID)";
34 }
35 
36 size_t hash_value(VectorSlotPair const& p) {
37  return base::hash_combine(p.slot(), p.vector().location(), p.ic_state());
38 }
39 
40 } // namespace internal
41 } // namespace v8
Definition: libplatform.h:13