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

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

Issue 2650193002: [debugger] remove debugger statement support from FCG/CS. (Closed)
Patch Set: Created 3 years, 11 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
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 11 matching lines...) Expand all
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 // 27 //
28 // Tests of profiles generator and utilities. 28 // Tests of profiles generator and utilities.
29 29
30 #include "include/v8-profiler.h" 30 #include "include/v8-profiler.h"
31 #include "src/api.h" 31 #include "src/api.h"
32 #include "src/debug/debug.h"
32 #include "src/objects-inl.h" 33 #include "src/objects-inl.h"
33 #include "src/profiler/cpu-profiler.h" 34 #include "src/profiler/cpu-profiler.h"
34 #include "src/profiler/profile-generator-inl.h" 35 #include "src/profiler/profile-generator-inl.h"
35 #include "src/v8.h" 36 #include "src/v8.h"
36 #include "test/cctest/cctest.h" 37 #include "test/cctest/cctest.h"
37 #include "test/cctest/profiler-extension.h" 38 #include "test/cctest/profiler-extension.h"
38 39
39 using i::CodeEntry; 40 using i::CodeEntry;
40 using i::CodeMap; 41 using i::CodeMap;
41 using i::CpuProfile; 42 using i::CpuProfile;
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 CHECK_EQ(is_lazy ? 0 : 4, 691 CHECK_EQ(is_lazy ? 0 : 4,
691 GetFunctionLineNumber(profiler, env, "lazy_func_at_forth_line")); 692 GetFunctionLineNumber(profiler, env, "lazy_func_at_forth_line"));
692 CHECK_EQ(2, GetFunctionLineNumber(profiler, env, "bar_at_the_second_line")); 693 CHECK_EQ(2, GetFunctionLineNumber(profiler, env, "bar_at_the_second_line"));
693 CHECK_EQ(is_lazy ? 0 : 6, 694 CHECK_EQ(is_lazy ? 0 : 6,
694 GetFunctionLineNumber(profiler, env, "lazy_func_at_6th_line")); 695 GetFunctionLineNumber(profiler, env, "lazy_func_at_6th_line"));
695 696
696 profiler.StopProfiling("LineNumber"); 697 profiler.StopProfiling("LineNumber");
697 } 698 }
698 699
699 TEST(BailoutReason) { 700 TEST(BailoutReason) {
701 i::FLAG_allow_natives_syntax = true;
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
« src/full-codegen/full-codegen.cc ('K') | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698