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

Unified Diff: lib/compiler/implementation/ssa/optimize.dart

Issue 10910092: Improvements for checked mode: check when intializing fields, and when assigning to fields. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 | « lib/compiler/implementation/ssa/nodes.dart ('k') | pkg/pkg.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/optimize.dart
===================================================================
--- lib/compiler/implementation/ssa/optimize.dart (revision 11954)
+++ lib/compiler/implementation/ssa/optimize.dart (working copy)
@@ -627,7 +627,16 @@
Element field =
findConcreteFieldForDynamicAccess(node.receiver, node.selector);
if (field === null) return node;
- return new HFieldSet(field, node.inputs[0], node.inputs[1]);
+ HInstruction value = node.inputs[1];
+ if (compiler.enableTypeAssertions) {
+ HInstruction other = value.convertType(
+ compiler, field, HTypeConversion.CHECKED_MODE_CHECK);
+ if (other != value) {
+ node.block.addBefore(node, other);
+ value = other;
+ }
+ }
+ return new HFieldSet(field, node.inputs[0], value);
}
HInstruction visitStringConcat(HStringConcat node) {
« no previous file with comments | « lib/compiler/implementation/ssa/nodes.dart ('k') | pkg/pkg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698