Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: src/type-feedback-vector.h

Issue 2337123003: [turbofan] Collect invocation counts and compute relative call frequencies. (Closed)
Patch Set: Address feedback. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/profiler/heap-snapshot-generator.cc ('k') | src/type-feedback-vector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_TYPE_FEEDBACK_VECTOR_H_ 5 #ifndef V8_TYPE_FEEDBACK_VECTOR_H_
6 #define V8_TYPE_FEEDBACK_VECTOR_H_ 6 #define V8_TYPE_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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 215
216 typedef BitSetComputer<FeedbackVectorSlotKind, kFeedbackVectorSlotKindBits, 216 typedef BitSetComputer<FeedbackVectorSlotKind, kFeedbackVectorSlotKindBits,
217 kSmiValueSize, uint32_t> VectorICComputer; 217 kSmiValueSize, uint32_t> VectorICComputer;
218 218
219 DISALLOW_IMPLICIT_CONSTRUCTORS(TypeFeedbackMetadata); 219 DISALLOW_IMPLICIT_CONSTRUCTORS(TypeFeedbackMetadata);
220 }; 220 };
221 221
222 222
223 // The shape of the TypeFeedbackVector is an array with: 223 // The shape of the TypeFeedbackVector is an array with:
224 // 0: feedback metadata 224 // 0: feedback metadata
225 // 1: feedback slot #0 225 // 1: invocation count
226 // 2: feedback slot #0
226 // ... 227 // ...
227 // 1 + slot_count - 1: feedback slot #(slot_count-1) 228 // 2 + slot_count - 1: feedback slot #(slot_count-1)
228 // 229 //
229 class TypeFeedbackVector : public FixedArray { 230 class TypeFeedbackVector : public FixedArray {
230 public: 231 public:
231 // Casting. 232 // Casting.
232 static inline TypeFeedbackVector* cast(Object* obj); 233 static inline TypeFeedbackVector* cast(Object* obj);
233 234
234 static const int kMetadataIndex = 0; 235 static const int kMetadataIndex = 0;
235 static const int kReservedIndexCount = 1; 236 static const int kInvocationCountIndex = 1;
237 static const int kReservedIndexCount = 2;
236 238
237 inline void ComputeCounts(int* with_type_info, int* generic); 239 inline void ComputeCounts(int* with_type_info, int* generic);
238 240
239 inline bool is_empty() const; 241 inline bool is_empty() const;
240 242
241 // Returns number of slots in the vector. 243 // Returns number of slots in the vector.
242 inline int slot_count() const; 244 inline int slot_count() const;
243 245
244 inline TypeFeedbackMetadata* metadata() const; 246 inline TypeFeedbackMetadata* metadata() const;
247 inline int invocation_count() const;
245 248
246 // Conversion from a slot to an integer index to the underlying array. 249 // Conversion from a slot to an integer index to the underlying array.
247 static int GetIndex(FeedbackVectorSlot slot) { 250 static int GetIndex(FeedbackVectorSlot slot) {
248 return kReservedIndexCount + slot.ToInt(); 251 return kReservedIndexCount + slot.ToInt();
249 } 252 }
250 static int GetIndexFromSpec(const FeedbackVectorSpec* spec, 253 static int GetIndexFromSpec(const FeedbackVectorSpec* spec,
251 FeedbackVectorSlot slot); 254 FeedbackVectorSlot slot);
252 255
253 // Conversion from an integer index to the underlying array to a slot. 256 // Conversion from an integer index to the underlying array to a slot.
254 static inline FeedbackVectorSlot ToSlot(int index); 257 static inline FeedbackVectorSlot ToSlot(int index);
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 } 476 }
474 MaybeHandle<Object> FindHandlerForMap(Handle<Map> map) const final { 477 MaybeHandle<Object> FindHandlerForMap(Handle<Map> map) const final {
475 return MaybeHandle<Code>(); 478 return MaybeHandle<Code>();
476 } 479 }
477 bool FindHandlers(List<Handle<Object>>* code_list, 480 bool FindHandlers(List<Handle<Object>>* code_list,
478 int length = -1) const final { 481 int length = -1) const final {
479 return length == 0; 482 return length == 0;
480 } 483 }
481 484
482 int ExtractCallCount(); 485 int ExtractCallCount();
486
487 // Compute the call frequency based on the call count and the invocation
488 // count (taken from the type feedback vector).
489 float ComputeCallFrequency();
483 }; 490 };
484 491
485 492
486 class LoadICNexus : public FeedbackNexus { 493 class LoadICNexus : public FeedbackNexus {
487 public: 494 public:
488 LoadICNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorSlot slot) 495 LoadICNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorSlot slot)
489 : FeedbackNexus(vector, slot) { 496 : FeedbackNexus(vector, slot) {
490 DCHECK_EQ(FeedbackVectorSlotKind::LOAD_IC, vector->GetKind(slot)); 497 DCHECK_EQ(FeedbackVectorSlotKind::LOAD_IC, vector->GetKind(slot));
491 } 498 }
492 explicit LoadICNexus(Isolate* isolate) 499 explicit LoadICNexus(Isolate* isolate)
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 KeyedAccessStoreMode GetKeyedAccessStoreMode() const; 633 KeyedAccessStoreMode GetKeyedAccessStoreMode() const;
627 IcCheckType GetKeyType() const; 634 IcCheckType GetKeyType() const;
628 635
629 InlineCacheState StateFromFeedback() const override; 636 InlineCacheState StateFromFeedback() const override;
630 Name* FindFirstName() const override; 637 Name* FindFirstName() const override;
631 }; 638 };
632 } // namespace internal 639 } // namespace internal
633 } // namespace v8 640 } // namespace v8
634 641
635 #endif // V8_TRANSITIONS_H_ 642 #endif // V8_TRANSITIONS_H_
OLDNEW
« no previous file with comments | « src/profiler/heap-snapshot-generator.cc ('k') | src/type-feedback-vector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698