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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 10825483: Add --use_cha (default true, switch to false if you use dynamic class loading). Use CHA to specify … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 months 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 | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_optimizer.cc
===================================================================
--- runtime/vm/flow_graph_optimizer.cc (revision 11101)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -4,6 +4,7 @@
#include "vm/flow_graph_optimizer.h"
+#include "vm/cha.h"
#include "vm/flow_graph_builder.h"
#include "vm/hash_map.h"
#include "vm/il_printer.h"
@@ -18,6 +19,7 @@
DECLARE_FLAG(bool, enable_type_checks);
DEFINE_FLAG(bool, trace_optimization, false, "Print optimization details.");
DECLARE_FLAG(bool, trace_type_check_elimination);
+DEFINE_FLAG(bool, use_cha, true, "Use class hierarchy analysis.");
void FlowGraphOptimizer::ApplyICData() {
VisitBlocks();
@@ -868,6 +870,7 @@
// it to the DynamicType, unless the argument is a compiler generated value,
// i.e. the receiver argument or the constructor phase argument.
AbstractType& param_type = AbstractType::Handle(Type::DynamicType());
+ param->SetPropagatedCid(kDynamicCid);
if (param->index() < 2) {
const Function& function = parsed_function().function();
if (((param->index() == 0) && function.IsDynamicFunction()) ||
@@ -875,13 +878,19 @@
// Parameter is the receiver or the constructor phase.
LocalScope* scope = parsed_function().node_sequence()->scope();
param_type = scope->VariableAt(param->index())->type().raw();
+ if (FLAG_use_cha) {
+ const intptr_t cid = Class::Handle(param_type.type_class()).id();
+ if (!CHA::HasSubclasses(cid)) {
+ // Receiver's class has no subclasses.
+ param->SetPropagatedCid(cid);
+ }
+ }
}
}
bool changed = param->SetPropagatedType(param_type);
if (changed) {
still_changing_ = true;
}
- param->SetPropagatedCid(kDynamicCid);
}
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698