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

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

Issue 1685893002: cpsir: insert guard and force specialization for [] and []= (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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/cps_ir/type_propagation.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 ///
11 /// 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,
12 /// have observable side-effects, return new objects, nor depend on any 12 /// have observable side-effects, return new objects, nor depend on any
13 /// mutable state. 13 /// mutable state.
14 /// 14 ///
15 /// 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
16 /// argument; their behaviour is unspecified if those requirements are violated. 16 /// argument; their behaviour is unspecified if those requirements are violated.
17 /// 17 ///
18 /// In all cases, the word "null" refers to the Dart null object, corresponding 18 /// In all cases, the word "null" refers to the Dart null object, corresponding
19 /// to both JS null and JS undefined. 19 /// to both JS null and JS undefined.
20 /// 20 ///
21 /// Some operators, notably [IsFloor] and [IsNumberAndFloor], take "repeated" 21 /// Some operators, notably [IsFloor] and [IsInteger], take "repeated"
22 /// arguments to reflect the number of times the given value is referenced 22 /// arguments to reflect the number of times the given value is referenced
23 /// by the generated code. The tree IR needs to know the number of references 23 /// by the generated code. The tree IR needs to know the number of references
24 /// to safely propagate assignments. 24 /// to safely propagate assignments.
25 enum BuiltinOperator { 25 enum BuiltinOperator {
26 /// The numeric binary operators must take two numbers as argument. 26 /// The numeric binary operators must take two numbers as argument.
27 /// The bitwise operators coerce the result to an unsigned integer, but 27 /// The bitwise operators coerce the result to an unsigned integer, but
28 /// otherwise these all behave like the corresponding JS operator. 28 /// otherwise these all behave like the corresponding JS operator.
29 NumAdd, 29 NumAdd,
30 NumSubtract, 30 NumSubtract,
31 NumMultiply, 31 NumMultiply,
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 /// The argument must be repeated 2 times. 126 /// The argument must be repeated 2 times.
127 /// 127 ///
128 /// Compiles to `Math.floor(x) === x` 128 /// Compiles to `Math.floor(x) === x`
129 IsFloor, 129 IsFloor,
130 130
131 /// Returns true if the argument is an integer. 131 /// Returns true if the argument is an integer.
132 /// 132 ///
133 /// The argument must be repeated 3 times. 133 /// The argument must be repeated 3 times.
134 /// 134 ///
135 /// Compiles to `typeof x === 'number' && Math.floor(x) === x` 135 /// Compiles to `typeof x === 'number' && Math.floor(x) === x`
136 IsNumberAndFloor, 136 IsInteger,
137
138 /// Returns true if the argument is not an integer.
139 ///
140 /// The argument must be repeated 3 times.
141 ///
142 /// Compiles to `typeof x !== 'number' || Math.floor(x) !== x`
143 IsNotInteger,
137 144
138 /// Returns true if the argument is a fixed length Array. 145 /// Returns true if the argument is a fixed length Array.
139 /// 146 ///
140 /// Uses one argument. 147 /// Uses one argument.
141 /// 148 ///
142 /// Precondition: Argument is a JavaScript Array. 149 /// Precondition: Argument is a JavaScript Array.
143 IsFixedLengthJSArray, 150 IsFixedLengthJSArray,
144 151
145 // TODO(sra): Remove this and replace with IsFalsy(IsFixedLengthJSArray(x)). 152 // TODO(sra): Remove this and replace with IsFalsy(IsFixedLengthJSArray(x)).
146 IsExtendableJSArray, 153 IsExtendableJSArray,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 case BuiltinOperator.NumSubtract: 196 case BuiltinOperator.NumSubtract:
190 case BuiltinOperator.NumMultiply: 197 case BuiltinOperator.NumMultiply:
191 case BuiltinOperator.NumDivide: 198 case BuiltinOperator.NumDivide:
192 case BuiltinOperator.NumRemainder: 199 case BuiltinOperator.NumRemainder:
193 case BuiltinOperator.StringConcatenate: 200 case BuiltinOperator.StringConcatenate:
194 return true; 201 return true;
195 default: 202 default:
196 return false; 203 return false;
197 } 204 }
198 } 205 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/type_propagation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698