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

Side by Side Diff: sdk/lib/_internal/compiler/js_lib/foreign_helper.dart

Issue 1091613003: Revert "dart2js: add compiler builtins to the core-runtime." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « pkg/js_ast/lib/src/builder.dart ('k') | sdk/lib/_internal/compiler/js_lib/js_helper.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 4
5 library _foreign_helper; 5 library _foreign_helper;
6 6
7 import 'dart:_js_embedded_names' show JsGetName, JsBuiltin; 7 import 'dart:_js_embedded_names' show JsGetName;
8 8
9 /** 9 /**
10 * Emits a JavaScript code fragment parameterized by arguments. 10 * Emits a JavaScript code fragment parameterized by arguments.
11 * 11 *
12 * Hash characters `#` in the [codeTemplate] are replaced in left-to-right order 12 * Hash characters `#` in the [codeTemplate] are replaced in left-to-right order
13 * with expressions that contain the values of, or evaluate to, the arguments. 13 * with expressions that contain the values of, or evaluate to, the arguments.
14 * The number of hash marks must match the number or arguments. Although 14 * The number of hash marks must match the number or arguments. Although
15 * declared with arguments [arg0] through [arg2], the form actually has no limit 15 * declared with arguments [arg0] through [arg2], the form actually has no limit
16 * on the number of arguments. 16 * on the number of arguments.
17 * 17 *
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 * https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi. 183 * https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi.
184 */ 184 */
185 RAW_DART_FUNCTION_REF(Function function) {} 185 RAW_DART_FUNCTION_REF(Function function) {}
186 186
187 /** 187 /**
188 * Sets the current isolate to [isolate]. 188 * Sets the current isolate to [isolate].
189 */ 189 */
190 void JS_SET_CURRENT_ISOLATE(isolate) {} 190 void JS_SET_CURRENT_ISOLATE(isolate) {}
191 191
192 /** 192 /**
193 * Returns the JavaScript constructor function for Dart's Object class.
194 * This can be used for type tests, as in
195 *
196 * if (JS('bool', '# instanceof #', obj, JS_DART_OBJECT_CONSTRUCTOR()))
197 * ...
198 */
199 JS_DART_OBJECT_CONSTRUCTOR() {}
200
201 /**
193 * Returns the interceptor for class [type]. The interceptor is the type's 202 * Returns the interceptor for class [type]. The interceptor is the type's
194 * constructor's `prototype` property. [type] will typically be the class, not 203 * constructor's `prototype` property. [type] will typically be the class, not
195 * an interface, e.g. `JS_INTERCEPTOR_CONSTANT(JSInt)`, not 204 * an interface, e.g. `JS_INTERCEPTOR_CONSTANT(JSInt)`, not
196 * `JS_INTERCEPTOR_CONSTANT(int)`. 205 * `JS_INTERCEPTOR_CONSTANT(int)`.
197 */ 206 */
198 JS_INTERCEPTOR_CONSTANT(Type type) {} 207 JS_INTERCEPTOR_CONSTANT(Type type) {}
199 208
200 /** 209 /**
201 * Returns the prefix used for generated is checks on classes. 210 * Returns the prefix used for generated is checks on classes.
202 */ 211 */
203 String JS_OPERATOR_IS_PREFIX() {} 212 String JS_OPERATOR_IS_PREFIX() {}
204 213
205 /** 214 /**
206 * Returns the prefix used for generated type argument substitutions on classes. 215 * Returns the prefix used for generated type argument substitutions on classes.
207 */ 216 */
208 String JS_OPERATOR_AS_PREFIX() {} 217 String JS_OPERATOR_AS_PREFIX() {}
209 218
210 /// Returns the name of the class `Object` in the generated code. 219 /// Returns the name of the class `Object` in the generated code.
211 String JS_OBJECT_CLASS_NAME() {} 220 String JS_OBJECT_CLASS_NAME() {}
212 221
213 /// Returns the name of the class `Null` in the generated code. 222 /// Returns the name of the class `Null` in the generated code.
214 String JS_NULL_CLASS_NAME() {} 223 String JS_NULL_CLASS_NAME() {}
215 224
225 /// Returns the name of the class `Function` in the generated code.
226 String JS_FUNCTION_CLASS_NAME() {}
227
216 /** 228 /**
217 * Returns the field name used for determining if an object or its 229 * Returns the field name used for determining if an object or its
218 * interceptor has JavaScript indexing behavior. 230 * interceptor has JavaScript indexing behavior.
219 */ 231 */
220 String JS_IS_INDEXABLE_FIELD_NAME() {} 232 String JS_IS_INDEXABLE_FIELD_NAME() {}
221 233
222 /** 234 /**
223 * Returns the object corresponding to Namer.CURRENT_ISOLATE. 235 * Returns the object corresponding to Namer.CURRENT_ISOLATE.
224 */ 236 */
225 JS_CURRENT_ISOLATE() {} 237 JS_CURRENT_ISOLATE() {}
226 238
227 /// Returns the name used for generated function types on classes and methods. 239 /// Returns the name used for generated function types on classes and methods.
228 String JS_SIGNATURE_NAME() {} 240 String JS_SIGNATURE_NAME() {}
229 241
230 /// Returns the name used to tag typedefs. 242 /// Returns the name used to tag typedefs.
231 String JS_TYPEDEF_TAG() {} 243 String JS_TYPEDEF_TAG() {}
232 244
245 /// Returns the name used to tag function type representations in JavaScript.
246 String JS_FUNCTION_TYPE_TAG() {}
247
233 /** 248 /**
234 * Returns the name used to tag void return in function type representations 249 * Returns the name used to tag void return in function type representations
235 * in JavaScript. 250 * in JavaScript.
236 */ 251 */
237 String JS_FUNCTION_TYPE_VOID_RETURN_TAG() {} 252 String JS_FUNCTION_TYPE_VOID_RETURN_TAG() {}
238 253
239 /** 254 /**
240 * Returns the name used to tag return types in function type representations 255 * Returns the name used to tag return types in function type representations
241 * in JavaScript. 256 * in JavaScript.
242 */ 257 */
(...skipping 18 matching lines...) Expand all
261 String JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG() {} 276 String JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG() {}
262 277
263 /// Returns the JS name for [name] from the Namer. 278 /// Returns the JS name for [name] from the Namer.
264 String JS_GET_NAME(JsGetName name) {} 279 String JS_GET_NAME(JsGetName name) {}
265 280
266 /// Reads an embedded global. 281 /// Reads an embedded global.
267 /// 282 ///
268 /// The [name] should be a constant defined in the `_embedded_names` library. 283 /// The [name] should be a constant defined in the `_embedded_names` library.
269 JS_EMBEDDED_GLOBAL(String typeDescription, String name) {} 284 JS_EMBEDDED_GLOBAL(String typeDescription, String name) {}
270 285
271 /// Instructs the compiler to execute the [builtinName] action at the call-site.
272 ///
273 /// The [builtin] should be a constant defined in the `_embedded_names`
274 /// library.
275 // Add additional optional arguments if needed. The method is treated internally
276 // as a variable argument method.
277 JS_BUILTIN(String typeDescription, JsBuiltin builtin,
278 [arg0, arg1, arg2, arg3, arg4, arg5, arg6,
279 arg7, arg8, arg9, arg10, arg11]) {}
280
281 /// Returns the state of a flag that is determined by the state of the compiler 286 /// Returns the state of a flag that is determined by the state of the compiler
282 /// when the program has been analyzed. 287 /// when the program has been analyzed.
283 bool JS_GET_FLAG(String name) {} 288 bool JS_GET_FLAG(String name) {}
284 289
285 /** 290 /**
286 * Pretend [code] is executed. Generates no executable code. This is used to 291 * Pretend [code] is executed. Generates no executable code. This is used to
287 * model effects at some other point in external code. For example, the 292 * model effects at some other point in external code. For example, the
288 * following models an assignment to foo with an unknown value. 293 * following models an assignment to foo with an unknown value.
289 * 294 *
290 * var foo; 295 * var foo;
(...skipping 22 matching lines...) Expand all
313 } 318 }
314 319
315 /** 320 /**
316 * JavaScript string concatenation. Inputs must be Strings. Corresponds to the 321 * JavaScript string concatenation. Inputs must be Strings. Corresponds to the
317 * HStringConcat SSA instruction and may be constant-folded. 322 * HStringConcat SSA instruction and may be constant-folded.
318 */ 323 */
319 String JS_STRING_CONCAT(String a, String b) { 324 String JS_STRING_CONCAT(String a, String b) {
320 // This body is unused, only here for type analysis. 325 // This body is unused, only here for type analysis.
321 return JS('String', '# + #', a, b); 326 return JS('String', '# + #', a, b);
322 } 327 }
OLDNEW
« no previous file with comments | « pkg/js_ast/lib/src/builder.dart ('k') | sdk/lib/_internal/compiler/js_lib/js_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698