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

Unified Diff: test/cctest/test-compiler.cc

Issue 2337123003: [turbofan] Collect invocation counts and compute relative call frequencies. (Closed)
Patch Set: Address feedback. Created 4 years, 3 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/test-interpreter.cc ('k') | test/cctest/test-feedback-vector.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-compiler.cc
diff --git a/test/cctest/test-compiler.cc b/test/cctest/test-compiler.cc
index 88f6af2a26cb56f41ac6eb71f7a95e768265e298..bce3fb239497ec5f95d5f75820413d74ea5567c3 100644
--- a/test/cctest/test-compiler.cc
+++ b/test/cctest/test-compiler.cc
@@ -842,3 +842,26 @@ TEST(IgnitionEntryTrampolineSelfHealing) {
CHECK_NE(*isolate->builtins()->InterpreterEntryTrampoline(), f2->code());
CHECK_EQ(23.0, GetGlobalProperty("result2")->Number());
}
+
+TEST(InvocationCount) {
+ FLAG_allow_natives_syntax = true;
+ FLAG_always_opt = false;
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+
+ CompileRun(
+ "function bar() {};"
+ "function foo() { return bar(); };"
+ "foo();");
+ Handle<JSFunction> foo = Handle<JSFunction>::cast(GetGlobalProperty("foo"));
+ CHECK_EQ(1, foo->feedback_vector()->invocation_count());
+ CompileRun("foo()");
+ CHECK_EQ(2, foo->feedback_vector()->invocation_count());
+ CompileRun("bar()");
+ CHECK_EQ(2, foo->feedback_vector()->invocation_count());
+ CompileRun("foo(); foo()");
+ CHECK_EQ(4, foo->feedback_vector()->invocation_count());
+ CompileRun("%BaselineFunctionOnNextCall(foo);");
+ CompileRun("foo();");
+ CHECK_EQ(5, foo->feedback_vector()->invocation_count());
+}
« no previous file with comments | « test/cctest/interpreter/test-interpreter.cc ('k') | test/cctest/test-feedback-vector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698