| 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 | |
| 10 /// An operator supported natively in the CPS and Tree IRs using the | 8 /// An operator supported natively in the CPS and Tree IRs using the |
| 11 /// `ApplyBuiltinOperator` instructions. | 9 /// `ApplyBuiltinOperator` instructions. |
| 12 /// | 10 /// |
| 13 /// These operators are pure in the sense that they cannot throw, diverge, | 11 /// These operators are pure in the sense that they cannot throw, diverge, |
| 14 /// have observable side-effects, return new objects, nor depend on any | 12 /// have observable side-effects, return new objects, nor depend on any |
| 15 /// mutable state. | 13 /// mutable state. |
| 16 /// | 14 /// |
| 17 /// Most operators place restrictions on the values that may be given as | 15 /// Most operators place restrictions on the values that may be given as |
| 18 /// argument; their behaviour is unspecified if those requirements are violated. | 16 /// argument; their behaviour is unspecified if those requirements are violated. |
| 19 /// | 17 /// |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 case BuiltinOperator.NumSubtract: | 215 case BuiltinOperator.NumSubtract: |
| 218 case BuiltinOperator.NumMultiply: | 216 case BuiltinOperator.NumMultiply: |
| 219 case BuiltinOperator.NumDivide: | 217 case BuiltinOperator.NumDivide: |
| 220 case BuiltinOperator.NumRemainder: | 218 case BuiltinOperator.NumRemainder: |
| 221 case BuiltinOperator.StringConcatenate: | 219 case BuiltinOperator.StringConcatenate: |
| 222 return true; | 220 return true; |
| 223 default: | 221 default: |
| 224 return false; | 222 return false; |
| 225 } | 223 } |
| 226 } | 224 } |
| 227 | |
| 228 int getEffectsOfBuiltinMethod(BuiltinMethod method) { | |
| 229 switch (method) { | |
| 230 case BuiltinMethod.Push: | |
| 231 return Effects.changesIndexableContent | | |
| 232 Effects.changesIndexableLength; | |
| 233 case BuiltinMethod.Pop: | |
| 234 return Effects.dependsOnIndexableContent | | |
| 235 Effects.dependsOnIndexableLength | | |
| 236 Effects.changesIndexableLength; | |
| 237 case BuiltinMethod.SetLength: | |
| 238 return Effects.changesIndexableLength; | |
| 239 } | |
| 240 } | |
| OLD | NEW |