Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: pkg/compiler/lib/src/cps_ir/builtin_operator.dart

Issue 1645053002: dart2js cps: Refactor tracking of side effects. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Treat named argument as optional Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 case BuiltinOperator.NumSubtract: 217 case BuiltinOperator.NumSubtract:
216 case BuiltinOperator.NumMultiply: 218 case BuiltinOperator.NumMultiply:
217 case BuiltinOperator.NumDivide: 219 case BuiltinOperator.NumDivide:
218 case BuiltinOperator.NumRemainder: 220 case BuiltinOperator.NumRemainder:
219 case BuiltinOperator.StringConcatenate: 221 case BuiltinOperator.StringConcatenate:
220 return true; 222 return true;
221 default: 223 default:
222 return false; 224 return false;
223 } 225 }
224 } 226 }
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698