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" | 9 #include "src/unique.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 namespace compiler { | 13 namespace compiler { |
14 | 14 |
15 // Forward declarations. | 15 // Forward declarations. |
16 class Operator; | 16 class Operator; |
17 struct JSOperatorGlobalCache; | 17 struct JSOperatorGlobalCache; |
18 | 18 |
19 | 19 |
20 // Defines a pair of {TypeFeedbackVector} and {TypeFeedbackVectorICSlot}, which | 20 // Defines a pair of {TypeFeedbackVector} and {TypeFeedbackVectorICSlot}, which |
21 // is used to access the type feedback for a certain {Node}. | 21 // is used to access the type feedback for a certain {Node}. |
22 class VectorSlotPair { | 22 class VectorSlotPair { |
23 public: | 23 public: |
24 VectorSlotPair() : slot_(FeedbackVectorICSlot::Invalid()) {} | 24 VectorSlotPair() : slot_(FeedbackVectorICSlot::Invalid()) {} |
25 VectorSlotPair(Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot) | 25 VectorSlotPair(Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot) |
26 : vector_(vector), slot_(slot) {} | 26 : vector_(vector), slot_(slot) {} |
27 | 27 |
28 bool IsValid() const { return !vector_.is_null(); } | 28 bool IsValid() const { return !vector_.is_null(); } |
29 | 29 |
30 MaybeHandle<TypeFeedbackVector> vector() const { return vector_; } | 30 Handle<TypeFeedbackVector> vector() const { return vector_; } |
31 FeedbackVectorICSlot slot() const { return slot_; } | 31 FeedbackVectorICSlot slot() const { return slot_; } |
32 | 32 |
33 int index() const { | 33 int index() const { |
34 Handle<TypeFeedbackVector> vector; | 34 return vector_.is_null() ? -1 : vector_->GetIndex(slot_); |
35 return vector_.ToHandle(&vector) ? vector->GetIndex(slot_) : -1; | |
36 } | 35 } |
37 | 36 |
38 private: | 37 private: |
39 const MaybeHandle<TypeFeedbackVector> vector_; | 38 const Handle<TypeFeedbackVector> vector_; |
40 const FeedbackVectorICSlot slot_; | 39 const FeedbackVectorICSlot slot_; |
41 }; | 40 }; |
42 | 41 |
43 bool operator==(VectorSlotPair const&, VectorSlotPair const&); | 42 bool operator==(VectorSlotPair const&, VectorSlotPair const&); |
44 bool operator!=(VectorSlotPair const&, VectorSlotPair const&); | 43 bool operator!=(VectorSlotPair const&, VectorSlotPair const&); |
45 | 44 |
46 size_t hash_value(VectorSlotPair const&); | 45 size_t hash_value(VectorSlotPair const&); |
47 | 46 |
48 enum TailCallMode { NO_TAIL_CALLS, ALLOW_TAIL_CALLS }; | 47 enum TailCallMode { NO_TAIL_CALLS, ALLOW_TAIL_CALLS }; |
49 | 48 |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 Zone* const zone_; | 546 Zone* const zone_; |
548 | 547 |
549 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); | 548 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); |
550 }; | 549 }; |
551 | 550 |
552 } // namespace compiler | 551 } // namespace compiler |
553 } // namespace internal | 552 } // namespace internal |
554 } // namespace v8 | 553 } // namespace v8 |
555 | 554 |
556 #endif // V8_COMPILER_JS_OPERATOR_H_ | 555 #endif // V8_COMPILER_JS_OPERATOR_H_ |
OLD | NEW |