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

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

Issue 1969783002: Collect call counts for constructor calls, too. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed cctest.status, and addressed mips64 comment. Created 4 years, 7 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/interpreter/bytecode_expectations/CallNew.golden ('k') | no next file » | 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 c06e5b9124a3e387e2c160846ed370f22637fbc0..51897f557626132d649a9963c47e70a8846d47c5 100644
--- a/test/cctest/test-feedback-vector.cc
+++ b/test/cctest/test-feedback-vector.cc
@@ -233,6 +233,42 @@ TEST(VectorCallICStates) {
CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
}
+TEST(VectorCallCounts) {
+ 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() { return 17; }"
+ "function f(a) { a(); } f(foo);");
+ Handle<JSFunction> f = GetFunction("f");
+ // There should be one IC.
+ Handle<TypeFeedbackVector> feedback_vector =
+ Handle<TypeFeedbackVector>(f->shared()->feedback_vector(), isolate);
+ FeedbackVectorSlot slot(0);
+ CallICNexus nexus(feedback_vector, slot);
+ CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+
+ CompileRun("f(foo); f(foo);");
+ CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(3, nexus.ExtractCallCount());
+
+ CompileRun(
+ "function Foo() {}"
+ "function f(a) { new a(); } f(Foo);");
+ f = GetFunction("f");
+ // There should be one IC.
+ feedback_vector =
+ Handle<TypeFeedbackVector>(f->shared()->feedback_vector(), isolate);
+ FeedbackVectorSlot cslot(1);
+
+ CompileRun("f(Foo); f(Foo);");
+ CHECK(feedback_vector->Get(cslot)->IsSmi());
+ CHECK_EQ(3, Smi::cast(feedback_vector->Get(cslot))->value());
+}
TEST(VectorLoadICStates) {
if (i::FLAG_always_opt) return;
« no previous file with comments | « test/cctest/interpreter/bytecode_expectations/CallNew.golden ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698