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

Side by Side Diff: test/cctest/test-profile-generator.cc

Issue 2650193002: [debugger] remove debugger statement support from FCG/CS. (Closed)
Patch Set: rebase Created 3 years, 10 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 | « src/x64/macro-assembler-x64.cc ('k') | test/debugger/debug/debug-evaluate-closure.js » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 CHECK_EQ(is_lazy ? 0 : 4, 690 CHECK_EQ(is_lazy ? 0 : 4,
691 GetFunctionLineNumber(profiler, env, "lazy_func_at_forth_line")); 691 GetFunctionLineNumber(profiler, env, "lazy_func_at_forth_line"));
692 CHECK_EQ(2, GetFunctionLineNumber(profiler, env, "bar_at_the_second_line")); 692 CHECK_EQ(2, GetFunctionLineNumber(profiler, env, "bar_at_the_second_line"));
693 CHECK_EQ(is_lazy ? 0 : 6, 693 CHECK_EQ(is_lazy ? 0 : 6,
694 GetFunctionLineNumber(profiler, env, "lazy_func_at_6th_line")); 694 GetFunctionLineNumber(profiler, env, "lazy_func_at_6th_line"));
695 695
696 profiler.StopProfiling("LineNumber"); 696 profiler.StopProfiling("LineNumber");
697 } 697 }
698 698
699 TEST(BailoutReason) { 699 TEST(BailoutReason) {
700 i::FLAG_allow_natives_syntax = true;
701 i::FLAG_always_opt = false;
700 v8::HandleScope scope(CcTest::isolate()); 702 v8::HandleScope scope(CcTest::isolate());
701 v8::Local<v8::Context> env = CcTest::NewContext(PROFILER_EXTENSION); 703 v8::Local<v8::Context> env = CcTest::NewContext(PROFILER_EXTENSION);
702 v8::Context::Scope context_scope(env); 704 v8::Context::Scope context_scope(env);
703 std::unique_ptr<CpuProfiler> iprofiler(new CpuProfiler(CcTest::i_isolate())); 705 std::unique_ptr<CpuProfiler> iprofiler(new CpuProfiler(CcTest::i_isolate()));
704 i::ProfilerExtension::set_profiler(iprofiler.get()); 706 i::ProfilerExtension::set_profiler(iprofiler.get());
705 707
706 CHECK_EQ(0, iprofiler->GetProfilesCount()); 708 CHECK_EQ(0, iprofiler->GetProfilesCount());
707 v8::Local<v8::Script> script = 709 v8::Local<v8::Function> function = CompileRun(
708 v8_compile(v8_str("function Debugger() {\n" 710 "function Debugger() {\n"
709 " debugger;\n" 711 " startProfiling();\n"
710 " startProfiling();\n" 712 "}"
711 "}\n" 713 "Debugger")
712 "Debugger();\n" 714 .As<v8::Function>();
713 "stopProfiling();")); 715 i::Handle<i::JSFunction> i_function =
714 script->Run(v8::Isolate::GetCurrent()->GetCurrentContext()).ToLocalChecked(); 716 i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*function));
717 // Set a high opt count to trigger bail out.
718 i_function->shared()->set_opt_count(10000);
719
720 CompileRun(
721 "%OptimizeFunctionOnNextCall(Debugger);"
722 "Debugger();"
723 "stopProfiling()");
715 CHECK_EQ(1, iprofiler->GetProfilesCount()); 724 CHECK_EQ(1, iprofiler->GetProfilesCount());
716 const v8::CpuProfile* profile = i::ProfilerExtension::last_profile; 725 const v8::CpuProfile* profile = i::ProfilerExtension::last_profile;
717 CHECK(profile); 726 CHECK(profile);
718 const v8::CpuProfileNode* current = profile->GetTopDownRoot(); 727 const v8::CpuProfileNode* current = profile->GetTopDownRoot();
719 reinterpret_cast<ProfileNode*>( 728 reinterpret_cast<ProfileNode*>(
720 const_cast<v8::CpuProfileNode*>(current))->Print(0); 729 const_cast<v8::CpuProfileNode*>(current))->Print(0);
721 // The tree should look like this: 730 // The tree should look like this:
722 // (root) 731 // (root)
723 // "" 732 // ""
724 // kDebuggerStatement 733 // kFunctionBeingDebugged
725 current = PickChild(current, ""); 734 current = PickChild(current, "");
726 CHECK(const_cast<v8::CpuProfileNode*>(current)); 735 CHECK(const_cast<v8::CpuProfileNode*>(current));
727 736
728 current = PickChild(current, "Debugger"); 737 current = PickChild(current, "Debugger");
729 CHECK(const_cast<v8::CpuProfileNode*>(current)); 738 CHECK(const_cast<v8::CpuProfileNode*>(current));
730 CHECK(!strcmp("DebuggerStatement", current->GetBailoutReason())); 739 CHECK(!strcmp("Deoptimized too many times", current->GetBailoutReason()));
731 } 740 }
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | test/debugger/debug/debug-evaluate-closure.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698