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 /// 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 /// | 96 /// |
97 /// Compiles to `Math.floor(x) === x` | 97 /// Compiles to `Math.floor(x) === x` |
98 IsFloor, | 98 IsFloor, |
99 | 99 |
100 /// Returns true if the argument is an integer. | 100 /// Returns true if the argument is an integer. |
101 /// | 101 /// |
102 /// The argument must be repeated 3 times. | 102 /// The argument must be repeated 3 times. |
103 /// | 103 /// |
104 /// Compiles to `typeof x === 'number' && Math.floor(x) === x` | 104 /// Compiles to `typeof x === 'number' && Math.floor(x) === x` |
105 IsNumberAndFloor, | 105 IsNumberAndFloor, |
106 | |
107 /// Returns true if the argument is a fixed length Array. | |
108 /// | |
109 /// Uses one argument. | |
110 /// | |
111 /// Precondition: Argument is a JavaScript Array. | |
sra1
2015/10/06 06:47:58
I'm pretty sure there are some places where this i
| |
112 IsFixedLengthJSArray, | |
113 | |
114 // TODO(sra): Remove this and replace with IsFalsy(IsFixedLengthJSArray(x)). | |
115 IsExtendableJSArray, | |
116 | |
117 /// Returns true if the argument is an unmodifiable Array. | |
118 /// | |
119 /// Uses one argument. | |
120 /// | |
121 /// Precondition: Argument is a JavaScript Array. | |
122 IsUnmodifiableJSArray, | |
123 | |
124 // TODO(sra): Remove this and replace with IsFalsy(IsUnmodifiableArray(x)). | |
125 IsModifiableJSArray, | |
126 | |
127 | |
128 /// Compiles to | |
129 /// | |
130 /// typeof x === 'object' && x !== null && x.constructor === Array | |
131 /// | |
132 /// TODO(sra): Break into individual tests. | |
133 IsJSArray, | |
134 ISJSArrayNotNull, | |
135 IsJSArrayObject, | |
136 IsJSArrayConstructor, | |
106 } | 137 } |
107 | 138 |
108 /// A method supported natively in the CPS and Tree IRs using the | 139 /// A method supported natively in the CPS and Tree IRs using the |
109 /// `ApplyBuiltinMethod` instructions. | 140 /// `ApplyBuiltinMethod` instructions. |
110 /// | 141 /// |
111 /// These methods all operate on a distinguished 'object' argument, and | 142 /// These methods all operate on a distinguished 'object' argument, and |
112 /// take zero or more additional arguments. | 143 /// take zero or more additional arguments. |
113 /// | 144 /// |
114 /// These methods may mutate and depend on the state of the object argument, | 145 /// These methods may mutate and depend on the state of the object argument, |
115 /// but may not depend on or mutate any other state. An exception is thrown | 146 /// but may not depend on or mutate any other state. An exception is thrown |
116 /// if the object is null, but otherwise they cannot throw or diverge. | 147 /// if the object is null, but otherwise they cannot throw or diverge. |
117 enum BuiltinMethod { | 148 enum BuiltinMethod { |
118 /// Add an item to a native list. | 149 /// Add an item to a native list. |
119 /// | 150 /// |
120 /// Takes any number of arguments, each argument will be added to the | 151 /// Takes any number of arguments, each argument will be added to the |
121 /// list on the order given (as per the JS `push` method). | 152 /// list on the order given (as per the JS `push` method). |
122 /// | 153 /// |
123 /// Compiles to `object.push(x1, ..., xN)`. | 154 /// Compiles to `object.push(x1, ..., xN)`. |
124 Push, | 155 Push, |
125 | 156 |
126 /// Remove and return the last item from a native list. | 157 /// Remove and return the last item from a native list. |
127 /// | 158 /// |
128 /// Takes no arguments. | 159 /// Takes no arguments. |
129 /// | 160 /// |
130 /// Compiles to `object.pop()`. | 161 /// Compiles to `object.pop()`. |
131 Pop, | 162 Pop, |
132 } | 163 } |
OLD | NEW |