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 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 } | 695 } |
696 | 696 |
697 // Save and clear deopt id. | 697 // Save and clear deopt id. |
698 const intptr_t prev_deopt_id = thread()->deopt_id(); | 698 const intptr_t prev_deopt_id = thread()->deopt_id(); |
699 thread()->set_deopt_id(0); | 699 thread()->set_deopt_id(0); |
700 Error& error = Error::Handle(); | 700 Error& error = Error::Handle(); |
701 { | 701 { |
702 // Install bailout jump. | 702 // Install bailout jump. |
703 LongJumpScope jump; | 703 LongJumpScope jump; |
704 if (setjmp(*jump.Set()) == 0) { | 704 if (setjmp(*jump.Set()) == 0) { |
| 705 Isolate* isolate = Isolate::Current(); |
| 706 // Makes sure no classes are loaded during parsing in background. |
| 707 const intptr_t loading_invalidation_gen_at_start = |
| 708 isolate->loading_invalidation_gen(); |
705 // Parse the callee function. | 709 // Parse the callee function. |
706 bool in_cache; | 710 bool in_cache; |
707 ParsedFunction* parsed_function; | 711 ParsedFunction* parsed_function; |
708 { | 712 { |
709 CSTAT_TIMER_SCOPE(thread(), graphinliner_parse_timer); | 713 CSTAT_TIMER_SCOPE(thread(), graphinliner_parse_timer); |
710 parsed_function = GetParsedFunction(function, &in_cache); | 714 parsed_function = GetParsedFunction(function, &in_cache); |
711 } | 715 } |
712 | 716 |
| 717 if (Compiler::IsBackgroundCompilation()) { |
| 718 if (isolate->IsTopLevelParsing() || |
| 719 (loading_invalidation_gen_at_start != |
| 720 isolate->loading_invalidation_gen())) { |
| 721 // Loading occured while parsing. We need to abort here because |
| 722 // state changed while compiling. |
| 723 Compiler::AbortBackgroundCompilation(Thread::kNoDeoptId); |
| 724 } |
| 725 } |
| 726 |
713 // Load IC data for the callee. | 727 // Load IC data for the callee. |
714 ZoneGrowableArray<const ICData*>* ic_data_array = | 728 ZoneGrowableArray<const ICData*>* ic_data_array = |
715 new(Z) ZoneGrowableArray<const ICData*>(); | 729 new(Z) ZoneGrowableArray<const ICData*>(); |
716 const bool clone_ic_data = Compiler::IsBackgroundCompilation(); | 730 const bool clone_ic_data = Compiler::IsBackgroundCompilation(); |
717 function.RestoreICDataMap(ic_data_array, clone_ic_data); | 731 function.RestoreICDataMap(ic_data_array, clone_ic_data); |
718 if (Compiler::IsBackgroundCompilation() && | 732 if (Compiler::IsBackgroundCompilation() && |
719 (function.ic_data_array() == Array::null())) { | 733 (function.ic_data_array() == Array::null())) { |
720 Compiler::AbortBackgroundCompilation(Thread::kNoDeoptId); | 734 Compiler::AbortBackgroundCompilation(Thread::kNoDeoptId); |
721 } | 735 } |
722 | 736 |
(...skipping 2358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3081 return InlineDoubleOp(flow_graph, Token::kMUL, call, entry, last); | 3095 return InlineDoubleOp(flow_graph, Token::kMUL, call, entry, last); |
3082 case MethodRecognizer::kDoubleDiv: | 3096 case MethodRecognizer::kDoubleDiv: |
3083 return InlineDoubleOp(flow_graph, Token::kDIV, call, entry, last); | 3097 return InlineDoubleOp(flow_graph, Token::kDIV, call, entry, last); |
3084 default: | 3098 default: |
3085 return false; | 3099 return false; |
3086 } | 3100 } |
3087 } | 3101 } |
3088 | 3102 |
3089 | 3103 |
3090 } // namespace dart | 3104 } // namespace dart |
OLD | NEW |