Index: runtime/vm/flow_graph_compiler.cc |
diff --git a/runtime/vm/flow_graph_compiler.cc b/runtime/vm/flow_graph_compiler.cc |
index e4f461e6408809306ad2e8c3f59e579681dffaad..d8cd320a1aa7618f4b3365f362279691bc8c3a25 100644 |
--- a/runtime/vm/flow_graph_compiler.cc |
+++ b/runtime/vm/flow_graph_compiler.cc |
@@ -1135,38 +1135,36 @@ bool FlowGraphCompiler::TryIntrinsify() { |
// Intrinsification skips arguments checks, therefore disable if in checked |
// mode. |
if (FLAG_intrinsify && !isolate()->type_checks()) { |
+ const Class& owner = Class::Handle(parsed_function().function().Owner()); |
+ String& name = String::Handle(parsed_function().function().name()); |
+ |
if (parsed_function().function().kind() == RawFunction::kImplicitGetter) { |
- // An implicit getter must have a specific AST structure. |
- const SequenceNode& sequence_node = *parsed_function().node_sequence(); |
- ASSERT(sequence_node.length() == 1); |
- ASSERT(sequence_node.NodeAt(0)->IsReturnNode()); |
- const ReturnNode& return_node = *sequence_node.NodeAt(0)->AsReturnNode(); |
- ASSERT(return_node.value()->IsLoadInstanceFieldNode()); |
- const LoadInstanceFieldNode& load_node = |
- *return_node.value()->AsLoadInstanceFieldNode(); |
+ // TODO(27590) Store Field object inside RawFunction::data_ if possible. |
+ name = Field::NameFromGetter(name); |
+ const Field& field = Field::Handle(owner.LookupFieldAllowPrivate(name)); |
+ ASSERT(!field.IsNull()); |
+ |
// Only intrinsify getter if the field cannot contain a mutable double. |
// Reading from a mutable double box requires allocating a fresh double. |
- if (FLAG_precompiled_mode || |
- !IsPotentialUnboxedField(load_node.field())) { |
- GenerateInlinedGetter(load_node.field().Offset()); |
+ if (field.is_instance() && |
+ (FLAG_precompiled_mode || !IsPotentialUnboxedField(field))) { |
+ GenerateInlinedGetter(field.Offset()); |
return !FLAG_use_field_guards; |
} |
return false; |
} |
if (parsed_function().function().kind() == RawFunction::kImplicitSetter) { |
- // An implicit setter must have a specific AST structure. |
- // Sequence node has one store node and one return NULL node. |
- const SequenceNode& sequence_node = *parsed_function().node_sequence(); |
- ASSERT(sequence_node.length() == 2); |
- ASSERT(sequence_node.NodeAt(0)->IsStoreInstanceFieldNode()); |
- ASSERT(sequence_node.NodeAt(1)->IsReturnNode()); |
- const StoreInstanceFieldNode& store_node = |
- *sequence_node.NodeAt(0)->AsStoreInstanceFieldNode(); |
- if (FLAG_precompiled_mode || |
- (store_node.field().guarded_cid() == kDynamicCid)) { |
- GenerateInlinedSetter(store_node.field().Offset()); |
+ // TODO(27590) Store Field object inside RawFunction::data_ if possible. |
+ name = Field::NameFromSetter(name); |
+ const Field& field = Field::Handle(owner.LookupFieldAllowPrivate(name)); |
+ ASSERT(!field.IsNull()); |
+ |
+ if (field.is_instance() && |
+ (FLAG_precompiled_mode || field.guarded_cid() == kDynamicCid)) { |
+ GenerateInlinedSetter(field.Offset()); |
return !FLAG_use_field_guards; |
} |
+ return false; |
} |
} |