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

Unified Diff: runtime/vm/kernel_to_il.cc

Issue 2769313004: VM: [Kernel] Ensure that result of v.operator[]=(...) invocations is never used. (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/kernel_to_il.cc
diff --git a/runtime/vm/kernel_to_il.cc b/runtime/vm/kernel_to_il.cc
index e4204fd6539343ecb732169d47736cbaf6724221..00f8479b964b03511007cac0874c20875e379e55 100644
--- a/runtime/vm/kernel_to_il.cc
+++ b/runtime/vm/kernel_to_il.cc
@@ -4881,6 +4881,14 @@ void FlowGraphBuilder::VisitMethodInvocation(MethodInvocation* node) {
fragment_ = instructions + InstanceCall(node->position(), name, token_kind,
argument_count, argument_names,
num_args_checked);
+ // Later optimization passes assume that result of a x.[]=(...) call is not
+ // used. We must guarantee this invariant because violation will lead to an
+ // illegal IL once we replace x.[]=(...) with a sequence that does not
+ // actually produce any value. See http://dartbug.com/29135 for more details.
+ if (name.raw() == Symbols::AssignIndexToken().raw()) {
+ fragment_ += Drop();
+ fragment_ += NullConstant();
+ }
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698