OLD | NEW |
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 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 ASSERT(!use_far_branches); | 845 ASSERT(!use_far_branches); |
846 use_far_branches = true; | 846 use_far_branches = true; |
847 } else { | 847 } else { |
848 // If the error isn't due to an out of range branch offset, we don't | 848 // If the error isn't due to an out of range branch offset, we don't |
849 // try again (done = true), and indicate that we did not finish | 849 // try again (done = true), and indicate that we did not finish |
850 // compiling (is_compiled = false). | 850 // compiling (is_compiled = false). |
851 if (FLAG_trace_bailout) { | 851 if (FLAG_trace_bailout) { |
852 THR_Print("%s\n", error.ToErrorCString()); | 852 THR_Print("%s\n", error.ToErrorCString()); |
853 } | 853 } |
854 done = true; | 854 done = true; |
855 ASSERT(optimized); | |
856 } | 855 } |
857 | 856 |
858 // Clear the error if it was not a real error, but just a bailout. | 857 // Clear the error if it was not a real error, but just a bailout. |
859 if (error.IsLanguageError() && | 858 if (error.IsLanguageError() && |
860 (LanguageError::Cast(error).kind() == Report::kBailout)) { | 859 (LanguageError::Cast(error).kind() == Report::kBailout)) { |
861 isolate->object_store()->clear_sticky_error(); | 860 isolate->object_store()->clear_sticky_error(); |
862 } | 861 } |
863 is_compiled = false; | 862 is_compiled = false; |
864 } | 863 } |
865 // Reset global isolate state. | 864 // Reset global isolate state. |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 // Optimizer bailed out. Disable optimizations and never try again. | 1083 // Optimizer bailed out. Disable optimizations and never try again. |
1085 if (FLAG_trace_compiler) { | 1084 if (FLAG_trace_compiler) { |
1086 THR_Print("--> disabling optimizations for '%s'\n", | 1085 THR_Print("--> disabling optimizations for '%s'\n", |
1087 function.ToFullyQualifiedCString()); | 1086 function.ToFullyQualifiedCString()); |
1088 } else if (FLAG_trace_failed_optimization_attempts) { | 1087 } else if (FLAG_trace_failed_optimization_attempts) { |
1089 THR_Print("Cannot optimize: %s\n", | 1088 THR_Print("Cannot optimize: %s\n", |
1090 function.ToFullyQualifiedCString()); | 1089 function.ToFullyQualifiedCString()); |
1091 } | 1090 } |
1092 function.SetIsOptimizable(false); | 1091 function.SetIsOptimizable(false); |
1093 return Error::null(); | 1092 return Error::null(); |
| 1093 } else { |
| 1094 // Encountered error. |
| 1095 Error& error = Error::Handle(); |
| 1096 // We got an error during compilation. |
| 1097 error = isolate->object_store()->sticky_error(); |
| 1098 isolate->object_store()->clear_sticky_error(); |
| 1099 return error.raw(); |
1094 } | 1100 } |
1095 UNREACHABLE(); | |
1096 } | 1101 } |
1097 | 1102 |
1098 per_compile_timer.Stop(); | 1103 per_compile_timer.Stop(); |
1099 | 1104 |
1100 if (FLAG_trace_compiler) { | 1105 if (FLAG_trace_compiler) { |
1101 THR_Print("--> '%s' entry: %#" Px " size: %" Pd " time: %" Pd64 " us\n", | 1106 THR_Print("--> '%s' entry: %#" Px " size: %" Pd " time: %" Pd64 " us\n", |
1102 function.ToFullyQualifiedCString(), | 1107 function.ToFullyQualifiedCString(), |
1103 Code::Handle(function.CurrentCode()).EntryPoint(), | 1108 Code::Handle(function.CurrentCode()).EntryPoint(), |
1104 Code::Handle(function.CurrentCode()).Size(), | 1109 Code::Handle(function.CurrentCode()).Size(), |
1105 per_compile_timer.TotalElapsedTime()); | 1110 per_compile_timer.TotalElapsedTime()); |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1821 task->set_compilation_result_queue(a); | 1826 task->set_compilation_result_queue(a); |
1822 start_task = true; | 1827 start_task = true; |
1823 } | 1828 } |
1824 } | 1829 } |
1825 if (start_task) { | 1830 if (start_task) { |
1826 Dart::thread_pool()->Run(isolate->background_compiler()); | 1831 Dart::thread_pool()->Run(isolate->background_compiler()); |
1827 } | 1832 } |
1828 } | 1833 } |
1829 | 1834 |
1830 } // namespace dart | 1835 } // namespace dart |
OLD | NEW |