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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 CHECK_NE(*isolate->builtins()->InterpreterEntryTrampoline(), f1->code()); 835 CHECK_NE(*isolate->builtins()->InterpreterEntryTrampoline(), f1->code());
836 CHECK_EQ(*isolate->builtins()->InterpreterEntryTrampoline(), f2->code()); 836 CHECK_EQ(*isolate->builtins()->InterpreterEntryTrampoline(), f2->code());
837 CHECK_EQ(23.0, GetGlobalProperty("result1")->Number()); 837 CHECK_EQ(23.0, GetGlobalProperty("result1")->Number());
838 838
839 // Function {f2} will self-heal now. 839 // Function {f2} will self-heal now.
840 CompileRun("var result2 = f2()"); 840 CompileRun("var result2 = f2()");
841 CHECK_NE(*isolate->builtins()->InterpreterEntryTrampoline(), f1->code()); 841 CHECK_NE(*isolate->builtins()->InterpreterEntryTrampoline(), f1->code());
842 CHECK_NE(*isolate->builtins()->InterpreterEntryTrampoline(), f2->code()); 842 CHECK_NE(*isolate->builtins()->InterpreterEntryTrampoline(), f2->code());
843 CHECK_EQ(23.0, GetGlobalProperty("result2")->Number()); 843 CHECK_EQ(23.0, GetGlobalProperty("result2")->Number());
844 } 844 }
845
846 TEST(InvocationCount) {
847 FLAG_allow_natives_syntax = true;
848 FLAG_always_opt = false;
849 CcTest::InitializeVM();
850 v8::HandleScope scope(CcTest::isolate());
851
852 CompileRun(
853 "function bar() {};"
854 "function foo() { return bar(); };"
855 "foo();");
856 Handle<JSFunction> foo = Handle<JSFunction>::cast(GetGlobalProperty("foo"));
857 CHECK_EQ(1, foo->feedback_vector()->invocation_count());
858 CompileRun("foo()");
859 CHECK_EQ(2, foo->feedback_vector()->invocation_count());
860 CompileRun("bar()");
861 CHECK_EQ(2, foo->feedback_vector()->invocation_count());
862 CompileRun("foo(); foo()");
863 CHECK_EQ(4, foo->feedback_vector()->invocation_count());
864 CompileRun("%BaselineFunctionOnNextCall(foo);");
865 CompileRun("foo();");
866 CHECK_EQ(5, foo->feedback_vector()->invocation_count());
867 }
OLDNEW
« 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