OLD | NEW |
---|---|
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 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1714 outer_profile = NULL; | 1714 outer_profile = NULL; |
1715 CHECK_EQ(0, iprofiler->GetProfilesCount()); | 1715 CHECK_EQ(0, iprofiler->GetProfilesCount()); |
1716 } | 1716 } |
1717 | 1717 |
1718 | 1718 |
1719 const char* GetBranchDeoptReason(i::CpuProfile* iprofile, const char* branch[], | 1719 const char* GetBranchDeoptReason(i::CpuProfile* iprofile, const char* branch[], |
1720 int length) { | 1720 int length) { |
1721 v8::CpuProfile* profile = reinterpret_cast<v8::CpuProfile*>(iprofile); | 1721 v8::CpuProfile* profile = reinterpret_cast<v8::CpuProfile*>(iprofile); |
1722 const ProfileNode* iopt_function = NULL; | 1722 const ProfileNode* iopt_function = NULL; |
1723 iopt_function = GetSimpleBranch(profile, branch, length); | 1723 iopt_function = GetSimpleBranch(profile, branch, length); |
1724 CHECK_EQ(1, iopt_function->deopt_infos().size()); | 1724 CHECK_EQ(1U, iopt_function->deopt_infos().size()); |
Sven Panne
2015/04/10 13:09:28
To *really* be on the safe side, one would have to
| |
1725 return iopt_function->deopt_infos()[0].deopt_reason; | 1725 return iopt_function->deopt_infos()[0].deopt_reason; |
1726 } | 1726 } |
1727 | 1727 |
1728 | 1728 |
1729 // deopt at top function | 1729 // deopt at top function |
1730 TEST(CollectDeoptEvents) { | 1730 TEST(CollectDeoptEvents) { |
1731 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 1731 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
1732 i::FLAG_allow_natives_syntax = true; | 1732 i::FLAG_allow_natives_syntax = true; |
1733 v8::HandleScope scope(CcTest::isolate()); | 1733 v8::HandleScope scope(CcTest::isolate()); |
1734 v8::Local<v8::Context> env = CcTest::NewContext(PROFILER_EXTENSION); | 1734 v8::Local<v8::Context> env = CcTest::NewContext(PROFILER_EXTENSION); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1895 ;;; Inline point: script_id 30 position: 36. | 1895 ;;; Inline point: script_id 30 position: 36. |
1896 4 opt_function 29 #4 | 1896 4 opt_function 29 #4 |
1897 */ | 1897 */ |
1898 v8::CpuProfile* profile = reinterpret_cast<v8::CpuProfile*>(iprofile); | 1898 v8::CpuProfile* profile = reinterpret_cast<v8::CpuProfile*>(iprofile); |
1899 | 1899 |
1900 const char* branch[] = {"", "test"}; | 1900 const char* branch[] = {"", "test"}; |
1901 const ProfileNode* itest_node = | 1901 const ProfileNode* itest_node = |
1902 GetSimpleBranch(profile, branch, arraysize(branch)); | 1902 GetSimpleBranch(profile, branch, arraysize(branch)); |
1903 const std::vector<v8::CpuProfileDeoptInfo>& deopt_infos = | 1903 const std::vector<v8::CpuProfileDeoptInfo>& deopt_infos = |
1904 itest_node->deopt_infos(); | 1904 itest_node->deopt_infos(); |
1905 CHECK_EQ(1, deopt_infos.size()); | 1905 CHECK_EQ(1U, deopt_infos.size()); |
1906 | 1906 |
1907 const v8::CpuProfileDeoptInfo& info = deopt_infos[0]; | 1907 const v8::CpuProfileDeoptInfo& info = deopt_infos[0]; |
1908 CHECK_EQ(reason(i::Deoptimizer::kNotAHeapNumber), info.deopt_reason); | 1908 CHECK_EQ(reason(i::Deoptimizer::kNotAHeapNumber), info.deopt_reason); |
1909 CHECK_EQ(2, info.stack.size()); | 1909 CHECK_EQ(2U, info.stack.size()); |
1910 CHECK_EQ(inlined_script_id, info.stack[0].script_id); | 1910 CHECK_EQ(inlined_script_id, info.stack[0].script_id); |
1911 CHECK_EQ(offset(inlined_source, "left /"), info.stack[0].position); | 1911 CHECK_EQ(offset(inlined_source, "left /"), info.stack[0].position); |
1912 CHECK_EQ(script_id, info.stack[1].script_id); | 1912 CHECK_EQ(script_id, info.stack[1].script_id); |
1913 CHECK_EQ(offset(source, "opt_function(left,"), info.stack[1].position); | 1913 CHECK_EQ(offset(source, "opt_function(left,"), info.stack[1].position); |
1914 | 1914 |
1915 iprofiler->DeleteProfile(iprofile); | 1915 iprofiler->DeleteProfile(iprofile); |
1916 } | 1916 } |
1917 | 1917 |
1918 | 1918 |
1919 // deopt at the second level inlined function | 1919 // deopt at the second level inlined function |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1968 3 opt_function 29 #5 | 1968 3 opt_function 29 #5 |
1969 */ | 1969 */ |
1970 | 1970 |
1971 v8::CpuProfile* profile = reinterpret_cast<v8::CpuProfile*>(iprofile); | 1971 v8::CpuProfile* profile = reinterpret_cast<v8::CpuProfile*>(iprofile); |
1972 | 1972 |
1973 const char* branch[] = {"", "test1"}; | 1973 const char* branch[] = {"", "test1"}; |
1974 const ProfileNode* itest_node = | 1974 const ProfileNode* itest_node = |
1975 GetSimpleBranch(profile, branch, arraysize(branch)); | 1975 GetSimpleBranch(profile, branch, arraysize(branch)); |
1976 const std::vector<v8::CpuProfileDeoptInfo>& deopt_infos = | 1976 const std::vector<v8::CpuProfileDeoptInfo>& deopt_infos = |
1977 itest_node->deopt_infos(); | 1977 itest_node->deopt_infos(); |
1978 CHECK_EQ(1, deopt_infos.size()); | 1978 CHECK_EQ(1U, deopt_infos.size()); |
1979 | 1979 |
1980 const v8::CpuProfileDeoptInfo info = deopt_infos[0]; | 1980 const v8::CpuProfileDeoptInfo info = deopt_infos[0]; |
1981 CHECK_EQ(reason(i::Deoptimizer::kNotAHeapNumber), info.deopt_reason); | 1981 CHECK_EQ(reason(i::Deoptimizer::kNotAHeapNumber), info.deopt_reason); |
1982 CHECK_EQ(3, info.stack.size()); | 1982 CHECK_EQ(3U, info.stack.size()); |
1983 CHECK_EQ(inlined_script_id, info.stack[0].script_id); | 1983 CHECK_EQ(inlined_script_id, info.stack[0].script_id); |
1984 CHECK_EQ(offset(inlined_source, "left /"), info.stack[0].position); | 1984 CHECK_EQ(offset(inlined_source, "left /"), info.stack[0].position); |
1985 CHECK_EQ(script_id, info.stack[1].script_id); | 1985 CHECK_EQ(script_id, info.stack[1].script_id); |
1986 CHECK_EQ(offset(source, "opt_function(left,"), info.stack[1].position); | 1986 CHECK_EQ(offset(source, "opt_function(left,"), info.stack[1].position); |
1987 CHECK_EQ(offset(source, "test2(left, right);"), info.stack[2].position); | 1987 CHECK_EQ(offset(source, "test2(left, right);"), info.stack[2].position); |
1988 | 1988 |
1989 iprofiler->DeleteProfile(iprofile); | 1989 iprofiler->DeleteProfile(iprofile); |
1990 } | 1990 } |
1991 | 1991 |
1992 | 1992 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2024 v8::Handle<v8::Script> script = v8_compile(source); | 2024 v8::Handle<v8::Script> script = v8_compile(source); |
2025 script->Run(); | 2025 script->Run(); |
2026 | 2026 |
2027 i::CpuProfile* iprofile = iprofiler->GetProfile(0); | 2027 i::CpuProfile* iprofile = iprofiler->GetProfile(0); |
2028 iprofile->Print(); | 2028 iprofile->Print(); |
2029 v8::CpuProfile* profile = reinterpret_cast<v8::CpuProfile*>(iprofile); | 2029 v8::CpuProfile* profile = reinterpret_cast<v8::CpuProfile*>(iprofile); |
2030 | 2030 |
2031 const char* branch[] = {"", "test"}; | 2031 const char* branch[] = {"", "test"}; |
2032 const ProfileNode* itest_node = | 2032 const ProfileNode* itest_node = |
2033 GetSimpleBranch(profile, branch, arraysize(branch)); | 2033 GetSimpleBranch(profile, branch, arraysize(branch)); |
2034 CHECK_EQ(0, itest_node->deopt_infos().size()); | 2034 CHECK_EQ(0U, itest_node->deopt_infos().size()); |
2035 | 2035 |
2036 iprofiler->DeleteProfile(iprofile); | 2036 iprofiler->DeleteProfile(iprofile); |
2037 } | 2037 } |
OLD | NEW |