Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 1496713002: --collect_dynamic_function_names (default false): find unique virtual function names and use them t… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Comments Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/object_store.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_optimizer.cc
diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc
index 27843746e5d36cc22b7c4e4c5b92996915f1ace4..15642fc572354989384a57e0bbdda11ce3c1d502 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);
@@ -267,12 +269,32 @@ 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);
+ // Calls with named arguments must be resolved/checked at runtime.
+ String& error_message = String::Handle(Z);
+ if (!target_function.IsNull() &&
+ !target_function.HasOptionalNamedParameters() &&
+ target_function.AreValidArgumentCounts(call->ArgumentCount(), 0,
+ &error_message)) {
+ 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;
}
« no previous file with comments | « no previous file | runtime/vm/object_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698