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

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

Issue 1713983002: dart2js cps: Add SetLength instruction. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Use trust-primitives and refine type of length to uint32' 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 /// 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
9 /// `ApplyBuiltinOperator` instructions. 9 /// `ApplyBuiltinOperator` instructions.
10 /// 10 ///
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 /// A method supported natively in the CPS and Tree IRs using the 180 /// A method supported natively in the CPS and Tree IRs using the
181 /// `ApplyBuiltinMethod` instructions. 181 /// `ApplyBuiltinMethod` instructions.
182 /// 182 ///
183 /// These methods all operate on a distinguished 'object' argument, and 183 /// These methods all operate on a distinguished 'object' argument, and
184 /// take zero or more additional arguments. 184 /// take zero or more additional arguments.
185 /// 185 ///
186 /// These methods may mutate and depend on the state of the object argument, 186 /// These methods may mutate and depend on the state of the object argument,
187 /// but may not depend on or mutate any other state. An exception is thrown 187 /// but may not depend on or mutate any other state. An exception is thrown
188 /// if the object is null, but otherwise they cannot throw or diverge. 188 /// if the object is null, but otherwise they cannot throw or diverge.
189 enum BuiltinMethod { 189 enum BuiltinMethod {
190 /// Add an item to a native list. 190 /// Add an item to an array.
191 /// 191 ///
192 /// Takes any number of arguments, each argument will be added to the 192 /// Takes any number of arguments, each argument will be added to the
193 /// list on the order given (as per the JS `push` method). 193 /// list on the order given (as per the JS `push` method).
194 /// 194 ///
195 /// Compiles to `object.push(x1, ..., xN)`. 195 /// Compiles to `object.push(x1, ..., xN)`.
196 Push, 196 Push,
197 197
198 /// Remove and return the last item from a native list. 198 /// Remove and return the last item from an array.
199 /// 199 ///
200 /// Takes no arguments. 200 /// Takes no arguments.
201 /// 201 ///
202 /// Compiles to `object.pop()`. 202 /// Compiles to `object.pop()`.
203 Pop, 203 Pop,
204
205 /// Sets the length of the array.
206 ///
207 /// Compiles to `object.length = x1`.
208 SetLength,
204 } 209 }
205 210
206 /// True for the built-in operators that may be used in a compound assignment. 211 /// True for the built-in operators that may be used in a compound assignment.
207 bool isCompoundableOperator(BuiltinOperator operator) { 212 bool isCompoundableOperator(BuiltinOperator operator) {
208 switch(operator) { 213 switch(operator) {
209 case BuiltinOperator.NumAdd: 214 case BuiltinOperator.NumAdd:
210 case BuiltinOperator.NumSubtract: 215 case BuiltinOperator.NumSubtract:
211 case BuiltinOperator.NumMultiply: 216 case BuiltinOperator.NumMultiply:
212 case BuiltinOperator.NumDivide: 217 case BuiltinOperator.NumDivide:
213 case BuiltinOperator.NumRemainder: 218 case BuiltinOperator.NumRemainder:
214 case BuiltinOperator.StringConcatenate: 219 case BuiltinOperator.StringConcatenate:
215 return true; 220 return true;
216 default: 221 default:
217 return false; 222 return false;
218 } 223 }
219 } 224 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/bounds_checker.dart ('k') | pkg/compiler/lib/src/cps_ir/type_propagation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698