| Index: runtime/vm/compiler.cc
|
| diff --git a/runtime/vm/compiler.cc b/runtime/vm/compiler.cc
|
| index bbf1430aa12cf3eccf45bf1e1a984ac7ba9e40a2..17fa6f7973f0cc52a2412bb74278a45c7f1bd9b5 100644
|
| --- a/runtime/vm/compiler.cc
|
| +++ b/runtime/vm/compiler.cc
|
| @@ -795,20 +795,23 @@ static bool CompileParsedFunctionHelper(CompilationPipeline* pipeline,
|
| function.InstallOptimizedCode(code, is_osr);
|
| }
|
|
|
| - // TODO(srdjan): In background compilation, verify that CHA has not
|
| - // been invalidated in the meantime.
|
| - // Register code with the classes it depends on because of CHA.
|
| - for (intptr_t i = 0;
|
| - i < thread->cha()->leaf_classes().length();
|
| - ++i) {
|
| - thread->cha()->leaf_classes()[i]->RegisterCHACode(code);
|
| - }
|
| -
|
| - for (intptr_t i = 0;
|
| - i < flow_graph->guarded_fields()->length();
|
| - i++) {
|
| - const Field* field = (*flow_graph->guarded_fields())[i];
|
| - field->RegisterDependentCode(code);
|
| + // TODO(srdjan): In background compilation, verify that CHA and field
|
| + // guards have not been invalidated in the meantime.
|
| + // Register code with the classes it depends on because of CHA and
|
| + // fields it depends on because of store guards, unless we cannot
|
| + // deopt.
|
| + if (Compiler::allow_recompilation()) {
|
| + for (intptr_t i = 0;
|
| + i < thread->cha()->leaf_classes().length();
|
| + ++i) {
|
| + thread->cha()->leaf_classes()[i]->RegisterCHACode(code);
|
| + }
|
| + for (intptr_t i = 0;
|
| + i < flow_graph->guarded_fields()->length();
|
| + i++) {
|
| + const Field* field = (*flow_graph->guarded_fields())[i];
|
| + field->RegisterDependentCode(code);
|
| + }
|
| }
|
| } else { // not optimized.
|
| if (!Compiler::always_optimize() &&
|
|
|