OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_FEEDBACK_VECTOR_H_ | 5 #ifndef V8_FEEDBACK_VECTOR_H_ |
6 #define V8_FEEDBACK_VECTOR_H_ | 6 #define V8_FEEDBACK_VECTOR_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "src/base/logging.h" | 10 #include "src/base/logging.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 // 1: invocation count | 256 // 1: invocation count |
257 // 2: feedback slot #0 | 257 // 2: feedback slot #0 |
258 // ... | 258 // ... |
259 // 2 + slot_count - 1: feedback slot #(slot_count-1) | 259 // 2 + slot_count - 1: feedback slot #(slot_count-1) |
260 // | 260 // |
261 class FeedbackVector : public FixedArray { | 261 class FeedbackVector : public FixedArray { |
262 public: | 262 public: |
263 // Casting. | 263 // Casting. |
264 static inline FeedbackVector* cast(Object* obj); | 264 static inline FeedbackVector* cast(Object* obj); |
265 | 265 |
266 static const int kMetadataIndex = 0; | 266 static const int kSharedFunctionInfoIndex = 0; |
267 static const int kInvocationCountIndex = 1; | 267 static const int kInvocationCountIndex = 1; |
268 static const int kReservedIndexCount = 2; | 268 static const int kReservedIndexCount = 2; |
269 | 269 |
270 inline void ComputeCounts(int* with_type_info, int* generic, | 270 inline void ComputeCounts(int* with_type_info, int* generic, |
271 int* vector_ic_count, bool code_is_interpreted); | 271 int* vector_ic_count, bool code_is_interpreted); |
272 | 272 |
273 inline bool is_empty() const; | 273 inline bool is_empty() const; |
274 | 274 |
275 // Returns number of slots in the vector. | 275 // Returns number of slots in the vector. |
276 inline int slot_count() const; | 276 inline int slot_count() const; |
277 | 277 |
278 inline FeedbackMetadata* metadata() const; | 278 inline FeedbackMetadata* metadata() const; |
| 279 inline SharedFunctionInfo* shared_function_info() const; |
279 inline int invocation_count() const; | 280 inline int invocation_count() const; |
280 | 281 |
281 // Conversion from a slot to an integer index to the underlying array. | 282 // Conversion from a slot to an integer index to the underlying array. |
282 static int GetIndex(FeedbackSlot slot) { | 283 static int GetIndex(FeedbackSlot slot) { |
283 return kReservedIndexCount + slot.ToInt(); | 284 return kReservedIndexCount + slot.ToInt(); |
284 } | 285 } |
285 | 286 |
286 // Conversion from an integer index to the underlying array to a slot. | 287 // Conversion from an integer index to the underlying array to a slot. |
287 static inline FeedbackSlot ToSlot(int index); | 288 static inline FeedbackSlot ToSlot(int index); |
288 inline Object* Get(FeedbackSlot slot) const; | 289 inline Object* Get(FeedbackSlot slot) const; |
289 inline void Set(FeedbackSlot slot, Object* value, | 290 inline void Set(FeedbackSlot slot, Object* value, |
290 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 291 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
291 | 292 |
292 // Returns slot kind for given slot. | 293 // Returns slot kind for given slot. |
293 FeedbackSlotKind GetKind(FeedbackSlot slot) const; | 294 FeedbackSlotKind GetKind(FeedbackSlot slot) const; |
294 | 295 |
295 static Handle<FeedbackVector> New(Isolate* isolate, | 296 static Handle<FeedbackVector> New(Isolate* isolate, |
296 Handle<FeedbackMetadata> metadata); | 297 Handle<SharedFunctionInfo> shared); |
297 | 298 |
298 static Handle<FeedbackVector> Copy(Isolate* isolate, | 299 static Handle<FeedbackVector> Copy(Isolate* isolate, |
299 Handle<FeedbackVector> vector); | 300 Handle<FeedbackVector> vector); |
300 | 301 |
301 #define DEFINE_SLOT_KIND_PREDICATE(Name) \ | 302 #define DEFINE_SLOT_KIND_PREDICATE(Name) \ |
302 bool Name(FeedbackSlot slot) const { return Name##Kind(GetKind(slot)); } | 303 bool Name(FeedbackSlot slot) const { return Name##Kind(GetKind(slot)); } |
303 | 304 |
304 DEFINE_SLOT_KIND_PREDICATE(IsCallIC) | 305 DEFINE_SLOT_KIND_PREDICATE(IsCallIC) |
305 DEFINE_SLOT_KIND_PREDICATE(IsLoadIC) | 306 DEFINE_SLOT_KIND_PREDICATE(IsLoadIC) |
306 DEFINE_SLOT_KIND_PREDICATE(IsLoadGlobalIC) | 307 DEFINE_SLOT_KIND_PREDICATE(IsLoadGlobalIC) |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 InlineCacheState StateFromFeedback() const override; | 729 InlineCacheState StateFromFeedback() const override; |
729 }; | 730 }; |
730 | 731 |
731 inline BinaryOperationHint BinaryOperationHintFromFeedback(int type_feedback); | 732 inline BinaryOperationHint BinaryOperationHintFromFeedback(int type_feedback); |
732 inline CompareOperationHint CompareOperationHintFromFeedback(int type_feedback); | 733 inline CompareOperationHint CompareOperationHintFromFeedback(int type_feedback); |
733 | 734 |
734 } // namespace internal | 735 } // namespace internal |
735 } // namespace v8 | 736 } // namespace v8 |
736 | 737 |
737 #endif // V8_FEEDBACK_VECTOR_H_ | 738 #endif // V8_FEEDBACK_VECTOR_H_ |
OLD | NEW |