| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library builtin_operator; | 4 library builtin_operator; |
| 5 // This is shared by the CPS and Tree IRs. | 5 // This is shared by the CPS and Tree IRs. |
| 6 // Both cps_ir_nodes and tree_ir_nodes import and re-export this file. | 6 // Both cps_ir_nodes and tree_ir_nodes import and re-export this file. |
| 7 | 7 |
| 8 import 'effects.dart'; |
| 9 |
| 8 /// An operator supported natively in the CPS and Tree IRs using the | 10 /// An operator supported natively in the CPS and Tree IRs using the |
| 9 /// `ApplyBuiltinOperator` instructions. | 11 /// `ApplyBuiltinOperator` instructions. |
| 10 /// | 12 /// |
| 11 /// These operators are pure in the sense that they cannot throw, diverge, | 13 /// These operators are pure in the sense that they cannot throw, diverge, |
| 12 /// have observable side-effects, return new objects, nor depend on any | 14 /// have observable side-effects, return new objects, nor depend on any |
| 13 /// mutable state. | 15 /// mutable state. |
| 14 /// | 16 /// |
| 15 /// Most operators place restrictions on the values that may be given as | 17 /// Most operators place restrictions on the values that may be given as |
| 16 /// argument; their behaviour is unspecified if those requirements are violated. | 18 /// argument; their behaviour is unspecified if those requirements are violated. |
| 17 /// | 19 /// |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 case BuiltinOperator.NumSubtract: | 191 case BuiltinOperator.NumSubtract: |
| 190 case BuiltinOperator.NumMultiply: | 192 case BuiltinOperator.NumMultiply: |
| 191 case BuiltinOperator.NumDivide: | 193 case BuiltinOperator.NumDivide: |
| 192 case BuiltinOperator.NumRemainder: | 194 case BuiltinOperator.NumRemainder: |
| 193 case BuiltinOperator.StringConcatenate: | 195 case BuiltinOperator.StringConcatenate: |
| 194 return true; | 196 return true; |
| 195 default: | 197 default: |
| 196 return false; | 198 return false; |
| 197 } | 199 } |
| 198 } | 200 } |
| 201 |
| 202 int getEffectsOfBuiltinMethod(BuiltinMethod method) { |
| 203 switch (method) { |
| 204 case BuiltinMethod.Push: |
| 205 return Effects.changesIndexableContent | Effects.changesIndexableLength; |
| 206 case BuiltinMethod.Pop: |
| 207 return Effects.dependsOnIndexableContent | Effects.changesIndexableLength; |
| 208 } |
| 209 } |
| OLD | NEW |