Chromium Code Reviews| 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 interface OptimizationPhase { | 5 interface 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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 556 } | 556 } |
| 557 | 557 |
| 558 HInstruction visitInvokeDynamicGetter(HInvokeDynamicGetter node) { | 558 HInstruction visitInvokeDynamicGetter(HInvokeDynamicGetter node) { |
| 559 HInstruction receiver = node.inputs[0]; | 559 HInstruction receiver = node.inputs[0]; |
| 560 if (!receiver.propagatedType.isUseful()) return node; | 560 if (!receiver.propagatedType.isUseful()) return node; |
| 561 if (receiver.propagatedType.canBeNull()) return node; | 561 if (receiver.propagatedType.canBeNull()) return node; |
| 562 Type type = receiver.propagatedType.computeType(compiler); | 562 Type type = receiver.propagatedType.computeType(compiler); |
| 563 if (type === null) return node; | 563 if (type === null) return node; |
| 564 Element field = compiler.world.locateSingleField(type, node.name); | 564 Element field = compiler.world.locateSingleField(type, node.name); |
| 565 if (field === null) return node; | 565 if (field === null) return node; |
| 566 if (field.getLibrary() !== work.element.getLibrary()) return node; | |
|
floitsch
2012/08/15 11:59:42
why not looking if the field is private?
There sho
Søren Gjesse
2012/08/15 12:50:04
It works if the check is just !node.name.isPrivate
floitsch
2012/08/15 12:56:34
That's what I meant.
| |
| 566 Modifiers modifiers = field.modifiers; | 567 Modifiers modifiers = field.modifiers; |
| 567 bool isFinalOrConst = false; | 568 bool isFinalOrConst = false; |
| 568 if (modifiers != null) { | 569 if (modifiers != null) { |
| 569 isFinalOrConst = modifiers.isFinal() || modifiers.isConst(); | 570 isFinalOrConst = modifiers.isFinal() || modifiers.isConst(); |
| 570 } | 571 } |
| 571 if (!compiler.resolverWorld.hasInvokedSetter(field, compiler)) { | 572 if (!compiler.resolverWorld.hasInvokedSetter(field, compiler)) { |
| 572 // If no setter is ever used for this field it is only initialized in the | 573 // If no setter is ever used for this field it is only initialized in the |
| 573 // initializer list. | 574 // initializer list. |
| 574 isFinalOrConst = true; | 575 isFinalOrConst = true; |
| 575 } | 576 } |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1306 // this type for the field is still a strong signal | 1307 // this type for the field is still a strong signal |
| 1307 // indicating the expected type of the field. | 1308 // indicating the expected type of the field. |
| 1308 field.propagatedType = type; | 1309 field.propagatedType = type; |
| 1309 } else { | 1310 } else { |
| 1310 // If there are no invoked setters we know the type of | 1311 // If there are no invoked setters we know the type of |
| 1311 // this field for sure. | 1312 // this field for sure. |
| 1312 field.guaranteedType = type; | 1313 field.guaranteedType = type; |
| 1313 } | 1314 } |
| 1314 } | 1315 } |
| 1315 } | 1316 } |
| OLD | NEW |