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

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 build on mips 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 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); 1016 const v8::CpuProfileNode* root = profile->GetTopDownRoot();
1017 1017
1018 const v8::CpuProfileNode* start_node = GetChild(env, root, "start"); 1018 const v8::CpuProfileNode* start_node = GetChild(env, root, "start");
1019 GetChild(env, start_node, "foo"); 1019 GetChild(env, start_node, "foo");
1020 1020
1021 profile->Delete(); 1021 profile->Delete();
1022 } 1022 }
1023 1023
1024 // This tests checks distribution of the samples through the source lines. 1024 // This tests checks distribution of the samples through the source lines.
1025 static void TickLines(bool optimize) { 1025 static void TickLines(bool optimize) {
1026 if (!optimize) i::FLAG_crankshaft = false;
1026 CcTest::InitializeVM(); 1027 CcTest::InitializeVM();
1027 LocalContext env; 1028 LocalContext env;
1028 i::FLAG_allow_natives_syntax = true; 1029 i::FLAG_allow_natives_syntax = true;
1029 i::FLAG_turbo_source_positions = true; 1030 i::FLAG_turbo_source_positions = true;
1030 i::Isolate* isolate = CcTest::i_isolate(); 1031 i::Isolate* isolate = CcTest::i_isolate();
1031 i::Factory* factory = isolate->factory(); 1032 i::Factory* factory = isolate->factory();
1032 i::HandleScope scope(isolate); 1033 i::HandleScope scope(isolate);
1033 1034
1034 i::EmbeddedVector<char, 512> script; 1035 i::EmbeddedVector<char, 512> script;
1036 i::EmbeddedVector<char, 64> optimize_call;
1035 1037
1036 const char* func_name = "func"; 1038 const char* func_name = "func";
1037 const char* opt_func = 1039 if (optimize) {
1038 optimize ? "%OptimizeFunctionOnNextCall" : "%NeverOptimizeFunction"; 1040 i::SNPrintF(optimize_call, "%%OptimizeFunctionOnNextCall(%s);\n",
1041 func_name);
1042 }
1039 i::SNPrintF(script, 1043 i::SNPrintF(script,
1040 "function %s() {\n" 1044 "function %s() {\n"
1041 " var n = 0;\n" 1045 " var n = 0;\n"
1042 " var m = 100*100;\n" 1046 " var m = 100*100;\n"
1043 " while (m > 1) {\n" 1047 " while (m > 1) {\n"
1044 " m--;\n" 1048 " m--;\n"
1045 " n += m * m * m;\n" 1049 " n += m * m * m;\n"
1046 " }\n" 1050 " }\n"
1047 "}\n" 1051 "}\n"
1048 "%s();" 1052 "%s();\n"
1049 "%s(%s);\n" 1053 "%s"
1050 "%s();\n", 1054 "%s();\n",
1051 func_name, func_name, opt_func, func_name, func_name); 1055 func_name, func_name, optimize_call.start(), func_name);
1052 1056
1053 CompileRun(script.start()); 1057 CompileRun(script.start());
1054 1058
1055 i::Handle<i::JSFunction> func = i::Handle<i::JSFunction>::cast( 1059 i::Handle<i::JSFunction> func = i::Handle<i::JSFunction>::cast(
1056 v8::Utils::OpenHandle(*GetFunction(env.local(), func_name))); 1060 v8::Utils::OpenHandle(*GetFunction(env.local(), func_name)));
1057 CHECK(func->shared()); 1061 CHECK(func->shared());
1058 CHECK(func->shared()->abstract_code()); 1062 CHECK(func->shared()->abstract_code());
1059 CHECK(!optimize || func->IsOptimized() || 1063 CHECK(!optimize || func->IsOptimized() ||
1060 !CcTest::i_isolate()->use_crankshaft()); 1064 !CcTest::i_isolate()->use_crankshaft());
1061 i::AbstractCode* code = func->abstract_code(); 1065 i::AbstractCode* code = func->abstract_code();
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
2085 iprofile->Print(); 2089 iprofile->Print();
2086 v8::CpuProfile* profile = reinterpret_cast<v8::CpuProfile*>(iprofile); 2090 v8::CpuProfile* profile = reinterpret_cast<v8::CpuProfile*>(iprofile);
2087 2091
2088 const char* branch[] = {"", "test"}; 2092 const char* branch[] = {"", "test"};
2089 const ProfileNode* itest_node = 2093 const ProfileNode* itest_node =
2090 GetSimpleBranch(env, profile, branch, arraysize(branch)); 2094 GetSimpleBranch(env, profile, branch, arraysize(branch));
2091 CHECK_EQ(0U, itest_node->deopt_infos().size()); 2095 CHECK_EQ(0U, itest_node->deopt_infos().size());
2092 2096
2093 iprofiler->DeleteProfile(iprofile); 2097 iprofiler->DeleteProfile(iprofile);
2094 } 2098 }
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