OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/flow_graph_inliner.h" | 5 #include "vm/flow_graph_inliner.h" |
6 | 6 |
7 #include "vm/aot_optimizer.h" | 7 #include "vm/aot_optimizer.h" |
8 #include "vm/block_scheduler.h" | 8 #include "vm/block_scheduler.h" |
9 #include "vm/branch_optimizer.h" | 9 #include "vm/branch_optimizer.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 inliner_->NextInlineId(callee_graph->function(), | 954 inliner_->NextInlineId(callee_graph->function(), |
955 call_data->call->token_pos(), | 955 call_data->call->token_pos(), |
956 call_data->caller_inlining_id_)); | 956 call_data->caller_inlining_id_)); |
957 TRACE_INLINING(THR_Print(" Success\n")); | 957 TRACE_INLINING(THR_Print(" Success\n")); |
958 PRINT_INLINING_TREE(NULL, | 958 PRINT_INLINING_TREE(NULL, |
959 &call_data->caller, &function, call); | 959 &call_data->caller, &function, call); |
960 return true; | 960 return true; |
961 } else { | 961 } else { |
962 error = thread()->sticky_error(); | 962 error = thread()->sticky_error(); |
963 thread()->clear_sticky_error(); | 963 thread()->clear_sticky_error(); |
964 ASSERT(error.IsLanguageError()); | |
965 | 964 |
966 if (LanguageError::Cast(error).kind() == Report::kBailout) { | 965 if (error.IsLanguageError() && |
| 966 (LanguageError::Cast(error).kind() == Report::kBailout)) { |
967 if (error.raw() == Object::background_compilation_error().raw()) { | 967 if (error.raw() == Object::background_compilation_error().raw()) { |
968 // Fall through to exit the compilation, and retry it later. | 968 // Fall through to exit the compilation, and retry it later. |
969 } else { | 969 } else { |
970 thread()->set_deopt_id(prev_deopt_id); | 970 thread()->set_deopt_id(prev_deopt_id); |
971 TRACE_INLINING(THR_Print(" Bailout: %s\n", | 971 TRACE_INLINING(THR_Print(" Bailout: %s\n", |
972 error.ToErrorCString())); | 972 error.ToErrorCString())); |
973 PRINT_INLINING_TREE("Bailout", | 973 PRINT_INLINING_TREE("Bailout", |
974 &call_data->caller, &function, call); | 974 &call_data->caller, &function, call); |
975 return false; | 975 return false; |
976 } | 976 } |
977 } else { | 977 } else { |
978 // Fall through to exit long jump scope. | 978 // Fall through to exit long jump scope. |
979 ASSERT(FLAG_precompiled_mode); | |
980 } | 979 } |
981 } | 980 } |
982 } | 981 } |
983 | 982 |
984 // Propagate a compile-time error. In precompilation we attempt to | 983 // Propagate a compile-time error. In precompilation we attempt to |
985 // inline functions that have never been compiled before; when JITing we | 984 // inline functions that have never been compiled before; when JITing we |
986 // should only see compile-time errors in unoptimized compilation. | 985 // should only see language errors in unoptimized compilation. |
| 986 // Otherwise, there can be an out-of-memory error (unhandled exception). |
987 // In background compilation we may abort compilation as the state | 987 // In background compilation we may abort compilation as the state |
988 // changes while compiling. Propagate that 'error' and retry compilation | 988 // changes while compiling. Propagate that 'error' and retry compilation |
989 // later. | 989 // later. |
990 ASSERT(FLAG_precompiled_mode || Compiler::IsBackgroundCompilation()); | 990 ASSERT(FLAG_precompiled_mode || |
| 991 Compiler::IsBackgroundCompilation() || |
| 992 error.IsUnhandledException()); |
991 Thread::Current()->long_jump_base()->Jump(1, error); | 993 Thread::Current()->long_jump_base()->Jump(1, error); |
992 UNREACHABLE(); | 994 UNREACHABLE(); |
993 return false; | 995 return false; |
994 } | 996 } |
995 | 997 |
996 void PrintInlinedInfo(const Function& top) { | 998 void PrintInlinedInfo(const Function& top) { |
997 if (inlined_info_.length() > 0) { | 999 if (inlined_info_.length() > 0) { |
998 THR_Print("Inlining into: '%s' growth: %f (%" Pd " -> %" Pd ")\n", | 1000 THR_Print("Inlining into: '%s' growth: %f (%" Pd " -> %" Pd ")\n", |
999 top.ToFullyQualifiedCString(), | 1001 top.ToFullyQualifiedCString(), |
1000 GrowthFactor(), | 1002 GrowthFactor(), |
(...skipping 2781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3782 return true; | 3784 return true; |
3783 } | 3785 } |
3784 | 3786 |
3785 default: | 3787 default: |
3786 return false; | 3788 return false; |
3787 } | 3789 } |
3788 } | 3790 } |
3789 | 3791 |
3790 | 3792 |
3791 } // namespace dart | 3793 } // namespace dart |
OLD | NEW |