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'; | 8 import 'effects.dart'; |
9 | 9 |
10 /// 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 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 Pop, | 205 Pop, |
206 | 206 |
207 /// Sets the length of the array. | 207 /// Sets the length of the array. |
208 /// | 208 /// |
209 /// Compiles to `object.length = x1`. | 209 /// Compiles to `object.length = x1`. |
210 SetLength, | 210 SetLength, |
211 } | 211 } |
212 | 212 |
213 /// True for the built-in operators that may be used in a compound assignment. | 213 /// True for the built-in operators that may be used in a compound assignment. |
214 bool isCompoundableOperator(BuiltinOperator operator) { | 214 bool isCompoundableOperator(BuiltinOperator operator) { |
215 switch(operator) { | 215 switch (operator) { |
216 case BuiltinOperator.NumAdd: | 216 case BuiltinOperator.NumAdd: |
217 case BuiltinOperator.NumSubtract: | 217 case BuiltinOperator.NumSubtract: |
218 case BuiltinOperator.NumMultiply: | 218 case BuiltinOperator.NumMultiply: |
219 case BuiltinOperator.NumDivide: | 219 case BuiltinOperator.NumDivide: |
220 case BuiltinOperator.NumRemainder: | 220 case BuiltinOperator.NumRemainder: |
221 case BuiltinOperator.StringConcatenate: | 221 case BuiltinOperator.StringConcatenate: |
222 return true; | 222 return true; |
223 default: | 223 default: |
224 return false; | 224 return false; |
225 } | 225 } |
226 } | 226 } |
227 | 227 |
228 int getEffectsOfBuiltinMethod(BuiltinMethod method) { | 228 int getEffectsOfBuiltinMethod(BuiltinMethod method) { |
229 switch (method) { | 229 switch (method) { |
230 case BuiltinMethod.Push: | 230 case BuiltinMethod.Push: |
231 return Effects.changesIndexableContent | | 231 return Effects.changesIndexableContent | Effects.changesIndexableLength; |
232 Effects.changesIndexableLength; | |
233 case BuiltinMethod.Pop: | 232 case BuiltinMethod.Pop: |
234 return Effects.dependsOnIndexableContent | | 233 return Effects.dependsOnIndexableContent | |
235 Effects.dependsOnIndexableLength | | 234 Effects.dependsOnIndexableLength | |
236 Effects.changesIndexableLength; | 235 Effects.changesIndexableLength; |
237 case BuiltinMethod.SetLength: | 236 case BuiltinMethod.SetLength: |
238 return Effects.changesIndexableLength; | 237 return Effects.changesIndexableLength; |
239 } | 238 } |
240 } | 239 } |
OLD | NEW |