| Index: runtime/vm/flow_graph_optimizer.cc
|
| diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc
|
| index 22ba02f3634f57a2e3e94b7bd309edfa4f08b701..23110c94931e9305a77b7e336ae26e1ab3e7b374 100644
|
| --- a/runtime/vm/flow_graph_optimizer.cc
|
| +++ b/runtime/vm/flow_graph_optimizer.cc
|
| @@ -18,6 +18,7 @@
|
| #include "vm/intermediate_language.h"
|
| #include "vm/object_store.h"
|
| #include "vm/parser.h"
|
| +#include "vm/precompiler.h"
|
| #include "vm/resolver.h"
|
| #include "vm/scopes.h"
|
| #include "vm/stack_frame.h"
|
| @@ -49,6 +50,7 @@ DEFINE_FLAG(bool, use_cha_deopt, true,
|
| DEFINE_FLAG(bool, trace_smi_widening, false, "Trace Smi->Int32 widening pass.");
|
| #endif
|
|
|
| +DECLARE_FLAG(bool, precompilation);
|
| DECLARE_FLAG(bool, polymorphic_with_deopt);
|
| DECLARE_FLAG(bool, source_lines);
|
| DECLARE_FLAG(bool, trace_cha);
|
| @@ -266,12 +268,27 @@ bool FlowGraphOptimizer::TryCreateICData(InstanceCallInstr* call) {
|
| Resolver::ResolveDynamicForReceiverClass(owner_class,
|
| call->function_name(),
|
| args_desc));
|
| - if (function.IsNull()) {
|
| - return false;
|
| + if (!function.IsNull()) {
|
| + const ICData& ic_data = ICData::ZoneHandle(Z,
|
| + ICData::NewFrom(*call->ic_data(), class_ids.length()));
|
| + ic_data.AddReceiverCheck(owner_class.id(), function);
|
| + call->set_ic_data(&ic_data);
|
| + return true;
|
| }
|
| + }
|
| + }
|
| +
|
| + if (FLAG_precompilation &&
|
| + (isolate()->object_store()->unique_dynamic_targets() != Array::null())) {
|
| + // Check if the target is unique.
|
| + Function& target_function = Function::Handle(Z);
|
| + Precompiler::GetUniqueDynamicTarget(
|
| + isolate(), call->function_name(), &target_function);
|
| + if (!target_function.IsNull()) {
|
| + const intptr_t cid = Class::Handle(Z, target_function.Owner()).id();
|
| const ICData& ic_data = ICData::ZoneHandle(Z,
|
| - ICData::NewFrom(*call->ic_data(), class_ids.length()));
|
| - ic_data.AddReceiverCheck(owner_class.id(), function);
|
| + ICData::NewFrom(*call->ic_data(), 1));
|
| + ic_data.AddReceiverCheck(cid, target_function);
|
| call->set_ic_data(&ic_data);
|
| return true;
|
| }
|
|
|