| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library dart2js.ir_builder; | 5 library dart2js.ir_builder; |
| 6 | 6 |
| 7 import '../constants/expressions.dart'; | 7 import '../constants/expressions.dart'; |
| 8 import '../constants/values.dart' show PrimitiveConstantValue; | 8 import '../constants/values.dart' show PrimitiveConstantValue; |
| 9 import '../dart_types.dart'; | 9 import '../dart_types.dart'; |
| 10 import '../dart2jslib.dart'; | 10 import '../dart2jslib.dart'; |
| (...skipping 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1639 ir.Primitive buildFunctionExpression(ir.FunctionDefinition definition) { | 1639 ir.Primitive buildFunctionExpression(ir.FunctionDefinition definition) { |
| 1640 ir.CreateFunction prim = new ir.CreateFunction(definition); | 1640 ir.CreateFunction prim = new ir.CreateFunction(definition); |
| 1641 add(new ir.LetPrim(prim)); | 1641 add(new ir.LetPrim(prim)); |
| 1642 return prim; | 1642 return prim; |
| 1643 } | 1643 } |
| 1644 | 1644 |
| 1645 /// Create a read access of [local]. | 1645 /// Create a read access of [local]. |
| 1646 ir.Primitive buildLocalGet(LocalElement local) { | 1646 ir.Primitive buildLocalGet(LocalElement local) { |
| 1647 assert(isOpen); | 1647 assert(isOpen); |
| 1648 if (isInClosureVariable(local)) { | 1648 if (isInClosureVariable(local)) { |
| 1649 ir.Primitive result = new ir.GetClosureVariable(getClosureVariable(local))
; | 1649 // Do not use [local] as a hint on [result]. The variable should always |
| 1650 result.useElementAsHint(local); | 1650 // be inlined, but the hint prevents it. |
| 1651 ir.Primitive result = |
| 1652 new ir.GetClosureVariable(getClosureVariable(local)); |
| 1651 add(new ir.LetPrim(result)); | 1653 add(new ir.LetPrim(result)); |
| 1652 return result; | 1654 return result; |
| 1653 } else { | 1655 } else { |
| 1654 return environment.lookup(local); | 1656 return environment.lookup(local); |
| 1655 } | 1657 } |
| 1656 } | 1658 } |
| 1657 | 1659 |
| 1658 /// Create a write access to [local] with the provided [value]. | 1660 /// Create a write access to [local] with the provided [value]. |
| 1659 ir.Primitive buildLocalSet(LocalElement local, ir.Primitive value) { | 1661 ir.Primitive buildLocalSet(LocalElement local, ir.Primitive value) { |
| 1660 assert(isOpen); | 1662 assert(isOpen); |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1876 | 1878 |
| 1877 ClosureEnvironment(this.selfReference, this.thisLocal, this.freeVariables); | 1879 ClosureEnvironment(this.selfReference, this.thisLocal, this.freeVariables); |
| 1878 } | 1880 } |
| 1879 | 1881 |
| 1880 /// Information about which variables are captured in a closure. | 1882 /// Information about which variables are captured in a closure. |
| 1881 /// This is used by the [DartIrBuilder] instead of [ClosureScope] and | 1883 /// This is used by the [DartIrBuilder] instead of [ClosureScope] and |
| 1882 /// [ClosureEnvironment]. | 1884 /// [ClosureEnvironment]. |
| 1883 abstract class ClosureVariableInfo { | 1885 abstract class ClosureVariableInfo { |
| 1884 Iterable<Local> get capturedVariables; | 1886 Iterable<Local> get capturedVariables; |
| 1885 } | 1887 } |
| OLD | NEW |