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

Side by Side Diff: src/compiler.cc

Issue 14978003: Improve trace_opt output to help find compilation problems (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Platform ports Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/deoptimizer-arm.cc ('k') | src/heap.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 209
210 void OptimizingCompiler::RecordOptimizationStats() { 210 void OptimizingCompiler::RecordOptimizationStats() {
211 Handle<JSFunction> function = info()->closure(); 211 Handle<JSFunction> function = info()->closure();
212 int opt_count = function->shared()->opt_count(); 212 int opt_count = function->shared()->opt_count();
213 function->shared()->set_opt_count(opt_count + 1); 213 function->shared()->set_opt_count(opt_count + 1);
214 double ms_creategraph = 214 double ms_creategraph =
215 static_cast<double>(time_taken_to_create_graph_) / 1000; 215 static_cast<double>(time_taken_to_create_graph_) / 1000;
216 double ms_optimize = static_cast<double>(time_taken_to_optimize_) / 1000; 216 double ms_optimize = static_cast<double>(time_taken_to_optimize_) / 1000;
217 double ms_codegen = static_cast<double>(time_taken_to_codegen_) / 1000; 217 double ms_codegen = static_cast<double>(time_taken_to_codegen_) / 1000;
218 if (FLAG_trace_opt) { 218 if (FLAG_trace_opt) {
219 PrintF("[optimizing: "); 219 PrintF("[optimizing ");
220 function->PrintName(); 220 function->ShortPrint();
221 PrintF(" / %" V8PRIxPTR, reinterpret_cast<intptr_t>(*function));
222 PrintF(" - took %0.3f, %0.3f, %0.3f ms]\n", ms_creategraph, ms_optimize, 221 PrintF(" - took %0.3f, %0.3f, %0.3f ms]\n", ms_creategraph, ms_optimize,
223 ms_codegen); 222 ms_codegen);
224 } 223 }
225 if (FLAG_trace_opt_stats) { 224 if (FLAG_trace_opt_stats) {
226 static double compilation_time = 0.0; 225 static double compilation_time = 0.0;
227 static int compiled_functions = 0; 226 static int compiled_functions = 0;
228 static int code_size = 0; 227 static int code_size = 0;
229 228
230 compilation_time += (ms_creategraph + ms_optimize + ms_codegen); 229 compilation_time += (ms_creategraph + ms_optimize + ms_codegen);
231 compiled_functions++; 230 compiled_functions++;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 } 307 }
309 308
310 const int locals_limit = LUnallocated::kMaxFixedSlotIndex; 309 const int locals_limit = LUnallocated::kMaxFixedSlotIndex;
311 if (!info()->osr_ast_id().IsNone() && 310 if (!info()->osr_ast_id().IsNone() &&
312 scope->num_parameters() + 1 + scope->num_stack_slots() > locals_limit) { 311 scope->num_parameters() + 1 + scope->num_stack_slots() > locals_limit) {
313 info()->set_bailout_reason("too many parameters/locals"); 312 info()->set_bailout_reason("too many parameters/locals");
314 return AbortOptimization(); 313 return AbortOptimization();
315 } 314 }
316 315
317 // Take --hydrogen-filter into account. 316 // Take --hydrogen-filter into account.
318 Handle<String> name = info()->function()->debug_name(); 317 if (!info()->closure()->PassesHydrogenFilter()) {
319 if (*FLAG_hydrogen_filter != '\0') {
320 Vector<const char> filter = CStrVector(FLAG_hydrogen_filter);
321 if ((filter[0] == '-'
322 && name->IsUtf8EqualTo(filter.SubVector(1, filter.length())))
323 || (filter[0] != '-' && !name->IsUtf8EqualTo(filter))) {
324 info()->SetCode(code); 318 info()->SetCode(code);
325 return SetLastStatus(BAILED_OUT); 319 return SetLastStatus(BAILED_OUT);
326 }
327 } 320 }
328 321
329 // Recompile the unoptimized version of the code if the current version 322 // Recompile the unoptimized version of the code if the current version
330 // doesn't have deoptimization support. Alternatively, we may decide to 323 // doesn't have deoptimization support. Alternatively, we may decide to
331 // run the full code generator to get a baseline for the compile-time 324 // run the full code generator to get a baseline for the compile-time
332 // performance of the hydrogen-based compiler. 325 // performance of the hydrogen-based compiler.
333 bool should_recompile = !info()->shared_info()->has_deoptimization_support(); 326 bool should_recompile = !info()->shared_info()->has_deoptimization_support();
334 if (should_recompile || FLAG_hydrogen_stats) { 327 if (should_recompile || FLAG_hydrogen_stats) {
335 HPhase phase(HPhase::kFullCodeGen, isolate()); 328 HPhase phase(HPhase::kFullCodeGen, isolate());
336 CompilationInfoWithZone unoptimized(info()->shared_info()); 329 CompilationInfoWithZone unoptimized(info()->shared_info());
(...skipping 16 matching lines...) Expand all
353 346
354 // Check that the unoptimized, shared code is ready for 347 // Check that the unoptimized, shared code is ready for
355 // optimizations. When using the always_opt flag we disregard the 348 // optimizations. When using the always_opt flag we disregard the
356 // optimizable marker in the code object and optimize anyway. This 349 // optimizable marker in the code object and optimize anyway. This
357 // is safe as long as the unoptimized code has deoptimization 350 // is safe as long as the unoptimized code has deoptimization
358 // support. 351 // support.
359 ASSERT(FLAG_always_opt || code->optimizable()); 352 ASSERT(FLAG_always_opt || code->optimizable());
360 ASSERT(info()->shared_info()->has_deoptimization_support()); 353 ASSERT(info()->shared_info()->has_deoptimization_support());
361 354
362 if (FLAG_trace_hydrogen) { 355 if (FLAG_trace_hydrogen) {
356 Handle<String> name = info()->function()->debug_name();
363 PrintF("-----------------------------------------------------------\n"); 357 PrintF("-----------------------------------------------------------\n");
364 PrintF("Compiling method %s using hydrogen\n", *name->ToCString()); 358 PrintF("Compiling method %s using hydrogen\n", *name->ToCString());
365 isolate()->GetHTracer()->TraceCompilation(info()); 359 isolate()->GetHTracer()->TraceCompilation(info());
366 } 360 }
367 Handle<Context> native_context( 361 Handle<Context> native_context(
368 info()->closure()->context()->native_context()); 362 info()->closure()->context()->native_context());
369 oracle_ = new(info()->zone()) TypeFeedbackOracle( 363 oracle_ = new(info()->zone()) TypeFeedbackOracle(
370 code, native_context, isolate(), info()->zone()); 364 code, native_context, isolate(), info()->zone());
371 graph_builder_ = new(info()->zone()) HOptimizedGraphBuilder(info(), oracle_); 365 graph_builder_ = new(info()->zone()) HOptimizedGraphBuilder(info(), oracle_);
372 366
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 if (FLAG_cache_optimized_code && 830 if (FLAG_cache_optimized_code &&
837 info->osr_ast_id().IsNone() && 831 info->osr_ast_id().IsNone() &&
838 info->IsOptimizing()) { 832 info->IsOptimizing()) {
839 Handle<SharedFunctionInfo> shared = info->shared_info(); 833 Handle<SharedFunctionInfo> shared = info->shared_info();
840 Handle<JSFunction> function = info->closure(); 834 Handle<JSFunction> function = info->closure();
841 ASSERT(!function.is_null()); 835 ASSERT(!function.is_null());
842 Handle<Context> native_context(function->context()->native_context()); 836 Handle<Context> native_context(function->context()->native_context());
843 int index = shared->SearchOptimizedCodeMap(*native_context); 837 int index = shared->SearchOptimizedCodeMap(*native_context);
844 if (index > 0) { 838 if (index > 0) {
845 if (FLAG_trace_opt) { 839 if (FLAG_trace_opt) {
846 PrintF("[found optimized code for: "); 840 PrintF("[found optimized code for ");
847 function->PrintName(); 841 function->ShortPrint();
848 PrintF(" / %" V8PRIxPTR "]\n", reinterpret_cast<intptr_t>(*function)); 842 PrintF("]\n");
849 } 843 }
850 // Caching of optimized code enabled and optimized code found. 844 // Caching of optimized code enabled and optimized code found.
851 shared->InstallFromOptimizedCodeMap(*function, index); 845 shared->InstallFromOptimizedCodeMap(*function, index);
852 return true; 846 return true;
853 } 847 }
854 } 848 }
855 return false; 849 return false;
856 } 850 }
857 851
858 852
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 } 1162 }
1169 } 1163 }
1170 1164
1171 GDBJIT(AddCode(Handle<String>(shared->DebugName()), 1165 GDBJIT(AddCode(Handle<String>(shared->DebugName()),
1172 Handle<Script>(info->script()), 1166 Handle<Script>(info->script()),
1173 Handle<Code>(info->code()), 1167 Handle<Code>(info->code()),
1174 info)); 1168 info));
1175 } 1169 }
1176 1170
1177 } } // namespace v8::internal 1171 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/deoptimizer-arm.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698