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

Side by Side Diff: test/cctest/test-cpu-profiler.cc

Issue 2369043002: Remove decision by Turbofan OSR to optimize on next call (Closed)
Patch Set: fix TickLinesBaseline Created 4 years, 2 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/runtime/runtime-compiler.cc ('k') | no next file » | 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 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 static void TickLines(bool optimize) { 1025 static void TickLines(bool optimize) {
1026 CcTest::InitializeVM(); 1026 CcTest::InitializeVM();
1027 LocalContext env; 1027 LocalContext env;
1028 i::FLAG_allow_natives_syntax = true; 1028 i::FLAG_allow_natives_syntax = true;
1029 i::FLAG_turbo_source_positions = true; 1029 i::FLAG_turbo_source_positions = true;
1030 i::Isolate* isolate = CcTest::i_isolate(); 1030 i::Isolate* isolate = CcTest::i_isolate();
1031 i::Factory* factory = isolate->factory(); 1031 i::Factory* factory = isolate->factory();
1032 i::HandleScope scope(isolate); 1032 i::HandleScope scope(isolate);
1033 1033
1034 i::EmbeddedVector<char, 512> script; 1034 i::EmbeddedVector<char, 512> script;
1035 i::EmbeddedVector<char, 64> optimize_call;
1035 1036
1036 const char* func_name = "func"; 1037 const char* func_name = "func";
1037 const char* opt_func = 1038 if (!optimize) {
1038 optimize ? "%OptimizeFunctionOnNextCall" : "%NeverOptimizeFunction"; 1039 i::FLAG_crankshaft = false;
rmcilroy 2016/09/27 15:27:45 Could you just do this at the start of TickLinesBa
klaasb 2016/09/27 15:54:40 Done.
1040 i::SNPrintF(optimize_call, "");
1041 } else {
1042 i::SNPrintF(optimize_call, "%%OptimizeFunctionOnNextCall(%s);\n",
1043 func_name);
1044 }
1039 i::SNPrintF(script, 1045 i::SNPrintF(script,
1040 "function %s() {\n" 1046 "function %s() {\n"
1041 " var n = 0;\n" 1047 " var n = 0;\n"
1042 " var m = 100*100;\n" 1048 " var m = 100*100;\n"
1043 " while (m > 1) {\n" 1049 " while (m > 1) {\n"
1044 " m--;\n" 1050 " m--;\n"
1045 " n += m * m * m;\n" 1051 " n += m * m * m;\n"
1046 " }\n" 1052 " }\n"
1047 "}\n" 1053 "}\n"
1048 "%s();" 1054 "%s();\n"
1049 "%s(%s);\n" 1055 "%s"
1050 "%s();\n", 1056 "%s();\n",
1051 func_name, func_name, opt_func, func_name, func_name); 1057 func_name, func_name, optimize_call.start(), func_name);
1052 1058
1053 CompileRun(script.start()); 1059 CompileRun(script.start());
1054 1060
1055 i::Handle<i::JSFunction> func = i::Handle<i::JSFunction>::cast( 1061 i::Handle<i::JSFunction> func = i::Handle<i::JSFunction>::cast(
1056 v8::Utils::OpenHandle(*GetFunction(env.local(), func_name))); 1062 v8::Utils::OpenHandle(*GetFunction(env.local(), func_name)));
1057 CHECK(func->shared()); 1063 CHECK(func->shared());
1058 CHECK(func->shared()->abstract_code()); 1064 CHECK(func->shared()->abstract_code());
1059 CHECK(!optimize || func->IsOptimized() || 1065 CHECK(!optimize || func->IsOptimized() ||
1060 !CcTest::i_isolate()->use_crankshaft()); 1066 !CcTest::i_isolate()->use_crankshaft());
1061 i::AbstractCode* code = func->abstract_code(); 1067 i::AbstractCode* code = func->abstract_code();
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
2085 iprofile->Print(); 2091 iprofile->Print();
2086 v8::CpuProfile* profile = reinterpret_cast<v8::CpuProfile*>(iprofile); 2092 v8::CpuProfile* profile = reinterpret_cast<v8::CpuProfile*>(iprofile);
2087 2093
2088 const char* branch[] = {"", "test"}; 2094 const char* branch[] = {"", "test"};
2089 const ProfileNode* itest_node = 2095 const ProfileNode* itest_node =
2090 GetSimpleBranch(env, profile, branch, arraysize(branch)); 2096 GetSimpleBranch(env, profile, branch, arraysize(branch));
2091 CHECK_EQ(0U, itest_node->deopt_infos().size()); 2097 CHECK_EQ(0U, itest_node->deopt_infos().size());
2092 2098
2093 iprofiler->DeleteProfile(iprofile); 2099 iprofiler->DeleteProfile(iprofile);
2094 } 2100 }
OLDNEW
« no previous file with comments | « src/runtime/runtime-compiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698