| 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 js_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 const VERBOSE_OPTIMIZER_HINTS = false; | 7 const VERBOSE_OPTIMIZER_HINTS = false; |
| 8 | 8 |
| 9 class JavaScriptItemCompilationContext extends ItemCompilationContext { | 9 class JavaScriptItemCompilationContext extends ItemCompilationContext { |
| 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); | 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); |
| (...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1731 bool isTypedArray(TypeMask mask) { | 1731 bool isTypedArray(TypeMask mask) { |
| 1732 // Just checking for [:TypedData:] is not sufficient, as it is an | 1732 // Just checking for [:TypedData:] is not sufficient, as it is an |
| 1733 // abstract class any user-defined class can implement. So we also | 1733 // abstract class any user-defined class can implement. So we also |
| 1734 // check for the interface [JavaScriptIndexingBehavior]. | 1734 // check for the interface [JavaScriptIndexingBehavior]. |
| 1735 return compiler.typedDataClass != null | 1735 return compiler.typedDataClass != null |
| 1736 && mask.satisfies(compiler.typedDataClass, compiler) | 1736 && mask.satisfies(compiler.typedDataClass, compiler) |
| 1737 && mask.satisfies(jsIndexingBehaviorInterface, compiler); | 1737 && mask.satisfies(jsIndexingBehaviorInterface, compiler); |
| 1738 } | 1738 } |
| 1739 | 1739 |
| 1740 bool couldBeTypedArray(TypeMask mask) { | 1740 bool couldBeTypedArray(TypeMask mask) { |
| 1741 TypeMask indexing = new TypeMask.subtype(jsIndexingBehaviorInterface); | 1741 bool intersects(TypeMask type1, TypeMask type2) => |
| 1742 // Checking if [mask] contains [indexing] means that we want to | 1742 !type1.intersection(type2, compiler).isEmpty; |
| 1743 // know if [mask] is not a more specific type than [indexing]. | 1743 |
| 1744 return isTypedArray(mask) || mask.containsMask(indexing, compiler); | 1744 return compiler.typedDataClass != null |
| 1745 && intersects(mask, new TypeMask.subtype(compiler.typedDataClass)) |
| 1746 && intersects(mask, new TypeMask.subtype(jsIndexingBehaviorInterface)); |
| 1745 } | 1747 } |
| 1746 | 1748 |
| 1747 /// Returns all static fields that are referenced through [targetsUsed]. | 1749 /// Returns all static fields that are referenced through [targetsUsed]. |
| 1748 /// If the target is a library or class all nested static fields are | 1750 /// If the target is a library or class all nested static fields are |
| 1749 /// included too. | 1751 /// included too. |
| 1750 Iterable<Element> _findStaticFieldTargets() { | 1752 Iterable<Element> _findStaticFieldTargets() { |
| 1751 List staticFields = []; | 1753 List staticFields = []; |
| 1752 | 1754 |
| 1753 void addFieldsInContainer(ScopeContainerElement container) { | 1755 void addFieldsInContainer(ScopeContainerElement container) { |
| 1754 container.forEachLocalMember((Element member) { | 1756 container.forEachLocalMember((Element member) { |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1907 copy(constant.values); | 1909 copy(constant.values); |
| 1908 copy(constant.protoValue); | 1910 copy(constant.protoValue); |
| 1909 copy(constant); | 1911 copy(constant); |
| 1910 } | 1912 } |
| 1911 | 1913 |
| 1912 void visitConstructed(ConstructedConstant constant) { | 1914 void visitConstructed(ConstructedConstant constant) { |
| 1913 copy(constant.fields); | 1915 copy(constant.fields); |
| 1914 copy(constant); | 1916 copy(constant); |
| 1915 } | 1917 } |
| 1916 } | 1918 } |
| OLD | NEW |