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

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

Issue 1562893002: dart2js cps: Generate increment and compound operators. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Also compound string concatenation Created 4 years, 11 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/codegen/codegen.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 /// 151 ///
152 /// Precondition: Argument is a JavaScript Array. 152 /// Precondition: Argument is a JavaScript Array.
153 IsUnmodifiableJSArray, 153 IsUnmodifiableJSArray,
154 154
155 // TODO(sra): Remove this and replace with IsFalsy(IsUnmodifiableArray(x)). 155 // TODO(sra): Remove this and replace with IsFalsy(IsUnmodifiableArray(x)).
156 IsModifiableJSArray, 156 IsModifiableJSArray,
157 } 157 }
158 158
159 /// A method supported natively in the CPS and Tree IRs using the 159 /// A method supported natively in the CPS and Tree IRs using the
160 /// `ApplyBuiltinMethod` instructions. 160 /// `ApplyBuiltinMethod` instructions.
161 /// 161 ///
162 /// These methods all operate on a distinguished 'object' argument, and 162 /// These methods all operate on a distinguished 'object' argument, and
163 /// take zero or more additional arguments. 163 /// take zero or more additional arguments.
164 /// 164 ///
165 /// These methods may mutate and depend on the state of the object argument, 165 /// These methods may mutate and depend on the state of the object argument,
166 /// but may not depend on or mutate any other state. An exception is thrown 166 /// but may not depend on or mutate any other state. An exception is thrown
167 /// if the object is null, but otherwise they cannot throw or diverge. 167 /// if the object is null, but otherwise they cannot throw or diverge.
168 enum BuiltinMethod { 168 enum BuiltinMethod {
169 /// Add an item to a native list. 169 /// Add an item to a native list.
170 /// 170 ///
171 /// Takes any number of arguments, each argument will be added to the 171 /// Takes any number of arguments, each argument will be added to the
172 /// list on the order given (as per the JS `push` method). 172 /// list on the order given (as per the JS `push` method).
173 /// 173 ///
174 /// Compiles to `object.push(x1, ..., xN)`. 174 /// Compiles to `object.push(x1, ..., xN)`.
175 Push, 175 Push,
176 176
177 /// Remove and return the last item from a native list. 177 /// Remove and return the last item from a native list.
178 /// 178 ///
179 /// Takes no arguments. 179 /// Takes no arguments.
180 /// 180 ///
181 /// Compiles to `object.pop()`. 181 /// Compiles to `object.pop()`.
182 Pop, 182 Pop,
183 } 183 }
184
185 /// True for the built-in operators that may be used in a compound assignment.
186 bool isCompoundableOperator(BuiltinOperator operator) {
187 switch(operator) {
188 case BuiltinOperator.NumAdd:
189 case BuiltinOperator.NumSubtract:
190 case BuiltinOperator.NumMultiply:
191 case BuiltinOperator.NumDivide:
192 case BuiltinOperator.NumRemainder:
193 case BuiltinOperator.StringConcatenate:
194 return true;
195 default:
196 return false;
197 }
198 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/codegen/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698