| 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 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1648 element == compiler.numClass || | 1648 element == compiler.numClass || |
| 1649 element == compiler.intClass || | 1649 element == compiler.intClass || |
| 1650 element == compiler.doubleClass || | 1650 element == compiler.doubleClass || |
| 1651 element == jsArrayClass || | 1651 element == jsArrayClass || |
| 1652 element == jsMutableArrayClass || | 1652 element == jsMutableArrayClass || |
| 1653 element == jsExtendableArrayClass || | 1653 element == jsExtendableArrayClass || |
| 1654 element == jsFixedArrayClass || | 1654 element == jsFixedArrayClass || |
| 1655 element == jsUnmodifiableArrayClass; | 1655 element == jsUnmodifiableArrayClass; |
| 1656 } | 1656 } |
| 1657 | 1657 |
| 1658 /// Return [true] if the class is represented by a native JavaSCript type in | |
| 1659 /// the generated code. | |
| 1660 bool isNativePrimitiveType(ClassElement cls ) { | |
| 1661 // TODO(karlklose): cleanup/merge with hasDirectCheck, when the rest of the | |
| 1662 // checks are implemented in the CPS IR. | |
| 1663 return cls == compiler.intClass || | |
| 1664 cls == compiler.numClass || | |
| 1665 cls == compiler.doubleClass || | |
| 1666 cls == compiler.boolClass || | |
| 1667 cls == compiler.stringClass; | |
| 1668 } | |
| 1669 | |
| 1670 bool mayGenerateInstanceofCheck(DartType type) { | 1658 bool mayGenerateInstanceofCheck(DartType type) { |
| 1671 // We can use an instanceof check for raw types that have no subclass that | 1659 // We can use an instanceof check for raw types that have no subclass that |
| 1672 // is mixed-in or in an implements clause. | 1660 // is mixed-in or in an implements clause. |
| 1673 | 1661 |
| 1674 if (!type.isRaw) return false; | 1662 if (!type.isRaw) return false; |
| 1675 ClassElement classElement = type.element; | 1663 ClassElement classElement = type.element; |
| 1676 if (isInterceptorClass(classElement)) return false; | 1664 if (isInterceptorClass(classElement)) return false; |
| 1677 return compiler.world.hasOnlySubclasses(classElement); | 1665 return compiler.world.hasOnlySubclasses(classElement); |
| 1678 } | 1666 } |
| 1679 | 1667 |
| (...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2941 } | 2929 } |
| 2942 } | 2930 } |
| 2943 | 2931 |
| 2944 /// Records that [constant] is used by the element behind [registry]. | 2932 /// Records that [constant] is used by the element behind [registry]. |
| 2945 class Dependency { | 2933 class Dependency { |
| 2946 final ConstantValue constant; | 2934 final ConstantValue constant; |
| 2947 final Element annotatedElement; | 2935 final Element annotatedElement; |
| 2948 | 2936 |
| 2949 const Dependency(this.constant, this.annotatedElement); | 2937 const Dependency(this.constant, this.annotatedElement); |
| 2950 } | 2938 } |
| OLD | NEW |