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

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

Issue 2122183002: [Interpreter] Collect type feedback for calls in the bytecode handler (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updated cctest.status to mark the tests fail with ignition. Created 4 years, 5 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/mjsunit/regress/regress-353551.js » ('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 69c60ca96ba7a5650dd48f4aa0e6175501c6249d..cb6e3fef393fb0439d3f788dd4c9f5a11f356893 100644
--- a/test/cctest/test-feedback-vector.cc
+++ b/test/cctest/test-feedback-vector.cc
@@ -221,15 +221,33 @@ TEST(VectorCallICStates) {
// After a collection, state should remain GENERIC.
heap->CollectAllGarbage();
CHECK_EQ(GENERIC, nexus.StateFromFeedback());
+}
+
+TEST(VectorCallFeedbackForArray) {
+ if (i::FLAG_always_opt) return;
+ CcTest::InitializeVM();
+ LocalContext context;
+ v8::HandleScope scope(context->GetIsolate());
+ Isolate* isolate = CcTest::i_isolate();
+ Heap* heap = isolate->heap();
+
+ // Make sure function f has a call that uses a type feedback slot.
+ CompileRun(
+ "function foo() { return 17; }"
+ "function f(a) { a(); } f(Array);");
+ Handle<JSFunction> f = GetFunction("f");
+ // There should be one IC.
+ Handle<TypeFeedbackVector> feedback_vector =
+ Handle<TypeFeedbackVector>(f->feedback_vector(), isolate);
+ FeedbackVectorSlot slot(0);
+ CallICNexus nexus(feedback_vector, slot);
// 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());
- CompileRun("f(Array)");
CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
CHECK(nexus.GetFeedback()->IsAllocationSite());
heap->CollectAllGarbage();
+ // It should stay monomorphic even after a GC.
CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
}
@@ -255,16 +273,27 @@ TEST(VectorCallCounts) {
CompileRun("f(foo); f(foo);");
CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
CHECK_EQ(3, nexus.ExtractCallCount());
+}
+
+TEST(VectorConstructCounts) {
+ if (i::FLAG_always_opt) return;
+ CcTest::InitializeVM();
+ LocalContext context;
+ v8::HandleScope scope(context->GetIsolate());
+ Isolate* isolate = CcTest::i_isolate();
+ // Make sure function f has a call that uses a type feedback slot.
CompileRun(
"function Foo() {}"
"function f(a) { new a(); } f(Foo);");
- f = GetFunction("f");
- // There should be one IC.
- feedback_vector = Handle<TypeFeedbackVector>(f->feedback_vector(), isolate);
- FeedbackVectorSlot cslot(1);
+ Handle<JSFunction> f = GetFunction("f");
+ Handle<TypeFeedbackVector> feedback_vector =
+ Handle<TypeFeedbackVector>(f->feedback_vector(), isolate);
+ FeedbackVectorSlot slot(0);
+ CHECK(feedback_vector->Get(slot)->IsWeakCell());
CompileRun("f(Foo); f(Foo);");
+ FeedbackVectorSlot cslot(1);
CHECK(feedback_vector->Get(cslot)->IsSmi());
CHECK_EQ(3, Smi::cast(feedback_vector->Get(cslot))->value());
}
« no previous file with comments | « test/cctest/test-compiler.cc ('k') | test/mjsunit/regress/regress-353551.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698