| 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 import 'dart:collection'; | 5 import 'dart:collection'; |
| 6 | 6 |
| 7 import 'package:js_runtime/shared/embedded_names.dart'; | 7 import 'package:js_runtime/shared/embedded_names.dart'; |
| 8 | 8 |
| 9 import '../closure.dart'; | 9 import '../closure.dart'; |
| 10 import '../common.dart'; | 10 import '../common.dart'; |
| (...skipping 3975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3986 List<HInstruction> arguments, | 3986 List<HInstruction> arguments, |
| 3987 {SourceInformation sourceInformation}) { | 3987 {SourceInformation sourceInformation}) { |
| 3988 // We prefer to not inline certain operations on indexables, | 3988 // We prefer to not inline certain operations on indexables, |
| 3989 // because the constant folder will handle them better and turn | 3989 // because the constant folder will handle them better and turn |
| 3990 // them into simpler instructions that allow further | 3990 // them into simpler instructions that allow further |
| 3991 // optimizations. | 3991 // optimizations. |
| 3992 bool isOptimizableOperationOnIndexable(Selector selector, Element element) { | 3992 bool isOptimizableOperationOnIndexable(Selector selector, Element element) { |
| 3993 bool isLength = selector.isGetter && selector.name == "length"; | 3993 bool isLength = selector.isGetter && selector.name == "length"; |
| 3994 if (isLength || selector.isIndex) { | 3994 if (isLength || selector.isIndex) { |
| 3995 return closedWorld.isSubtypeOf( | 3995 return closedWorld.isSubtypeOf( |
| 3996 element.enclosingClass.declaration, helpers.jsIndexableClass); | 3996 element.enclosingClass, helpers.jsIndexableClass); |
| 3997 } else if (selector.isIndexSet) { | 3997 } else if (selector.isIndexSet) { |
| 3998 return closedWorld.isSubtypeOf(element.enclosingClass.declaration, | 3998 return closedWorld.isSubtypeOf( |
| 3999 helpers.jsMutableIndexableClass); | 3999 element.enclosingClass, helpers.jsMutableIndexableClass); |
| 4000 } else { | 4000 } else { |
| 4001 return false; | 4001 return false; |
| 4002 } | 4002 } |
| 4003 } | 4003 } |
| 4004 | 4004 |
| 4005 bool isOptimizableOperation(Selector selector, Element element) { | 4005 bool isOptimizableOperation(Selector selector, Element element) { |
| 4006 ClassElement cls = element.enclosingClass; | 4006 ClassElement cls = element.enclosingClass; |
| 4007 if (isOptimizableOperationOnIndexable(selector, element)) return true; | 4007 if (isOptimizableOperationOnIndexable(selector, element)) return true; |
| 4008 if (!backend.interceptedClasses.contains(cls)) return false; | 4008 if (!backend.interceptedClasses.contains(cls)) return false; |
| 4009 if (selector.isOperator) return true; | 4009 if (selector.isOperator) return true; |
| (...skipping 2759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6769 this.oldReturnLocal, | 6769 this.oldReturnLocal, |
| 6770 this.oldReturnType, | 6770 this.oldReturnType, |
| 6771 this.oldResolvedAst, | 6771 this.oldResolvedAst, |
| 6772 this.oldStack, | 6772 this.oldStack, |
| 6773 this.oldLocalsHandler, | 6773 this.oldLocalsHandler, |
| 6774 this.inTryStatement, | 6774 this.inTryStatement, |
| 6775 this.allFunctionsCalledOnce, | 6775 this.allFunctionsCalledOnce, |
| 6776 this.oldElementInferenceResults) | 6776 this.oldElementInferenceResults) |
| 6777 : super(function); | 6777 : super(function); |
| 6778 } | 6778 } |
| OLD | NEW |