Index: test/cctest/test-profile-generator.cc |
diff --git a/test/cctest/test-profile-generator.cc b/test/cctest/test-profile-generator.cc |
index 412d4687c71bdc7879637568a69593b38e9118fb..2f38f02c07ca1dbdd165a13dc6f33b897a3298ce 100644 |
--- a/test/cctest/test-profile-generator.cc |
+++ b/test/cctest/test-profile-generator.cc |
@@ -697,6 +697,8 @@ TEST(LineNumber) { |
} |
TEST(BailoutReason) { |
+ i::FLAG_allow_natives_syntax = true; |
+ i::FLAG_always_opt = false; |
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())); |
} |