| 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 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 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 // Some native fields are views of data that may be changed by operations. | 683 // Some native fields are views of data that may be changed by operations. |
| 684 // E.g. node.firstChild depends on parentNode.removeBefore(n1, n2). | 684 // E.g. node.firstChild depends on parentNode.removeBefore(n1, n2). |
| 685 // TODO(sra): Refine the effect classification so that native effects are | 685 // TODO(sra): Refine the effect classification so that native effects are |
| 686 // distinct from ordinary Dart effects. | 686 // distinct from ordinary Dart effects. |
| 687 isAssignable = true; | 687 isAssignable = true; |
| 688 } | 688 } |
| 689 HFieldGet result = new HFieldGet( | 689 HFieldGet result = new HFieldGet( |
| 690 field, receiver, isAssignable: isAssignable); | 690 field, receiver, isAssignable: isAssignable); |
| 691 | 691 |
| 692 if (field.getEnclosingClass().isNative()) { | 692 if (field.getEnclosingClass().isNative()) { |
| 693 result.instructionType = | 693 result.instructionType = new HType.fromNativeBehavior( |
| 694 new HType.subtype(field.computeType(compiler), compiler); | 694 native.NativeBehavior.ofFieldLoad(field, compiler), |
| 695 compiler); |
| 695 } else { | 696 } else { |
| 696 HType type = new HType.inferredTypeForElement(field, compiler); | 697 HType type = new HType.inferredTypeForElement(field, compiler); |
| 697 if (type.isUnknown()) { | 698 if (type.isUnknown()) { |
| 698 type = backend.optimisticFieldType(field); | 699 type = backend.optimisticFieldType(field); |
| 699 if (type != null) { | 700 if (type != null) { |
| 700 backend.registerFieldTypesOptimization( | 701 backend.registerFieldTypesOptimization( |
| 701 work.element, field, result.instructionType); | 702 work.element, field, result.instructionType); |
| 702 } | 703 } |
| 703 } | 704 } |
| 704 if (type != null) { | 705 if (type != null) { |
| (...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1710 HBasicBlock block = user.block; | 1711 HBasicBlock block = user.block; |
| 1711 block.addAfter(user, interceptor); | 1712 block.addAfter(user, interceptor); |
| 1712 block.rewrite(user, interceptor); | 1713 block.rewrite(user, interceptor); |
| 1713 block.remove(user); | 1714 block.remove(user); |
| 1714 | 1715 |
| 1715 // The interceptor will be removed in the dead code elimination | 1716 // The interceptor will be removed in the dead code elimination |
| 1716 // phase. Note that removing it here would not work because of how | 1717 // phase. Note that removing it here would not work because of how |
| 1717 // the [visitBasicBlock] is implemented. | 1718 // the [visitBasicBlock] is implemented. |
| 1718 } | 1719 } |
| 1719 } | 1720 } |
| OLD | NEW |