| 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 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1329 pipeline->ParseFunction(parsed_function); | 1329 pipeline->ParseFunction(parsed_function); |
| 1330 const int64_t num_tokens_after = STAT_VALUE(thread, num_tokens_consumed); | 1330 const int64_t num_tokens_after = STAT_VALUE(thread, num_tokens_consumed); |
| 1331 INC_STAT(thread, | 1331 INC_STAT(thread, |
| 1332 num_func_tokens_compiled, | 1332 num_func_tokens_compiled, |
| 1333 num_tokens_after - num_tokens_before); | 1333 num_tokens_after - num_tokens_before); |
| 1334 } | 1334 } |
| 1335 | 1335 |
| 1336 CompileParsedFunctionHelper helper(parsed_function, optimized, osr_id); | 1336 CompileParsedFunctionHelper helper(parsed_function, optimized, osr_id); |
| 1337 const bool success = helper.Compile(pipeline); | 1337 const bool success = helper.Compile(pipeline); |
| 1338 if (!success) { | 1338 if (!success) { |
| 1339 if (optimized) { | 1339 if (optimized && !Compiler::always_optimize()) { |
| 1340 ASSERT(!Compiler::always_optimize()); // Optimized is the only code. | |
| 1341 // Optimizer bailed out. Disable optimizations and never try again. | 1340 // Optimizer bailed out. Disable optimizations and never try again. |
| 1342 if (trace_compiler) { | 1341 if (trace_compiler) { |
| 1343 THR_Print("--> disabling optimizations for '%s'\n", | 1342 THR_Print("--> disabling optimizations for '%s'\n", |
| 1344 function.ToFullyQualifiedCString()); | 1343 function.ToFullyQualifiedCString()); |
| 1345 } else if (FLAG_trace_failed_optimization_attempts) { | 1344 } else if (FLAG_trace_failed_optimization_attempts) { |
| 1346 THR_Print("Cannot optimize: %s\n", | 1345 THR_Print("Cannot optimize: %s\n", |
| 1347 function.ToFullyQualifiedCString()); | 1346 function.ToFullyQualifiedCString()); |
| 1348 } | 1347 } |
| 1349 function.SetIsOptimizable(false); | 1348 function.SetIsOptimizable(false); |
| 1350 return Error::null(); | 1349 return Error::null(); |
| 1351 } else { | 1350 } else { |
| 1352 // Encountered error. | 1351 // Encountered error. |
| 1353 Error& error = Error::Handle(); | 1352 Error& error = Error::Handle(); |
| 1354 // We got an error during compilation. | 1353 // We got an error during compilation. |
| 1355 error = isolate->object_store()->sticky_error(); | 1354 error = isolate->object_store()->sticky_error(); |
| 1356 isolate->object_store()->clear_sticky_error(); | 1355 isolate->object_store()->clear_sticky_error(); |
| 1356 ASSERT(error.IsLanguageError() && |
| 1357 LanguageError::Cast(error).kind() != Report::kBailout); |
| 1357 return error.raw(); | 1358 return error.raw(); |
| 1358 } | 1359 } |
| 1359 } | 1360 } |
| 1360 | 1361 |
| 1361 per_compile_timer.Stop(); | 1362 per_compile_timer.Stop(); |
| 1362 | 1363 |
| 1363 if (trace_compiler && success) { | 1364 if (trace_compiler && success) { |
| 1364 THR_Print("--> '%s' entry: %#" Px " size: %" Pd " time: %" Pd64 " us\n", | 1365 THR_Print("--> '%s' entry: %#" Px " size: %" Pd " time: %" Pd64 " us\n", |
| 1365 function.ToFullyQualifiedCString(), | 1366 function.ToFullyQualifiedCString(), |
| 1366 Code::Handle(function.CurrentCode()).EntryPoint(), | 1367 Code::Handle(function.CurrentCode()).EntryPoint(), |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2037 } | 2038 } |
| 2038 | 2039 |
| 2039 | 2040 |
| 2040 void BackgroundCompiler::EnsureInit(Thread* thread) { | 2041 void BackgroundCompiler::EnsureInit(Thread* thread) { |
| 2041 UNREACHABLE(); | 2042 UNREACHABLE(); |
| 2042 } | 2043 } |
| 2043 | 2044 |
| 2044 #endif // DART_PRECOMPILED | 2045 #endif // DART_PRECOMPILED |
| 2045 | 2046 |
| 2046 } // namespace dart | 2047 } // namespace dart |
| OLD | NEW |