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

Side by Side Diff: src/type-feedback-vector-inl.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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_INL_H_ 5 #ifndef V8_TYPE_FEEDBACK_VECTOR_INL_H_
6 #define V8_TYPE_FEEDBACK_VECTOR_INL_H_ 6 #define V8_TYPE_FEEDBACK_VECTOR_INL_H_
7 7
8 #include "src/type-feedback-vector.h" 8 #include "src/type-feedback-vector.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 return false; 70 return false;
71 71
72 case FeedbackVectorSlotKind::KINDS_NUMBER: 72 case FeedbackVectorSlotKind::KINDS_NUMBER:
73 break; 73 break;
74 } 74 }
75 UNREACHABLE(); 75 UNREACHABLE();
76 return false; 76 return false;
77 } 77 }
78 78
79 bool TypeFeedbackVector::is_empty() const { 79 bool TypeFeedbackVector::is_empty() const {
80 if (length() == 0) return true; 80 return length() == kReservedIndexCount;
81 DCHECK(length() > kReservedIndexCount);
82 return false;
83 } 81 }
84 82
85
86 int TypeFeedbackVector::slot_count() const { 83 int TypeFeedbackVector::slot_count() const {
87 if (length() == 0) return 0;
88 DCHECK(length() > kReservedIndexCount);
89 return length() - kReservedIndexCount; 84 return length() - kReservedIndexCount;
90 } 85 }
91 86
92 87
93 TypeFeedbackMetadata* TypeFeedbackVector::metadata() const { 88 TypeFeedbackMetadata* TypeFeedbackVector::metadata() const {
94 return is_empty() ? TypeFeedbackMetadata::cast(GetHeap()->empty_fixed_array()) 89 return TypeFeedbackMetadata::cast(get(kMetadataIndex));
95 : TypeFeedbackMetadata::cast(get(kMetadataIndex)); 90 }
91
92 int TypeFeedbackVector::invocation_count() const {
93 return Smi::cast(get(kInvocationCountIndex))->value();
96 } 94 }
97 95
98 // Conversion from an integer index to either a slot or an ic slot. 96 // Conversion from an integer index to either a slot or an ic slot.
99 // static 97 // static
100 FeedbackVectorSlot TypeFeedbackVector::ToSlot(int index) { 98 FeedbackVectorSlot TypeFeedbackVector::ToSlot(int index) {
101 DCHECK(index >= kReservedIndexCount); 99 DCHECK(index >= kReservedIndexCount);
102 return FeedbackVectorSlot(index - kReservedIndexCount); 100 return FeedbackVectorSlot(index - kReservedIndexCount);
103 } 101 }
104 102
105 103
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 int index = vector()->GetIndex(slot()) + 1; 198 int index = vector()->GetIndex(slot()) + 1;
201 vector()->set(index, feedback_extra, mode); 199 vector()->set(index, feedback_extra, mode);
202 } 200 }
203 201
204 202
205 Isolate* FeedbackNexus::GetIsolate() const { return vector()->GetIsolate(); } 203 Isolate* FeedbackNexus::GetIsolate() const { return vector()->GetIsolate(); }
206 } // namespace internal 204 } // namespace internal
207 } // namespace v8 205 } // namespace v8
208 206
209 #endif // V8_TYPE_FEEDBACK_VECTOR_INL_H_ 207 #endif // V8_TYPE_FEEDBACK_VECTOR_INL_H_
OLDNEW
« no previous file with comments | « src/type-feedback-vector.cc ('k') | test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698