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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/optimize.dart

Issue 16191004: Fix bug in SsaConstructionFieldTypes where the phase got confused seeing multiple HForeignNew due t… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/language/field_inference_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of ssa; 5 part of ssa;
6 6
7 abstract class OptimizationPhase { 7 abstract class OptimizationPhase {
8 String get name; 8 String get name;
9 void visitGraph(HGraph graph); 9 void visitGraph(HGraph graph);
10 } 10 }
(...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 // Collect all users of this in a set to make the this exposed check simple 1430 // Collect all users of this in a set to make the this exposed check simple
1431 // and cheap. 1431 // and cheap.
1432 thisUsers.addAll(instruction.usedBy); 1432 thisUsers.addAll(instruction.usedBy);
1433 } 1433 }
1434 1434
1435 visitFieldGet(HInstruction _) { 1435 visitFieldGet(HInstruction _) {
1436 // The field get instruction is allowed to use this. 1436 // The field get instruction is allowed to use this.
1437 } 1437 }
1438 1438
1439 visitForeignNew(HForeignNew node) { 1439 visitForeignNew(HForeignNew node) {
1440 if (!work.element.isGenerativeConstructor()) return;
1441 // Check if this is the new object allocated by this generative
1442 // constructor. Inlining might add other [HForeignNew]
1443 // instructions in the graph.
1444 if (!node.usedBy.any((user) => user is HReturn)) return;
1440 // The HForeignNew instruction is used in the generative constructor to 1445 // The HForeignNew instruction is used in the generative constructor to
1441 // initialize all fields in newly created objects. The fields are 1446 // initialize all fields in newly created objects. The fields are
1442 // initialized to the value present in the initializer list or set to null 1447 // initialized to the value present in the initializer list or set to null
1443 // if not otherwise initialized. 1448 // if not otherwise initialized.
1444 // Here we handle members in superclasses as well, as the handling of 1449 // Here we handle members in superclasses as well, as the handling of
1445 // the generative constructor bodies will ensure, that the initializer 1450 // the generative constructor bodies will ensure, that the initializer
1446 // type will not be used if the field is in any of these. 1451 // type will not be used if the field is in any of these.
1447 int j = 0; 1452 int j = 0;
1448 node.element.forEachInstanceField( 1453 node.element.forEachInstanceField(
1449 (ClassElement enclosingClass, Element element) { 1454 (ClassElement enclosingClass, Element element) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 } 1486 }
1482 1487
1483 // For other fields having setters in the generative constructor body, set 1488 // For other fields having setters in the generative constructor body, set
1484 // the type to UNKNOWN to avoid relying on the type set in the initializer 1489 // the type to UNKNOWN to avoid relying on the type set in the initializer
1485 // list. 1490 // list.
1486 allSetters.forEach((Element element) { 1491 allSetters.forEach((Element element) {
1487 backend.registerFieldConstructor(element, HType.UNKNOWN); 1492 backend.registerFieldConstructor(element, HType.UNKNOWN);
1488 }); 1493 });
1489 } 1494 }
1490 } 1495 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/field_inference_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698