Reviewers: mvstanton,
Description:
When clearing filled call target caches we should go back to the
premonomorphic state -- not the uninitialized one.
Please review this at https://codereview.chromium.org/172203002/
SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/
Affected files (+15, -21 lines):
M src/objects-inl.h
M src/objects.h
M src/objects.cc
M test/cctest/test-heap.cc
Index: src/objects-inl.h
===================================================================
--- src/objects-inl.h (revision 19457)
+++ src/objects-inl.h (working copy)
@@ -6553,17 +6553,11 @@
}
-Handle<Object> TypeFeedbackInfo::MonomorphicArraySentinel(Isolate* isolate,
- ElementsKind elements_kind) {
- return Handle<Object>(Smi::FromInt(static_cast<int>(elements_kind)),
isolate);
+Object* TypeFeedbackInfo::RawPremonomorphicSentinel(Heap* heap) {
+ return heap->null_value();
}
-Object* TypeFeedbackInfo::RawUninitializedSentinel(Heap* heap) {
- return heap->the_hole_value();
-}
-
-
int TypeFeedbackInfo::ic_total_count() {
int current = Smi::cast(READ_FIELD(this, kStorage1Offset))->value();
return ICTotalCountField::decode(current);
Index: src/objects.cc
===================================================================
--- src/objects.cc (revision 19457)
+++ src/objects.cc (working copy)
@@ -10637,12 +10637,16 @@
if (raw_info->IsTypeFeedbackInfo()) {
FixedArray* feedback_vector =
TypeFeedbackInfo::cast(raw_info)->feedback_vector();
+ Object* premonomorphic_sentinel =
+ TypeFeedbackInfo::RawPremonomorphicSentinel(heap);
for (int i = 0; i < feedback_vector->length(); i++) {
Object* obj = feedback_vector->get(i);
- if (!obj->IsAllocationSite()) {
- // TODO(mvstanton): Can't I avoid a write barrier for this
sentinel?
- feedback_vector->set(i,
-
TypeFeedbackInfo::RawUninitializedSentinel(heap));
+ // If the cache is monomorphic (non-arrays) or megamorphic we go
+ // back to premonomorphic.
+ ASSERT_EQ(*TypeFeedbackInfo::MegamorphicSentinel(heap->isolate()),
+ heap->undefined_value());
+ if (obj->IsUndefined() || obj->IsJSFunction()) {
+ feedback_vector->set(i, premonomorphic_sentinel,
SKIP_WRITE_BARRIER);
}
}
}
Index: src/objects.h
===================================================================
--- src/objects.h (revision 19457)
+++ src/objects.h (working copy)
@@ -8180,14 +8180,9 @@
// The object that indicates a megamorphic state.
static inline Handle<Object> MegamorphicSentinel(Isolate* isolate);
- // The object that indicates a monomorphic state of Array with
- // ElementsKind
- static inline Handle<Object> MonomorphicArraySentinel(Isolate* isolate,
- ElementsKind elements_kind);
-
- // A raw version of the uninitialized sentinel that's safe to read during
+ // A raw version of the premonomorphic sentinel that's safe to read
during
// garbage collection (e.g., for patching the cache).
- static inline Object* RawUninitializedSentinel(Heap* heap);
+ static inline Object* RawPremonomorphicSentinel(Heap* heap);
static const int kForInFastCaseMarker = 0;
static const int kForInSlowCaseMarker = 1;
Index: test/cctest/test-heap.cc
===================================================================
--- test/cctest/test-heap.cc (revision 19457)
+++ test/cctest/test-heap.cc (working copy)
@@ -2867,9 +2867,10 @@
SimulateIncrementalMarking();
CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
+ // Make sure we go back to the premonomorphic cache state.
CHECK_EQ(2, feedback_vector->length());
- CHECK(feedback_vector->get(0)->IsTheHole());
- CHECK(feedback_vector->get(1)->IsTheHole());
+ CHECK(feedback_vector->get(0)->IsNull());
+ CHECK(feedback_vector->get(1)->IsNull());
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.