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

Unified Diff: src/type-feedback-vector.cc

Issue 2674593003: [TypeFeedbackVector] Root feedback vectors at function literal site. (Closed)
Patch Set: REBASE. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: src/type-feedback-vector.cc
diff --git a/src/type-feedback-vector.cc b/src/type-feedback-vector.cc
index c808fb9bfefa5055a2e7a9ff21ed086f55f58c2d..38367dfd79d1e88c42122e80f2f4feb62328ea80 100644
--- a/src/type-feedback-vector.cc
+++ b/src/type-feedback-vector.cc
@@ -121,6 +121,24 @@ bool TypeFeedbackMetadata::SpecDiffersFrom(
return false;
}
+bool TypeFeedbackMetadata::HasFunctionLiteralSlots() {
+ TypeFeedbackMetadataIterator iter(this);
+ Factory* factory = GetIsolate()->factory();
+ while (iter.HasNext()) {
+ FeedbackVectorSlot slot = iter.Next();
+ FeedbackVectorSlotKind kind = iter.kind();
+ switch (kind) {
+ case FeedbackVectorSlotKind::CREATE_CLOSURE: {
+ return true;
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ return false;
+}
+
bool TypeFeedbackMetadata::DiffersFrom(
const TypeFeedbackMetadata* other_metadata) const {
if (other_metadata->slot_count() != slot_count()) {
@@ -198,37 +216,36 @@ Handle<TypeFeedbackVector> TypeFeedbackVector::New(
array->set(kMetadataIndex, *metadata);
array->set(kInvocationCountIndex, Smi::kZero);
- DisallowHeapAllocation no_gc;
-
// 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);
+ Handle<Oddball> undefined_value = factory->undefined_value();
for (int i = 0; i < slot_count;) {
FeedbackVectorSlot slot(i);
FeedbackVectorSlotKind kind = metadata->GetKind(slot);
int index = TypeFeedbackVector::GetIndex(slot);
int entry_size = TypeFeedbackMetadata::GetSlotSize(kind);
- Object* value;
Object* extra_value = *uninitialized_sentinel;
switch (kind) {
case FeedbackVectorSlotKind::LOAD_GLOBAL_IC:
- value = isolate->heap()->empty_weak_cell();
+ array->set(index, isolate->heap()->empty_weak_cell(),
+ SKIP_WRITE_BARRIER);
break;
case FeedbackVectorSlotKind::INTERPRETER_COMPARE_IC:
case FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC:
- value = Smi::kZero;
+ array->set(index, Smi::kZero, SKIP_WRITE_BARRIER);
break;
- case FeedbackVectorSlotKind::CREATE_CLOSURE:
- // TODO(mvstanton): Root feedback vectors in this location.
- value = isolate->heap()->empty_type_feedback_vector();
+ case FeedbackVectorSlotKind::CREATE_CLOSURE: {
+ Handle<Cell> cell = factory->NewCell(undefined_value);
+ array->set(index, *cell);
break;
+ }
case FeedbackVectorSlotKind::LITERAL:
- value = *undefined_value;
+ array->set(index, *undefined_value, SKIP_WRITE_BARRIER);
break;
case FeedbackVectorSlotKind::CALL_IC:
- value = *uninitialized_sentinel;
+ array->set(index, *uninitialized_sentinel, SKIP_WRITE_BARRIER);
extra_value = Smi::kZero;
break;
case FeedbackVectorSlotKind::LOAD_IC:
@@ -237,16 +254,15 @@ Handle<TypeFeedbackVector> TypeFeedbackVector::New(
case FeedbackVectorSlotKind::KEYED_STORE_IC:
case FeedbackVectorSlotKind::STORE_DATA_PROPERTY_IN_LITERAL_IC:
case FeedbackVectorSlotKind::GENERAL:
- value = *uninitialized_sentinel;
+ array->set(index, *uninitialized_sentinel, SKIP_WRITE_BARRIER);
break;
case FeedbackVectorSlotKind::INVALID:
case FeedbackVectorSlotKind::KINDS_NUMBER:
UNREACHABLE();
- value = Smi::kZero;
+ array->set(index, Smi::kZero, SKIP_WRITE_BARRIER);
break;
}
- array->set(index, value, SKIP_WRITE_BARRIER);
for (int j = 1; j < entry_size; j++) {
array->set(index + j, extra_value, SKIP_WRITE_BARRIER);
}
@@ -264,14 +280,12 @@ Handle<TypeFeedbackVector> TypeFeedbackVector::Copy(
return result;
}
-
// This logic is copied from
// StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget.
static bool ClearLogic(Isolate* isolate) {
return FLAG_cleanup_code_caches_at_gc && isolate->serializer_enabled();
}
-
void TypeFeedbackVector::ClearSlotsImpl(SharedFunctionInfo* shared,
bool force_clear) {
Isolate* isolate = GetIsolate();

Powered by Google App Engine
This is Rietveld 408576698