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 library js_helper; | 5 #library('dart:_js_helper'); |
6 | 6 |
7 import 'dart:coreimpl'; | 7 #import('dart:coreimpl'); |
8 | 8 |
9 part 'constant_map.dart'; | 9 #source('constant_map.dart'); |
10 part 'native_helper.dart'; | 10 #source('native_helper.dart'); |
11 part 'regexp_helper.dart'; | 11 #source('regexp_helper.dart'); |
12 part 'string_helper.dart'; | 12 #source('string_helper.dart'); |
13 | 13 |
14 // Performance critical helper methods. | 14 // Performance critical helper methods. |
15 add(var a, var b) => (a is num && b is num) | 15 add(var a, var b) => (a is num && b is num) |
16 ? JS('num', r'# + #', a, b) | 16 ? JS('num', r'# + #', a, b) |
17 : add$slow(a, b); | 17 : add$slow(a, b); |
18 | 18 |
19 sub(var a, var b) => (a is num && b is num) | 19 sub(var a, var b) => (a is num && b is num) |
20 ? JS('num', r'# - #', a, b) | 20 ? JS('num', r'# - #', a, b) |
21 : sub$slow(a, b); | 21 : sub$slow(a, b); |
22 | 22 |
(...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1401 JS('void', r'#.runtimeTypeCache[#] = #', JS_CURRENT_ISOLATE(), key, | 1401 JS('void', r'#.runtimeTypeCache[#] = #', JS_CURRENT_ISOLATE(), key, |
1402 runtimeType); | 1402 runtimeType); |
1403 } | 1403 } |
1404 return runtimeType; | 1404 return runtimeType; |
1405 } | 1405 } |
1406 | 1406 |
1407 String getRuntimeTypeString(var object) { | 1407 String getRuntimeTypeString(var object) { |
1408 var typeInfo = JS('Object', r'#.builtin$typeInfo', object); | 1408 var typeInfo = JS('Object', r'#.builtin$typeInfo', object); |
1409 return JS('String', r'#.runtimeType', typeInfo); | 1409 return JS('String', r'#.runtimeType', typeInfo); |
1410 } | 1410 } |
OLD | NEW |