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

Unified Diff: runtime/vm/flow_graph_builder.cc

Issue 24315002: Reland: Fix bug in field type tracking and polymorphic inlining. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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/flow_graph_builder.h ('k') | runtime/vm/flow_graph_inliner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_builder.cc
===================================================================
--- runtime/vm/flow_graph_builder.cc (revision 27690)
+++ runtime/vm/flow_graph_builder.cc (working copy)
@@ -45,6 +45,7 @@
FlowGraphBuilder::FlowGraphBuilder(ParsedFunction* parsed_function,
const Array& ic_data_array,
InlineExitCollector* exit_collector,
+ GrowableArray<const Field*>* guarded_fields,
intptr_t osr_id)
: parsed_function_(parsed_function),
ic_data_array_(ic_data_array),
@@ -55,6 +56,7 @@
: 0),
num_stack_locals_(parsed_function->num_stack_locals()),
exit_collector_(exit_collector),
+ guarded_fields_(guarded_fields),
last_used_block_id_(0), // 0 is used for the graph entry.
context_level_(0),
try_index_(CatchClauseNode::kInvalidTryIndex),
@@ -70,6 +72,20 @@
}
+void FlowGraphBuilder::AddToGuardedFields(const Field& field) const {
+ if ((field.guarded_cid() == kDynamicCid) ||
+ (field.guarded_cid() == kIllegalCid)) {
+ return;
+ }
+ for (intptr_t j = 0; j < guarded_fields_->length(); j++) {
+ if ((*guarded_fields_)[j]->raw() == field.raw()) {
+ return;
+ }
+ }
+ guarded_fields_->Add(&field);
+}
+
+
void InlineExitCollector::PrepareGraphs(FlowGraph* callee_graph) {
ASSERT(callee_graph->graph_entry()->SuccessorCount() == 1);
ASSERT(callee_graph->max_block_id() > caller_graph_->max_block_id());
@@ -3039,6 +3055,17 @@
node->field().Offset(),
AbstractType::ZoneHandle(node->field().type()));
load->set_field(&node->field());
+ if (owner()->exit_collector() != NULL) {
+ // While inlining into an optimized function, the field has
+ // to be added to the list of guarded fields of the caller.
+ if (node->field().guarded_cid() != kIllegalCid) {
+ if (!node->field().is_nullable() ||
+ (node->field().guarded_cid() == kNullCid)) {
+ load->set_result_cid(node->field().guarded_cid());
+ }
+ owner()->AddToGuardedFields(node->field());
+ }
+ }
ReturnDefinition(load);
}
« no previous file with comments | « runtime/vm/flow_graph_builder.h ('k') | runtime/vm/flow_graph_inliner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698