Chromium Code Reviews| Index: src/type-feedback-vector.cc |
| diff --git a/src/type-feedback-vector.cc b/src/type-feedback-vector.cc |
| index 546139e481e63a154198592c084029b3dcf3bbd9..fcb1787411b063955c77b46f3a5092ffdd39aacb 100644 |
| --- a/src/type-feedback-vector.cc |
| +++ b/src/type-feedback-vector.cc |
| @@ -164,6 +164,8 @@ const char* TypeFeedbackMetadata::Kind2String(FeedbackVectorSlotKind kind) { |
| return "STORE_DATA_PROPERTY_IN_LITERAL_IC"; |
| case FeedbackVectorSlotKind::CREATE_CLOSURE: |
| return "CREATE_CLOSURE"; |
| + case FeedbackVectorSlotKind::LITERAL: |
| + return "LITERAL"; |
| case FeedbackVectorSlotKind::GENERAL: |
| return "STUB"; |
| case FeedbackVectorSlotKind::KINDS_NUMBER: |
| @@ -202,8 +204,9 @@ Handle<TypeFeedbackVector> TypeFeedbackVector::New( |
| int entry_size = TypeFeedbackMetadata::GetSlotSize(kind); |
| if (kind == FeedbackVectorSlotKind::CREATE_CLOSURE) { |
| - // TODO(mvstanton): Root literal arrays in this location. |
| - array->set(index, *factory->empty_literals_array(), SKIP_WRITE_BARRIER); |
| + // TODO(mvstanton): Root feedback vectors in this location. |
| + array->set(index, *factory->empty_type_feedback_vector(), |
| + SKIP_WRITE_BARRIER); |
| } |
| i += entry_size; |
| } |
| @@ -212,6 +215,7 @@ Handle<TypeFeedbackVector> TypeFeedbackVector::New( |
| // Ensure we can skip the write barrier |
| Handle<Object> uninitialized_sentinel = UninitializedSentinel(isolate); |
| + Handle<Oddball> undefined_value = factory->undefined_value(); |
| DCHECK_EQ(isolate->heap()->uninitialized_symbol(), *uninitialized_sentinel); |
| for (int i = 0; i < slot_count;) { |
| FeedbackVectorSlot slot(i); |
| @@ -225,6 +229,8 @@ Handle<TypeFeedbackVector> TypeFeedbackVector::New( |
| } else if (kind == FeedbackVectorSlotKind::INTERPRETER_COMPARE_IC || |
| kind == FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC) { |
| value = Smi::kZero; |
| + } else if (kind == FeedbackVectorSlotKind::LITERAL) { |
| + value = *undefined_value; |
|
Benedikt Meurer
2017/01/30 05:34:05
We should unify this to also use uninitialized_sen
mvstanton
2017/01/30 10:56:41
Yep, excellent idea - I will follow up with that.
|
| } else { |
| value = *uninitialized_sentinel; |
| } |
| @@ -242,14 +248,6 @@ Handle<TypeFeedbackVector> TypeFeedbackVector::New( |
| return Handle<TypeFeedbackVector>::cast(array); |
| } |
| - |
| -// static |
| -int TypeFeedbackVector::GetIndexFromSpec(const FeedbackVectorSpec* spec, |
| - FeedbackVectorSlot slot) { |
| - return kReservedIndexCount + slot.ToInt(); |
| -} |
| - |
| - |
| // static |
| Handle<TypeFeedbackVector> TypeFeedbackVector::Copy( |
| Isolate* isolate, Handle<TypeFeedbackVector> vector) { |
| @@ -276,6 +274,7 @@ void TypeFeedbackVector::ClearSlotsImpl(SharedFunctionInfo* shared, |
| Object* uninitialized_sentinel = |
| TypeFeedbackVector::RawUninitializedSentinel(isolate); |
| + Oddball* undefined_value = isolate->heap()->undefined_value(); |
| TypeFeedbackMetadataIterator iter(metadata()); |
| while (iter.HasNext()) { |
| @@ -323,11 +322,6 @@ void TypeFeedbackVector::ClearSlotsImpl(SharedFunctionInfo* shared, |
| break; |
| } |
| case FeedbackVectorSlotKind::CREATE_CLOSURE: { |
| - // Fill the array with undefined. |
| - FixedArray* array = FixedArray::cast(Get(slot)); |
| - for (int i = 1; i < array->length(); i++) { |
| - array->set_undefined(i); |
| - } |
| break; |
| } |
| case FeedbackVectorSlotKind::GENERAL: { |
| @@ -343,6 +337,10 @@ void TypeFeedbackVector::ClearSlotsImpl(SharedFunctionInfo* shared, |
| } |
| break; |
| } |
| + case FeedbackVectorSlotKind::LITERAL: { |
| + Set(slot, undefined_value, SKIP_WRITE_BARRIER); |
| + break; |
| + } |
| case FeedbackVectorSlotKind::STORE_DATA_PROPERTY_IN_LITERAL_IC: { |
| StoreDataPropertyInLiteralICNexus nexus(this, slot); |
| nexus.Clear(shared->code()); |