| 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 1624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1635 element == compiler.boolClass || | 1635 element == compiler.boolClass || |
| 1636 element == compiler.numClass || | 1636 element == compiler.numClass || |
| 1637 element == compiler.intClass || | 1637 element == compiler.intClass || |
| 1638 element == compiler.doubleClass || | 1638 element == compiler.doubleClass || |
| 1639 element == jsArrayClass || | 1639 element == jsArrayClass || |
| 1640 element == jsMutableArrayClass || | 1640 element == jsMutableArrayClass || |
| 1641 element == jsExtendableArrayClass || | 1641 element == jsExtendableArrayClass || |
| 1642 element == jsFixedArrayClass; | 1642 element == jsFixedArrayClass; |
| 1643 } | 1643 } |
| 1644 | 1644 |
| 1645 /// Return [true] if the class is represented by a native JavaSCript type in |
| 1646 /// the generated code. |
| 1647 bool isNativePrimitiveType(ClassElement cls ) { |
| 1648 // TODO(karlklose): cleanup/merge with hasDirectCheck, when the rest of the |
| 1649 // checks are implemented in the CPS IR. |
| 1650 return cls == compiler.intClass || |
| 1651 cls == compiler.numClass || |
| 1652 cls == compiler.doubleClass || |
| 1653 cls == compiler.boolClass || |
| 1654 cls == compiler.stringClass; |
| 1655 } |
| 1656 |
| 1645 bool mayGenerateInstanceofCheck(DartType type) { | 1657 bool mayGenerateInstanceofCheck(DartType type) { |
| 1646 // We can use an instanceof check for raw types that have no subclass that | 1658 // We can use an instanceof check for raw types that have no subclass that |
| 1647 // is mixed-in or in an implements clause. | 1659 // is mixed-in or in an implements clause. |
| 1648 | 1660 |
| 1649 if (!type.isRaw) return false; | 1661 if (!type.isRaw) return false; |
| 1650 ClassElement classElement = type.element; | 1662 ClassElement classElement = type.element; |
| 1651 if (isInterceptorClass(classElement)) return false; | 1663 if (isInterceptorClass(classElement)) return false; |
| 1652 return compiler.world.hasOnlySubclasses(classElement); | 1664 return compiler.world.hasOnlySubclasses(classElement); |
| 1653 } | 1665 } |
| 1654 | 1666 |
| (...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2912 } | 2924 } |
| 2913 } | 2925 } |
| 2914 | 2926 |
| 2915 /// Records that [constant] is used by the element behind [registry]. | 2927 /// Records that [constant] is used by the element behind [registry]. |
| 2916 class Dependency { | 2928 class Dependency { |
| 2917 final ConstantValue constant; | 2929 final ConstantValue constant; |
| 2918 final Element annotatedElement; | 2930 final Element annotatedElement; |
| 2919 | 2931 |
| 2920 const Dependency(this.constant, this.annotatedElement); | 2932 const Dependency(this.constant, this.annotatedElement); |
| 2921 } | 2933 } |
| OLD | NEW |