OLD | NEW |
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 part of _js_helper; | 5 part of _js_helper; |
6 | 6 |
7 | 7 |
8 // TODO(ngeoffray): stop using this method once our optimizers can | 8 // TODO(ngeoffray): stop using this method once our optimizers can |
9 // change str1.contains(str2) into str1.indexOf(str2) != -1. | 9 // change str1.contains(str2) into str1.indexOf(str2) != -1. |
10 bool contains(String userAgent, String name) { | 10 bool contains(String userAgent, String name) { |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 251 |
252 patchInteriorProto(obj, interceptor) { | 252 patchInteriorProto(obj, interceptor) { |
253 var proto = JS('', 'Object.getPrototypeOf(#)', obj); | 253 var proto = JS('', 'Object.getPrototypeOf(#)', obj); |
254 var record = makeDispatchRecord(interceptor, proto, null, null); | 254 var record = makeDispatchRecord(interceptor, proto, null, null); |
255 setDispatchProperty(proto, record); | 255 setDispatchProperty(proto, record); |
256 return interceptor; | 256 return interceptor; |
257 } | 257 } |
258 | 258 |
259 | 259 |
260 makeLeafDispatchRecord(interceptor) { | 260 makeLeafDispatchRecord(interceptor) { |
261 var fieldName = JS_IS_INDEXABLE_FIELD_NAME(); | 261 var fieldName = JS_GET_NAME(JsGetName.IS_INDEXABLE_FIELD_NAME); |
262 bool indexability = JS('bool', r'!!#[#]', interceptor, fieldName); | 262 bool indexability = JS('bool', r'!!#[#]', interceptor, fieldName); |
263 return makeDispatchRecord(interceptor, false, null, indexability); | 263 return makeDispatchRecord(interceptor, false, null, indexability); |
264 } | 264 } |
265 | 265 |
266 makeDefaultDispatchRecord(tag, interceptorClass, proto) { | 266 makeDefaultDispatchRecord(tag, interceptorClass, proto) { |
267 var interceptor = JS('', '#.prototype', interceptorClass); | 267 var interceptor = JS('', '#.prototype', interceptorClass); |
268 var isLeaf = JS('bool', '(#[#]) === true', leafTags, tag); | 268 var isLeaf = JS('bool', '(#[#]) === true', leafTags, tag); |
269 if (isLeaf) { | 269 if (isLeaf) { |
270 return makeLeafDispatchRecord(interceptor); | 270 return makeLeafDispatchRecord(interceptor); |
271 } else { | 271 } else { |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 const _safariHooksTransformer = const JS_CONST(r''' | 646 const _safariHooksTransformer = const JS_CONST(r''' |
647 function(hooks) { return hooks; } | 647 function(hooks) { return hooks; } |
648 '''); | 648 '''); |
649 | 649 |
650 | 650 |
651 const _dartExperimentalFixupGetTagHooksTransformer = const JS_CONST(r''' | 651 const _dartExperimentalFixupGetTagHooksTransformer = const JS_CONST(r''' |
652 function(hooks) { | 652 function(hooks) { |
653 if (typeof dartExperimentalFixupGetTag != "function") return hooks; | 653 if (typeof dartExperimentalFixupGetTag != "function") return hooks; |
654 hooks.getTag = dartExperimentalFixupGetTag(hooks.getTag); | 654 hooks.getTag = dartExperimentalFixupGetTag(hooks.getTag); |
655 }'''); | 655 }'''); |
OLD | NEW |