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

Unified Diff: test/cctest/test-feedback-vector.cc

Issue 886663004: Revert of Use a WeakCell in the CallIC type vector. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « test/cctest/test-compiler.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-feedback-vector.cc
diff --git a/test/cctest/test-feedback-vector.cc b/test/cctest/test-feedback-vector.cc
index 9c11a498b5a693af5135f510a1e8da912295e083..439b986e42ff81a93a697ad7b6f757f56a0beeef 100644
--- a/test/cctest/test-feedback-vector.cc
+++ b/test/cctest/test-feedback-vector.cc
@@ -171,43 +171,44 @@
Handle<JSFunction> f = v8::Utils::OpenHandle(
*v8::Handle<v8::Function>::Cast(CcTest::global()->Get(v8_str("f"))));
// There should be one IC.
- Handle<Code> code = handle(f->shared()->code(), isolate);
+ Code* code = f->shared()->code();
TypeFeedbackInfo* feedback_info =
TypeFeedbackInfo::cast(code->type_feedback_info());
CHECK_EQ(1, feedback_info->ic_total_count());
CHECK_EQ(0, feedback_info->ic_with_type_info_count());
CHECK_EQ(0, feedback_info->ic_generic_count());
- Handle<TypeFeedbackVector> feedback_vector =
- handle(f->shared()->feedback_vector(), isolate);
- int ic_slot = 0;
- CallICNexus nexus(feedback_vector, FeedbackVectorICSlot(ic_slot));
+ TypeFeedbackVector* feedback_vector = f->shared()->feedback_vector();
CHECK_EQ(1, feedback_vector->ic_with_type_info_count());
CHECK_EQ(0, feedback_vector->ic_generic_count());
// Now send the information generic.
CompileRun("f(Object);");
+ feedback_vector = f->shared()->feedback_vector();
CHECK_EQ(0, feedback_vector->ic_with_type_info_count());
CHECK_EQ(1, feedback_vector->ic_generic_count());
- // A collection will not affect the site.
- heap->CollectAllGarbage(i::Heap::kNoGCFlags);
+ // A collection will make the site uninitialized again.
+ heap->CollectAllGarbage(i::Heap::kNoGCFlags);
+ feedback_vector = f->shared()->feedback_vector();
CHECK_EQ(0, feedback_vector->ic_with_type_info_count());
- CHECK_EQ(1, feedback_vector->ic_generic_count());
+ CHECK_EQ(0, feedback_vector->ic_generic_count());
// The Array function is special. A call to array remains monomorphic
// and isn't cleared by gc because an AllocationSite is being held.
- // Clear the IC manually in order to test this case.
- nexus.Clear(*code);
CompileRun("f(Array);");
+ feedback_vector = f->shared()->feedback_vector();
CHECK_EQ(1, feedback_vector->ic_with_type_info_count());
CHECK_EQ(0, feedback_vector->ic_generic_count());
-
- CHECK(nexus.GetFeedback()->IsAllocationSite());
- heap->CollectAllGarbage(i::Heap::kNoGCFlags);
+ int ic_slot = 0;
+ CHECK(
+ feedback_vector->Get(FeedbackVectorICSlot(ic_slot))->IsAllocationSite());
+ heap->CollectAllGarbage(i::Heap::kNoGCFlags);
+ feedback_vector = f->shared()->feedback_vector();
CHECK_EQ(1, feedback_vector->ic_with_type_info_count());
CHECK_EQ(0, feedback_vector->ic_generic_count());
- CHECK(nexus.GetFeedback()->IsAllocationSite());
+ CHECK(
+ feedback_vector->Get(FeedbackVectorICSlot(ic_slot))->IsAllocationSite());
}
@@ -237,16 +238,15 @@
CompileRun("f(function() { return 16; })");
CHECK_EQ(GENERIC, nexus.StateFromFeedback());
- // After a collection, state should remain GENERIC.
- heap->CollectAllGarbage(i::Heap::kNoGCFlags);
- CHECK_EQ(GENERIC, nexus.StateFromFeedback());
-
- // A call to Array is special, it contains an AllocationSite as feedback.
- // Clear the IC manually in order to test this case.
- nexus.Clear(f->shared()->code());
+ // After a collection, state should be reset to UNINITIALIZED.
+ heap->CollectAllGarbage(i::Heap::kNoGCFlags);
+ CHECK_EQ(UNINITIALIZED, nexus.StateFromFeedback());
+
+ // Array is special. It will remain monomorphic across gcs and it contains an
+ // AllocationSite.
CompileRun("f(Array)");
CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
- CHECK(nexus.GetFeedback()->IsAllocationSite());
+ CHECK(feedback_vector->Get(FeedbackVectorICSlot(slot))->IsAllocationSite());
heap->CollectAllGarbage(i::Heap::kNoGCFlags);
CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
« no previous file with comments | « test/cctest/test-compiler.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698