| Index: runtime/vm/flow_graph_optimizer.cc
|
| ===================================================================
|
| --- runtime/vm/flow_graph_optimizer.cc (revision 21001)
|
| +++ runtime/vm/flow_graph_optimizer.cc (working copy)
|
| @@ -21,9 +21,6 @@
|
|
|
| DEFINE_FLAG(bool, array_bounds_check_elimination, true,
|
| "Eliminate redundant bounds checks.");
|
| -// TODO(srdjan): Enable/remove flag once it works.
|
| -DEFINE_FLAG(bool, inline_getter_with_guarded_cid, false,
|
| - "Inline implict getter using guarded cid");
|
| DEFINE_FLAG(bool, load_cse, true, "Use redundant load elimination.");
|
| DEFINE_FLAG(int, max_polymorphic_checks, 4,
|
| "Maximum number of polymorphic check, otherwise it is megamorphic.");
|
| @@ -1177,6 +1174,20 @@
|
| }
|
|
|
|
|
| +void FlowGraphOptimizer::AddToGuardedFields(Field* field) {
|
| + 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 FlowGraphOptimizer::InlineImplicitInstanceGetter(InstanceCallInstr* call) {
|
| ASSERT(call->HasICData());
|
| const ICData& ic_data = *call->ic_data();
|
| @@ -1202,7 +1213,9 @@
|
| if (!field.is_nullable() || (field.guarded_cid() == kNullCid)) {
|
| load->set_result_cid(field.guarded_cid());
|
| }
|
| - load->set_field(&Field::ZoneHandle(field.raw()));
|
| + Field* the_field = &Field::ZoneHandle(field.raw());
|
| + load->set_field(the_field);
|
| + AddToGuardedFields(the_field);
|
| }
|
| load->set_field_name(String::Handle(field.name()).ToCString());
|
|
|
| @@ -1211,14 +1224,12 @@
|
| call->RemoveEnvironment();
|
| ReplaceCall(call, load);
|
|
|
| - if (FLAG_inline_getter_with_guarded_cid) {
|
| - if (load->result_cid() != kDynamicCid) {
|
| - // Reset value types if guarded_cid was used.
|
| - for (Value::Iterator it(load->input_use_list());
|
| - !it.Done();
|
| - it.Advance()) {
|
| - it.Current()->SetReachingType(NULL);
|
| - }
|
| + if (load->result_cid() != kDynamicCid) {
|
| + // Reset value types if guarded_cid was used.
|
| + for (Value::Iterator it(load->input_use_list());
|
| + !it.Done();
|
| + it.Advance()) {
|
| + it.Current()->SetReachingType(NULL);
|
| }
|
| }
|
| }
|
|
|