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

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

Issue 2337123003: [turbofan] Collect invocation counts and compute relative call frequencies. (Closed)
Patch Set: 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 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 #include "src/type-feedback-vector.h" 5 #include "src/type-feedback-vector.h"
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/ic/ic.h" 8 #include "src/ic/ic.h"
9 #include "src/ic/ic-state.h" 9 #include "src/ic/ic-state.h"
10 #include "src/objects.h" 10 #include "src/objects.h"
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 } 223 }
224 224
225 // static 225 // static
226 Handle<TypeFeedbackVector> TypeFeedbackVector::New( 226 Handle<TypeFeedbackVector> TypeFeedbackVector::New(
227 Isolate* isolate, Handle<TypeFeedbackMetadata> metadata) { 227 Isolate* isolate, Handle<TypeFeedbackMetadata> metadata) {
228 Factory* factory = isolate->factory(); 228 Factory* factory = isolate->factory();
229 229
230 const int slot_count = metadata->slot_count(); 230 const int slot_count = metadata->slot_count();
231 const int length = slot_count + kReservedIndexCount; 231 const int length = slot_count + kReservedIndexCount;
232 if (length == kReservedIndexCount) { 232 if (length == kReservedIndexCount) {
233 return Handle<TypeFeedbackVector>::cast(factory->empty_fixed_array()); 233 return Handle<TypeFeedbackVector>::cast(
234 factory->empty_type_feedback_vector());
234 } 235 }
235 236
236 Handle<FixedArray> array = factory->NewFixedArray(length, TENURED); 237 Handle<FixedArray> array = factory->NewFixedArray(length, TENURED);
237 array->set(kMetadataIndex, *metadata); 238 array->set(kMetadataIndex, *metadata);
239 array->set(kInvocationCountIndex, Smi::FromInt(0));
238 240
239 DisallowHeapAllocation no_gc; 241 DisallowHeapAllocation no_gc;
240 242
241 // Ensure we can skip the write barrier 243 // Ensure we can skip the write barrier
242 Handle<Object> uninitialized_sentinel = UninitializedSentinel(isolate); 244 Handle<Object> uninitialized_sentinel = UninitializedSentinel(isolate);
243 DCHECK_EQ(*factory->uninitialized_symbol(), *uninitialized_sentinel); 245 DCHECK_EQ(*factory->uninitialized_symbol(), *uninitialized_sentinel);
244 for (int i = 0; i < slot_count;) { 246 for (int i = 0; i < slot_count;) {
245 FeedbackVectorSlot slot(i); 247 FeedbackVectorSlot slot(i);
246 FeedbackVectorSlotKind kind = metadata->GetKind(slot); 248 FeedbackVectorSlotKind kind = metadata->GetKind(slot);
247 int index = TypeFeedbackVector::GetIndex(slot); 249 int index = TypeFeedbackVector::GetIndex(slot);
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 1026
1025 IcCheckType KeyedStoreICNexus::GetKeyType() const { 1027 IcCheckType KeyedStoreICNexus::GetKeyType() const {
1026 Object* feedback = GetFeedback(); 1028 Object* feedback = GetFeedback();
1027 if (feedback == *TypeFeedbackVector::MegamorphicSentinel(GetIsolate())) { 1029 if (feedback == *TypeFeedbackVector::MegamorphicSentinel(GetIsolate())) {
1028 return static_cast<IcCheckType>(Smi::cast(GetFeedbackExtra())->value()); 1030 return static_cast<IcCheckType>(Smi::cast(GetFeedbackExtra())->value());
1029 } 1031 }
1030 return IsPropertyNameFeedback(feedback) ? PROPERTY : ELEMENT; 1032 return IsPropertyNameFeedback(feedback) ? PROPERTY : ELEMENT;
1031 } 1033 }
1032 } // namespace internal 1034 } // namespace internal
1033 } // namespace v8 1035 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698