| Index: test/cctest/test-profile-generator.cc
|
| diff --git a/test/cctest/test-profile-generator.cc b/test/cctest/test-profile-generator.cc
|
| index 71728924dbe8af5280ed2b170a099a8a6d6473f8..919c24883d4de0c694e468a073e2f3ed00cf6038 100644
|
| --- a/test/cctest/test-profile-generator.cc
|
| +++ b/test/cctest/test-profile-generator.cc
|
| @@ -29,6 +29,7 @@
|
|
|
| #include "include/v8-profiler.h"
|
| #include "src/api.h"
|
| +#include "src/debug/debug.h"
|
| #include "src/objects-inl.h"
|
| #include "src/profiler/cpu-profiler.h"
|
| #include "src/profiler/profile-generator-inl.h"
|
| @@ -697,6 +698,7 @@ TEST(LineNumber) {
|
| }
|
|
|
| TEST(BailoutReason) {
|
| + i::FLAG_allow_natives_syntax = true;
|
| v8::HandleScope scope(CcTest::isolate());
|
| v8::Local<v8::Context> env = CcTest::NewContext(PROFILER_EXTENSION);
|
| v8::Context::Scope context_scope(env);
|
| @@ -704,14 +706,21 @@ TEST(BailoutReason) {
|
| i::ProfilerExtension::set_profiler(iprofiler.get());
|
|
|
| CHECK_EQ(0, iprofiler->GetProfilesCount());
|
| - v8::Local<v8::Script> script =
|
| - v8_compile(v8_str("function Debugger() {\n"
|
| - " debugger;\n"
|
| - " startProfiling();\n"
|
| - "}\n"
|
| - "Debugger();\n"
|
| - "stopProfiling();"));
|
| - script->Run(v8::Isolate::GetCurrent()->GetCurrentContext()).ToLocalChecked();
|
| + v8::Local<v8::Function> function = CompileRun(
|
| + "function Debugger() {\n"
|
| + " startProfiling();\n"
|
| + "}"
|
| + "Debugger")
|
| + .As<v8::Function>();
|
| + i::Handle<i::JSFunction> i_function =
|
| + i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*function));
|
| + // Set a high opt count to trigger bail out.
|
| + i_function->shared()->set_opt_count(10000);
|
| +
|
| + CompileRun(
|
| + "%OptimizeFunctionOnNextCall(Debugger);"
|
| + "Debugger();"
|
| + "stopProfiling()");
|
| CHECK_EQ(1, iprofiler->GetProfilesCount());
|
| const v8::CpuProfile* profile = i::ProfilerExtension::last_profile;
|
| CHECK(profile);
|
| @@ -721,11 +730,11 @@ TEST(BailoutReason) {
|
| // The tree should look like this:
|
| // (root)
|
| // ""
|
| - // kDebuggerStatement
|
| + // kFunctionBeingDebugged
|
| current = PickChild(current, "");
|
| CHECK(const_cast<v8::CpuProfileNode*>(current));
|
|
|
| current = PickChild(current, "Debugger");
|
| CHECK(const_cast<v8::CpuProfileNode*>(current));
|
| - CHECK(!strcmp("DebuggerStatement", current->GetBailoutReason()));
|
| + CHECK(!strcmp("Deoptimized too many times", current->GetBailoutReason()));
|
| }
|
|
|