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

Side by Side Diff: runtime/vm/compiler.cc

Issue 11251002: Print time when tracing compiler. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/compiler.h" 5 #include "vm/compiler.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 8
9 #include "vm/ast_printer.h" 9 #include "vm/ast_printer.h"
10 #include "vm/code_generator.h" 10 #include "vm/code_generator.h"
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 LongJump jump; 431 LongJump jump;
432 isolate->set_long_jump_base(&jump); 432 isolate->set_long_jump_base(&jump);
433 // Skips parsing if we need to only install unoptimized code. 433 // Skips parsing if we need to only install unoptimized code.
434 if (!optimized && !Code::Handle(function.unoptimized_code()).IsNull()) { 434 if (!optimized && !Code::Handle(function.unoptimized_code()).IsNull()) {
435 InstallUnoptimizedCode(function); 435 InstallUnoptimizedCode(function);
436 isolate->set_long_jump_base(base); 436 isolate->set_long_jump_base(base);
437 return Error::null(); 437 return Error::null();
438 } 438 }
439 if (setjmp(*jump.Set()) == 0) { 439 if (setjmp(*jump.Set()) == 0) {
440 TIMERSCOPE(time_compilation); 440 TIMERSCOPE(time_compilation);
441 Timer per_compile_timer(FLAG_trace_compiler, "Compilation time");
442 per_compile_timer.Start();
441 ParsedFunction* parsed_function = new ParsedFunction(function); 443 ParsedFunction* parsed_function = new ParsedFunction(function);
442 if (FLAG_trace_compiler) { 444 if (FLAG_trace_compiler) {
443 OS::Print("Compiling %sfunction: '%s' @ token %"Pd"\n", 445 OS::Print("Compiling %sfunction: '%s' @ token %"Pd"\n",
444 (optimized ? "optimized " : ""), 446 (optimized ? "optimized " : ""),
445 function.ToFullyQualifiedCString(), 447 function.ToFullyQualifiedCString(),
446 function.token_pos()); 448 function.token_pos());
447 } 449 }
448 Parser::ParseFunction(parsed_function); 450 Parser::ParseFunction(parsed_function);
449 parsed_function->AllocateVariables(); 451 parsed_function->AllocateVariables();
450 452
451 const bool success = 453 const bool success =
452 CompileParsedFunctionHelper(*parsed_function, optimized); 454 CompileParsedFunctionHelper(*parsed_function, optimized);
453 if (optimized && !success) { 455 if (optimized && !success) {
454 // Optimizer bailed out. Disable optimizations and to never try again. 456 // Optimizer bailed out. Disable optimizations and to never try again.
455 if (FLAG_trace_compiler) { 457 if (FLAG_trace_compiler) {
456 OS::Print("--> disabling optimizations for '%s'\n", 458 OS::Print("--> disabling optimizations for '%s'\n",
457 function.ToFullyQualifiedCString()); 459 function.ToFullyQualifiedCString());
458 } 460 }
459 function.set_is_optimizable(false); 461 function.set_is_optimizable(false);
460 isolate->set_long_jump_base(base); 462 isolate->set_long_jump_base(base);
461 return Error::null(); 463 return Error::null();
462 } 464 }
463 465
464 ASSERT(success); 466 ASSERT(success);
467 per_compile_timer.Stop();
465 468
466 if (FLAG_trace_compiler) { 469 if (FLAG_trace_compiler) {
467 OS::Print("--> '%s' entry: %#"Px"\n", 470 OS::Print("--> '%s' entry: %#"Px" time: %"Pd64" us\n",
468 function.ToFullyQualifiedCString(), 471 function.ToFullyQualifiedCString(),
469 Code::Handle(function.CurrentCode()).EntryPoint()); 472 Code::Handle(function.CurrentCode()).EntryPoint(),
473 per_compile_timer.TotalElapsedTime());
470 } 474 }
471 475
472 if (Isolate::Current()->debugger()->IsActive()) { 476 if (Isolate::Current()->debugger()->IsActive()) {
473 Isolate::Current()->debugger()->NotifyCompilation(function); 477 Isolate::Current()->debugger()->NotifyCompilation(function);
474 } 478 }
475 479
476 if (FLAG_disassemble) { 480 if (FLAG_disassemble) {
477 DisassembleCode(function, optimized); 481 DisassembleCode(function, optimized);
478 } else if (FLAG_disassemble_optimized && optimized) { 482 } else if (FLAG_disassemble_optimized && optimized) {
479 // TODO(fschneider): Print unoptimized code along with the optimized code. 483 // TODO(fschneider): Print unoptimized code along with the optimized code.
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 result = isolate->object_store()->sticky_error(); 609 result = isolate->object_store()->sticky_error();
606 isolate->object_store()->clear_sticky_error(); 610 isolate->object_store()->clear_sticky_error();
607 isolate->set_long_jump_base(base); 611 isolate->set_long_jump_base(base);
608 return result.raw(); 612 return result.raw();
609 } 613 }
610 UNREACHABLE(); 614 UNREACHABLE();
611 return Object::null(); 615 return Object::null();
612 } 616 }
613 617
614 } // namespace dart 618 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698