| OLD | NEW |
| 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 abstract class OptimizationPhase { | 5 abstract class OptimizationPhase { |
| 6 String get name; | 6 String get name; |
| 7 void visitGraph(HGraph graph); | 7 void visitGraph(HGraph graph); |
| 8 } | 8 } |
| 9 | 9 |
| 10 class SsaOptimizerTask extends CompilerTask { | 10 class SsaOptimizerTask extends CompilerTask { |
| (...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 visitForeignNew(HForeignNew node) { | 1295 visitForeignNew(HForeignNew node) { |
| 1296 // The HForeignNew instruction is used in the generative constructor to | 1296 // The HForeignNew instruction is used in the generative constructor to |
| 1297 // initialize all fields in newly created objects. The fields are | 1297 // initialize all fields in newly created objects. The fields are |
| 1298 // initialized to the value present in the initializer list or set to null | 1298 // initialized to the value present in the initializer list or set to null |
| 1299 // if not otherwise initialized. | 1299 // if not otherwise initialized. |
| 1300 // Here we handle members in superclasses as well, as the handling of | 1300 // Here we handle members in superclasses as well, as the handling of |
| 1301 // the generative constructor bodies will ensure, that the initializer | 1301 // the generative constructor bodies will ensure, that the initializer |
| 1302 // type will not be used if the field is in any of these. | 1302 // type will not be used if the field is in any of these. |
| 1303 int j = 0; | 1303 int j = 0; |
| 1304 node.element.forEachInstanceField( | 1304 node.element.forEachInstanceField( |
| 1305 includeBackendMembers: false, | 1305 (ClassElement enclosingClass, Element element) { |
| 1306 includeSuperMembers: true, | 1306 backend.registerFieldInitializer(element, types[node.inputs[j]]); |
| 1307 f: (ClassElement enclosingClass, Element element) { | 1307 j++; |
| 1308 backend.registerFieldInitializer(element, types[node.inputs[j]]); | 1308 }, |
| 1309 j++; | 1309 includeBackendMembers: false, |
| 1310 }); | 1310 includeSuperMembers: true); |
| 1311 } | 1311 } |
| 1312 | 1312 |
| 1313 visitFieldSet(HFieldSet node) { | 1313 visitFieldSet(HFieldSet node) { |
| 1314 Element field = node.element; | 1314 Element field = node.element; |
| 1315 HInstruction value = node.value; | 1315 HInstruction value = node.value; |
| 1316 HType type = types[value]; | 1316 HType type = types[value]; |
| 1317 // [HFieldSet] is also used for variables in try/catch. | 1317 // [HFieldSet] is also used for variables in try/catch. |
| 1318 if (field.isField()) allSetters.add(field); | 1318 if (field.isField()) allSetters.add(field); |
| 1319 // Don't handle fields defined in superclasses. Given that the field is | 1319 // Don't handle fields defined in superclasses. Given that the field is |
| 1320 // always added to the [allSetters] set, setting a field defined in a | 1320 // always added to the [allSetters] set, setting a field defined in a |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1337 } | 1337 } |
| 1338 | 1338 |
| 1339 // For other fields having setters in the generative constructor body, set | 1339 // For other fields having setters in the generative constructor body, set |
| 1340 // the type to UNKNOWN to avoid relying on the type set in the initializer | 1340 // the type to UNKNOWN to avoid relying on the type set in the initializer |
| 1341 // list. | 1341 // list. |
| 1342 allSetters.forEach((Element element) { | 1342 allSetters.forEach((Element element) { |
| 1343 backend.registerFieldConstructor(element, HType.UNKNOWN); | 1343 backend.registerFieldConstructor(element, HType.UNKNOWN); |
| 1344 }); | 1344 }); |
| 1345 } | 1345 } |
| 1346 } | 1346 } |
| OLD | NEW |