OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_COMPILER_JS_OPERATOR_H_ | 5 #ifndef V8_COMPILER_JS_OPERATOR_H_ |
6 #define V8_COMPILER_JS_OPERATOR_H_ | 6 #define V8_COMPILER_JS_OPERATOR_H_ |
7 | 7 |
8 #include "src/runtime/runtime.h" | 8 #include "src/runtime/runtime.h" |
9 #include "src/unique.h" | |
10 | 9 |
11 namespace v8 { | 10 namespace v8 { |
12 namespace internal { | 11 namespace internal { |
13 namespace compiler { | 12 namespace compiler { |
14 | 13 |
15 // Forward declarations. | 14 // Forward declarations. |
16 class Operator; | 15 class Operator; |
17 struct JSOperatorGlobalCache; | 16 struct JSOperatorGlobalCache; |
18 | 17 |
19 | 18 |
20 // Defines a pair of {TypeFeedbackVector} and {TypeFeedbackVectorICSlot}, which | 19 // Defines a pair of {TypeFeedbackVector} and {TypeFeedbackVectorICSlot}, which |
21 // is used to access the type feedback for a certain {Node}. | 20 // is used to access the type feedback for a certain {Node}. |
22 class VectorSlotPair { | 21 class VectorSlotPair { |
23 public: | 22 public: |
24 VectorSlotPair() : slot_(FeedbackVectorICSlot::Invalid()) {} | 23 VectorSlotPair(); |
25 VectorSlotPair(Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot) | 24 VectorSlotPair(Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot) |
26 : vector_(vector), slot_(slot) {} | 25 : vector_(vector), slot_(slot) {} |
27 | 26 |
28 bool IsValid() const { return !vector_.is_null(); } | 27 bool IsValid() const { return !vector_.is_null(); } |
29 | 28 |
30 Handle<TypeFeedbackVector> vector() const { return vector_; } | 29 Handle<TypeFeedbackVector> vector() const { return vector_; } |
31 FeedbackVectorICSlot slot() const { return slot_; } | 30 FeedbackVectorICSlot slot() const { return slot_; } |
32 | 31 |
33 int index() const { | 32 int index() const; |
34 return vector_.is_null() ? -1 : vector_->GetIndex(slot_); | |
35 } | |
36 | 33 |
37 private: | 34 private: |
38 const Handle<TypeFeedbackVector> vector_; | 35 const Handle<TypeFeedbackVector> vector_; |
39 const FeedbackVectorICSlot slot_; | 36 const FeedbackVectorICSlot slot_; |
40 }; | 37 }; |
41 | 38 |
42 bool operator==(VectorSlotPair const&, VectorSlotPair const&); | 39 bool operator==(VectorSlotPair const&, VectorSlotPair const&); |
43 bool operator!=(VectorSlotPair const&, VectorSlotPair const&); | 40 bool operator!=(VectorSlotPair const&, VectorSlotPair const&); |
44 | 41 |
45 size_t hash_value(VectorSlotPair const&); | 42 size_t hash_value(VectorSlotPair const&); |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 Zone* const zone_; | 543 Zone* const zone_; |
547 | 544 |
548 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); | 545 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); |
549 }; | 546 }; |
550 | 547 |
551 } // namespace compiler | 548 } // namespace compiler |
552 } // namespace internal | 549 } // namespace internal |
553 } // namespace v8 | 550 } // namespace v8 |
554 | 551 |
555 #endif // V8_COMPILER_JS_OPERATOR_H_ | 552 #endif // V8_COMPILER_JS_OPERATOR_H_ |
OLD | NEW |