Revert "[vm/compiler] Drop redundant initializing stores of null"
This reverts commit 96b8401cfc7554e0cd65980d2dd4537605a538bc.
Reason for revert: works incorrectly because kernel-to-il emits multiple initializing stores for the same field. see language_2/field_parameter
_test
Original change's description:
> [vm/compiler] Drop redundant initializing stores of null
>
> Dart objects are allocated null-initialized so initializing stores of
> null value can be removed from the graph.
>
> Issue https://github.com/dart-lang/sdk/issues/38454
>
> Change-Id: I1ba0c3a21462ba8a3409fc648027b4ebf0b1040e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118286
> Reviewed-by: Samir Jindel <sjindel@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
TBR=vegorov@google.com,kustermann@google.com,sjindel@google.com
Change-Id: Ic0c51986168cb51316d3872514719b34cfc780cb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118289
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc
index 9c0727d..2b1152a 100644
--- a/runtime/vm/compiler/backend/il.cc
+++ b/runtime/vm/compiler/backend/il.cc
@@ -928,20 +928,6 @@
return kTagged;
}
-Instruction* StoreInstanceFieldInstr::Canonicalize(FlowGraph* flow_graph) {
- // Dart objects are allocated null-initialized, which means we can eliminate
- // all initializing stores which store null value.
- // TODO(dartbug.com/38454) Context objects can be allocated uninitialized
- // as a performance optimization (all initializing stores are inlined into
- // the caller, which allocates the context). Investigate if this can be
- // changed to align with normal Dart objects for code size reasons.
- if (is_initialization_ && slot().IsDartField() &&
- value()->BindsToConstantNull()) {
- return nullptr;
- }
- return this;
-}
-
bool GuardFieldClassInstr::AttributesEqual(Instruction* other) const {
return field().raw() == other->AsGuardFieldClass()->field().raw();
}
diff --git a/runtime/vm/compiler/backend/il.h b/runtime/vm/compiler/backend/il.h
index 404afb0..8128fb9 100644
--- a/runtime/vm/compiler/backend/il.h
+++ b/runtime/vm/compiler/backend/il.h
@@ -4679,8 +4679,6 @@
virtual Representation RequiredInputRepresentation(intptr_t index) const;
- virtual Instruction* Canonicalize(FlowGraph* flow_graph);
-
PRINT_OPERANDS_TO_SUPPORT
ADD_OPERANDS_TO_S_EXPRESSION_SUPPORT
ADD_EXTRA_INFO_TO_S_EXPRESSION_SUPPORT