Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: pkg/compiler/lib/src/js_backend/backend.dart

Issue 1144163004: dart2js cps: Always use interceptors and type tags for 'is' checks. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Rebase + status file Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698