| 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 1753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1764 } | 1764 } |
| 1765 | 1765 |
| 1766 jsAst.Call generateIsJsIndexableCall(jsAst.Expression use1, | 1766 jsAst.Call generateIsJsIndexableCall(jsAst.Expression use1, |
| 1767 jsAst.Expression use2) { | 1767 jsAst.Expression use2) { |
| 1768 String dispatchPropertyName = 'init.dispatchPropertyName'; | 1768 String dispatchPropertyName = 'init.dispatchPropertyName'; |
| 1769 | 1769 |
| 1770 // We pass the dispatch property record to the isJsIndexable | 1770 // We pass the dispatch property record to the isJsIndexable |
| 1771 // helper rather than reading it inside the helper to increase the | 1771 // helper rather than reading it inside the helper to increase the |
| 1772 // chance of making the dispatch record access monomorphic. | 1772 // chance of making the dispatch record access monomorphic. |
| 1773 jsAst.PropertyAccess record = new jsAst.PropertyAccess( | 1773 jsAst.PropertyAccess record = new jsAst.PropertyAccess( |
| 1774 use2, new jsAst.VariableUse(dispatchPropertyName)); | 1774 use2, js(dispatchPropertyName)); |
| 1775 | 1775 |
| 1776 List<jsAst.Expression> arguments = <jsAst.Expression>[use1, record]; | 1776 List<jsAst.Expression> arguments = <jsAst.Expression>[use1, record]; |
| 1777 FunctionElement helper = | 1777 FunctionElement helper = compiler.findHelper('isJsIndexable'); |
| 1778 compiler.findHelper('isJsIndexable'); | 1778 jsAst.Expression helperExpression = namer.elementAccess(helper); |
| 1779 String helperName = namer.isolateAccess(helper); | 1779 return new jsAst.Call(helperExpression, arguments); |
| 1780 return new jsAst.Call(new jsAst.VariableUse(helperName), arguments); | |
| 1781 } | 1780 } |
| 1782 | 1781 |
| 1783 bool isTypedArray(TypeMask mask) { | 1782 bool isTypedArray(TypeMask mask) { |
| 1784 // Just checking for [:TypedData:] is not sufficient, as it is an | 1783 // Just checking for [:TypedData:] is not sufficient, as it is an |
| 1785 // abstract class any user-defined class can implement. So we also | 1784 // abstract class any user-defined class can implement. So we also |
| 1786 // check for the interface [JavaScriptIndexingBehavior]. | 1785 // check for the interface [JavaScriptIndexingBehavior]. |
| 1787 return compiler.typedDataClass != null | 1786 return compiler.typedDataClass != null |
| 1788 && mask.satisfies(compiler.typedDataClass, compiler) | 1787 && mask.satisfies(compiler.typedDataClass, compiler) |
| 1789 && mask.satisfies(jsIndexingBehaviorInterface, compiler); | 1788 && mask.satisfies(jsIndexingBehaviorInterface, compiler); |
| 1790 } | 1789 } |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1915 } | 1914 } |
| 1916 } | 1915 } |
| 1917 | 1916 |
| 1918 /// Records that [constant] is used by [user.element]. | 1917 /// Records that [constant] is used by [user.element]. |
| 1919 class Dependency { | 1918 class Dependency { |
| 1920 final Constant constant; | 1919 final Constant constant; |
| 1921 final TreeElements user; | 1920 final TreeElements user; |
| 1922 | 1921 |
| 1923 const Dependency(this.constant, this.user); | 1922 const Dependency(this.constant, this.user); |
| 1924 } | 1923 } |
| OLD | NEW |