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(); VectorSlotPair(Handle<FeedbackVector> vector,FeedbackSlot slot)22 VectorSlotPair(Handle<FeedbackVector> vector, FeedbackSlot slot) 23 : vector_(vector), slot_(slot) {} 24 IsValid()25 bool IsValid() const { return !vector_.is_null() && !slot_.IsInvalid(); } 26 vector()27 Handle<FeedbackVector> vector() const { return vector_; } slot()28 FeedbackSlot slot() const { return slot_; } 29 30 int index() const; 31 32 private: 33 Handle<FeedbackVector> vector_; 34 FeedbackSlot slot_; 35 }; 36 37 bool operator==(VectorSlotPair const&, VectorSlotPair const&); 38 bool operator!=(VectorSlotPair const&, VectorSlotPair const&); 39 40 std::ostream& operator<<(std::ostream& os, const VectorSlotPair& pair); 41 42 size_t hash_value(VectorSlotPair const&); 43 44 } // namespace internal 45 } // namespace v8 46 47 #endif // V8_VECTOR_SLOT_PAIR_H_ 48