Index: runtime/vm/flow_graph_inliner.cc |
diff --git a/runtime/vm/flow_graph_inliner.cc b/runtime/vm/flow_graph_inliner.cc |
index 437c684f6e4ba91b2ccb91e38598b0923c66ad56..7283257c6f275585ad2d92035cfa86050d6629b6 100644 |
--- a/runtime/vm/flow_graph_inliner.cc |
+++ b/runtime/vm/flow_graph_inliner.cc |
@@ -694,14 +694,28 @@ class CallSiteInliner : public ValueObject { |
// Install bailout jump. |
LongJumpScope jump; |
if (setjmp(*jump.Set()) == 0) { |
+ Isolate* isolate = Isolate::Current(); |
+ // Makes sure no classes are loaded during parsing in background. |
+ const uint32_t loading_invalidation_gen_at_start = |
+ isolate->loading_invalidation_gen(); |
// Parse the callee function. |
bool in_cache; |
ParsedFunction* parsed_function; |
- { |
+ { |
CSTAT_TIMER_SCOPE(thread(), graphinliner_parse_timer); |
parsed_function = GetParsedFunction(function, &in_cache); |
} |
+ if (Compiler::IsBackgroundCompilation()) { |
+ if (isolate->top_level_parsing() || |
siva
2016/03/28 17:20:14
This value is set in the mutator thread and access
srdjan
2016/03/28 19:54:54
dito
|
+ (loading_invalidation_gen_at_start != |
+ isolate->loading_invalidation_gen())) { |
+ // Loading occured while parsing. We need to abort here because |
+ // state changed while compiling. |
+ Compiler::AbortBackgroundCompilation(Thread::kNoDeoptId); |
+ } |
+ } |
+ |
// Load IC data for the callee. |
ZoneGrowableArray<const ICData*>* ic_data_array = |
new(Z) ZoneGrowableArray<const ICData*>(); |