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 | #ifndef V8_VECTOR_SLOT_PAIR_H_ |
6 | #define V8_VECTOR_SLOT_PAIR_H_ |
7 | |
8 | #include "src/globals.h" |
9 | #include "src/handles.h" |
10 | #include "src/utils.h" |
11 | |
12 | namespace v8 { |
13 | namespace internal { |
14 | |
15 | class FeedbackVector; |
16 | |
17 | // Defines a pair of {FeedbackVector} and {FeedbackSlot}, which |
18 | // is used to access the type feedback for a certain {Node}. |
19 | class V8_EXPORT_PRIVATE VectorSlotPair { |
20 | public: |
21 | VectorSlotPair(); |
22 | VectorSlotPair(Handle<FeedbackVector> vector, FeedbackSlot slot, |
23 | InlineCacheState ic_state) |
24 | : vector_(vector), slot_(slot), ic_state_(ic_state) {} |
25 | |
26 | bool IsValid() const { return !vector_.is_null() && !slot_.IsInvalid(); } |
27 | |
28 | Handle<FeedbackVector> vector() const { return vector_; } |
29 | FeedbackSlot slot() const { return slot_; } |
30 | InlineCacheState ic_state() const { return ic_state_; } |
31 | |
32 | int index() const; |
33 | |
34 | private: |
35 | Handle<FeedbackVector> vector_; |
36 | FeedbackSlot slot_; |
37 | InlineCacheState ic_state_ = UNINITIALIZED; |
38 | }; |
39 | |
40 | bool operator==(VectorSlotPair const&, VectorSlotPair const&); |
41 | bool operator!=(VectorSlotPair const&, VectorSlotPair const&); |
42 | |
43 | V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, |
44 | VectorSlotPair const&); |
45 | |
46 | size_t hash_value(VectorSlotPair const&); |
47 | |
48 | } // namespace internal |
49 | } // namespace v8 |
50 | |
51 | #endif // V8_VECTOR_SLOT_PAIR_H_ |
52 |