Skip to content

Commit fd16b58

Browse files
mkustermanncommit-bot@chromium.org
authored andcommitted
[VM] Allow intrinsification of implicit field getters in checked/strong mode
Since implicit field getters have the receiver as the only argument (on which don't have to perform any type checks), we can allow intrinsification of implicit getters even in checked/strong mode. Issue #31798 Change-Id: If08c6ee33818ab513a9dbf1457fede0eeb8c4404 Reviewed-on: https://dart-review.googlesource.com/34142 Reviewed-by: Vyacheslav Egorov <[email protected]> Commit-Queue: Vyacheslav Egorov <[email protected]>
1 parent d48e4e6 commit fd16b58

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

runtime/vm/compiler/backend/flow_graph_compiler.cc

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -984,12 +984,16 @@ void FlowGraphCompiler::FinalizeCodeSourceMap(const Code& code) {
984984

985985
// Returns 'true' if regular code generation should be skipped.
986986
bool FlowGraphCompiler::TryIntrinsify() {
987-
// Intrinsification skips arguments checks, therefore disable if in checked
988-
// mode or strong mode.
989-
if (FLAG_intrinsify && !isolate()->argument_type_checks()) {
987+
if (FLAG_intrinsify) {
990988
const Class& owner = Class::Handle(parsed_function().function().Owner());
991989
String& name = String::Handle(parsed_function().function().name());
992990

991+
// Intrinsification skips arguments checks, therefore disable if in checked
992+
// mode or strong mode.
993+
//
994+
// Though for implicit getters, which have only the receiver as parameter,
995+
// there are no checks necessary in any case and we can therefore intrinsify
996+
// them even in checked mode and strong mode.
993997
if (parsed_function().function().kind() == RawFunction::kImplicitGetter) {
994998
// TODO(27590) Store Field object inside RawFunction::data_ if possible.
995999
name = Field::NameFromGetter(name);
@@ -1004,19 +1008,21 @@ bool FlowGraphCompiler::TryIntrinsify() {
10041008
return !isolate()->use_field_guards();
10051009
}
10061010
return false;
1007-
}
1008-
if (parsed_function().function().kind() == RawFunction::kImplicitSetter) {
1009-
// TODO(27590) Store Field object inside RawFunction::data_ if possible.
1010-
name = Field::NameFromSetter(name);
1011-
const Field& field = Field::Handle(owner.LookupFieldAllowPrivate(name));
1012-
ASSERT(!field.IsNull());
1013-
1014-
if (field.is_instance() &&
1015-
(FLAG_precompiled_mode || field.guarded_cid() == kDynamicCid)) {
1016-
GenerateInlinedSetter(field.Offset());
1017-
return !isolate()->use_field_guards();
1011+
} else if (parsed_function().function().kind() ==
1012+
RawFunction::kImplicitSetter) {
1013+
if (!isolate()->argument_type_checks()) {
1014+
// TODO(27590) Store Field object inside RawFunction::data_ if possible.
1015+
name = Field::NameFromSetter(name);
1016+
const Field& field = Field::Handle(owner.LookupFieldAllowPrivate(name));
1017+
ASSERT(!field.IsNull());
1018+
1019+
if (field.is_instance() &&
1020+
(FLAG_precompiled_mode || field.guarded_cid() == kDynamicCid)) {
1021+
GenerateInlinedSetter(field.Offset());
1022+
return !isolate()->use_field_guards();
1023+
}
1024+
return false;
10181025
}
1019-
return false;
10201026
}
10211027
}
10221028

0 commit comments

Comments
 (0)