diff options
Diffstat (limited to 'deps/v8/test/cctest/test-compiler.cc')
-rw-r--r-- | deps/v8/test/cctest/test-compiler.cc | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/deps/v8/test/cctest/test-compiler.cc b/deps/v8/test/cctest/test-compiler.cc index aef10f1f7a..bce3fb2394 100644 --- a/deps/v8/test/cctest/test-compiler.cc +++ b/deps/v8/test/cctest/test-compiler.cc @@ -30,10 +30,11 @@ #include "src/v8.h" +#include "src/api.h" #include "src/compiler.h" #include "src/disasm.h" +#include "src/factory.h" #include "src/interpreter/interpreter.h" -#include "src/parsing/parser.h" #include "test/cctest/cctest.h" using namespace v8::internal; @@ -841,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()); +} |