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

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

Issue 243583008: Undo r35207 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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
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/block_scheduler.h" 10 #include "vm/block_scheduler.h"
(...skipping 14 matching lines...) Expand all
25 #include "vm/il_printer.h" 25 #include "vm/il_printer.h"
26 #include "vm/longjump.h" 26 #include "vm/longjump.h"
27 #include "vm/object.h" 27 #include "vm/object.h"
28 #include "vm/object_store.h" 28 #include "vm/object_store.h"
29 #include "vm/os.h" 29 #include "vm/os.h"
30 #include "vm/parser.h" 30 #include "vm/parser.h"
31 #include "vm/scanner.h" 31 #include "vm/scanner.h"
32 #include "vm/symbols.h" 32 #include "vm/symbols.h"
33 #include "vm/tags.h" 33 #include "vm/tags.h"
34 #include "vm/timer.h" 34 #include "vm/timer.h"
35 #include "vm/trace_buffer.h"
36 35
37 namespace dart { 36 namespace dart {
38 37
39 DEFINE_FLAG(bool, allocation_sinking, true, 38 DEFINE_FLAG(bool, allocation_sinking, true,
40 "Attempt to sink temporary allocations to side exits"); 39 "Attempt to sink temporary allocations to side exits");
41 DEFINE_FLAG(bool, common_subexpression_elimination, true, 40 DEFINE_FLAG(bool, common_subexpression_elimination, true,
42 "Do common subexpression elimination."); 41 "Do common subexpression elimination.");
43 DEFINE_FLAG(bool, constant_propagation, true, 42 DEFINE_FLAG(bool, constant_propagation, true,
44 "Do conditional constant propagation/unreachable code elimination."); 43 "Do conditional constant propagation/unreachable code elimination.");
45 DEFINE_FLAG(int, deoptimization_counter_threshold, 16, 44 DEFINE_FLAG(int, deoptimization_counter_threshold, 16,
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 Object::branch_offset_error().raw()) { 597 Object::branch_offset_error().raw()) {
599 // Compilation failed due to an out of range branch offset in the 598 // Compilation failed due to an out of range branch offset in the
600 // assembler. We try again (done = false) with far branches enabled. 599 // assembler. We try again (done = false) with far branches enabled.
601 done = false; 600 done = false;
602 ASSERT(!use_far_branches); 601 ASSERT(!use_far_branches);
603 use_far_branches = true; 602 use_far_branches = true;
604 } else { 603 } else {
605 // If the error isn't due to an out of range branch offset, we don't 604 // If the error isn't due to an out of range branch offset, we don't
606 // try again (done = true), and indicate that we did not finish 605 // try again (done = true), and indicate that we did not finish
607 // compiling (is_compiled = false). 606 // compiling (is_compiled = false).
608 const Error& bailout_error = Error::Handle( 607 if (FLAG_trace_bailout) {
608 const Error& bailout_error = Error::Handle(
609 isolate->object_store()->sticky_error()); 609 isolate->object_store()->sticky_error());
610 if (FLAG_trace_bailout) {
611 OS::Print("%s\n", bailout_error.ToErrorCString()); 610 OS::Print("%s\n", bailout_error.ToErrorCString());
612 } 611 }
613 function.log()->TraceF("Failed to compile optimized code: %s",
614 bailout_error.ToErrorCString());
615 done = true; 612 done = true;
616 ASSERT(optimized); 613 ASSERT(optimized);
617 } 614 }
618 615
619 isolate->object_store()->clear_sticky_error(); 616 isolate->object_store()->clear_sticky_error();
620 is_compiled = false; 617 is_compiled = false;
621 } 618 }
622 // Reset global isolate state. 619 // Reset global isolate state.
623 isolate->set_deopt_id(prev_deopt_id); 620 isolate->set_deopt_id(prev_deopt_id);
624 } 621 }
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 if (!optimized && !unoptimized_code.IsNull()) { 760 if (!optimized && !unoptimized_code.IsNull()) {
764 InstallUnoptimizedCode(function); 761 InstallUnoptimizedCode(function);
765 return Error::null(); 762 return Error::null();
766 } 763 }
767 if (setjmp(*jump.Set()) == 0) { 764 if (setjmp(*jump.Set()) == 0) {
768 TIMERSCOPE(isolate, time_compilation); 765 TIMERSCOPE(isolate, time_compilation);
769 Timer per_compile_timer(FLAG_trace_compiler, "Compilation time"); 766 Timer per_compile_timer(FLAG_trace_compiler, "Compilation time");
770 per_compile_timer.Start(); 767 per_compile_timer.Start();
771 ParsedFunction* parsed_function = 768 ParsedFunction* parsed_function =
772 new ParsedFunction(Function::ZoneHandle(function.raw())); 769 new ParsedFunction(Function::ZoneHandle(function.raw()));
773 function.log()->TraceF("Compiled %s%s",
774 (osr_id == Isolate::kNoDeoptId ? "" : "osr "),
775 (optimized ? "optimized " : ""));
776 if (FLAG_trace_compiler) { 770 if (FLAG_trace_compiler) {
777 OS::Print("Compiling %s%sfunction: '%s' @ token %" Pd ", size %" Pd "\n", 771 OS::Print("Compiling %s%sfunction: '%s' @ token %" Pd ", size %" Pd "\n",
778 (osr_id == Isolate::kNoDeoptId ? "" : "osr "), 772 (osr_id == Isolate::kNoDeoptId ? "" : "osr "),
779 (optimized ? "optimized " : ""), 773 (optimized ? "optimized " : ""),
780 function.ToFullyQualifiedCString(), 774 function.ToFullyQualifiedCString(),
781 function.token_pos(), 775 function.token_pos(),
782 (function.end_token_pos() - function.token_pos())); 776 (function.end_token_pos() - function.token_pos()));
783 } 777 }
784 { 778 {
785 HANDLESCOPE(isolate); 779 HANDLESCOPE(isolate);
786 Parser::ParseFunction(parsed_function); 780 Parser::ParseFunction(parsed_function);
787 parsed_function->AllocateVariables(); 781 parsed_function->AllocateVariables();
788 } 782 }
789 783
790 const bool success = 784 const bool success =
791 CompileParsedFunctionHelper(parsed_function, optimized, osr_id); 785 CompileParsedFunctionHelper(parsed_function, optimized, osr_id);
792 if (optimized && !success) { 786 if (optimized && !success) {
793 // Optimizer bailed out. Disable optimizations and to never try again. 787 // Optimizer bailed out. Disable optimizations and to never try again.
794 function.log()->TraceF("Optimizations disabled");
795 if (FLAG_trace_compiler) { 788 if (FLAG_trace_compiler) {
796 OS::Print("--> disabling optimizations for '%s'\n", 789 OS::Print("--> disabling optimizations for '%s'\n",
797 function.ToFullyQualifiedCString()); 790 function.ToFullyQualifiedCString());
798 } else if (FLAG_trace_failed_optimization_attempts) { 791 } else if (FLAG_trace_failed_optimization_attempts) {
799 OS::Print("Cannot optimize: %s\n", function.ToFullyQualifiedCString()); 792 OS::Print("Cannot optimize: %s\n", function.ToFullyQualifiedCString());
800 } 793 }
801 function.SetIsOptimizable(false); 794 function.SetIsOptimizable(false);
802 return Error::null(); 795 return Error::null();
803 } 796 }
804 797
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 const Object& result = 959 const Object& result =
967 Object::Handle(isolate->object_store()->sticky_error()); 960 Object::Handle(isolate->object_store()->sticky_error());
968 isolate->object_store()->clear_sticky_error(); 961 isolate->object_store()->clear_sticky_error();
969 return result.raw(); 962 return result.raw();
970 } 963 }
971 UNREACHABLE(); 964 UNREACHABLE();
972 return Object::null(); 965 return Object::null();
973 } 966 }
974 967
975 } // namespace dart 968 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/vmservice/client/lib/src/service/object.dart ('k') | runtime/vm/deopt_instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698