OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 dart2js.js_emitter.native_generator; | 5 library dart2js.js_emitter.native_generator; |
6 | 6 |
7 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; | 7 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; |
8 | 8 |
9 import '../js/js.dart' as jsAst; | 9 import '../js/js.dart' as jsAst; |
10 import '../js/js.dart' show js; | 10 import '../js/js.dart' show js; |
11 import '../js_backend/backend_usage.dart' show BackendUsage; | 11 import '../js_backend/backend_usage.dart' show BackendUsage; |
12 | 12 |
13 import 'model.dart'; | 13 import 'model.dart'; |
14 | 14 |
15 class NativeGenerator { | 15 class NativeGenerator { |
16 static bool needsIsolateAffinityTagInitialization(BackendUsage backendUsage) { | 16 static bool needsIsolateAffinityTagInitialization(BackendUsage backendUsage) { |
17 return backendUsage.needToInitializeIsolateAffinityTag; | 17 return backendUsage.needToInitializeIsolateAffinityTag; |
18 } | 18 } |
19 | 19 |
20 /// Generates the code for isolate affinity tags. | 20 /// Generates the code for isolate affinity tags. |
21 /// | 21 /// |
22 /// Independently Dart programs on the same page must not interfer and | 22 /// Independently Dart programs on the same page must not interfere and |
23 /// this code sets up the variables needed to guarantee that behavior. | 23 /// this code sets up the variables needed to guarantee that behavior. |
24 static jsAst.Statement generateIsolateAffinityTagInitialization( | 24 static jsAst.Statement generateIsolateAffinityTagInitialization( |
25 BackendUsage backendUsage, | 25 BackendUsage backendUsage, |
26 jsAst.Expression generateEmbeddedGlobalAccess(String global), | 26 jsAst.Expression generateEmbeddedGlobalAccess(String global), |
27 jsAst.Expression internStringFunction) { | 27 jsAst.Expression internStringFunction) { |
28 assert(backendUsage.needToInitializeIsolateAffinityTag); | 28 assert(backendUsage.needToInitializeIsolateAffinityTag); |
29 | 29 |
30 jsAst.Expression getIsolateTagAccess = | 30 jsAst.Expression getIsolateTagAccess = |
31 generateEmbeddedGlobalAccess(embeddedNames.GET_ISOLATE_TAG); | 31 generateEmbeddedGlobalAccess(embeddedNames.GET_ISOLATE_TAG); |
32 jsAst.Expression isolateTagAccess = | 32 jsAst.Expression isolateTagAccess = |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 'info': infoAccess, | 209 'info': infoAccess, |
210 'constructor': constructorAccess, | 210 'constructor': constructorAccess, |
211 'subclassRead': subclassRead, | 211 'subclassRead': subclassRead, |
212 'interceptorsByTagAccess': interceptorsByTagAccess, | 212 'interceptorsByTagAccess': interceptorsByTagAccess, |
213 'leafTagsAccess': leafTagsAccess, | 213 'leafTagsAccess': leafTagsAccess, |
214 'nativeSuperclassTagName': embeddedNames.NATIVE_SUPERCLASS_TAG_NAME, | 214 'nativeSuperclassTagName': embeddedNames.NATIVE_SUPERCLASS_TAG_NAME, |
215 'allowNativesSubclassing': true | 215 'allowNativesSubclassing': true |
216 }); | 216 }); |
217 } | 217 } |
218 } | 218 } |
OLD | NEW |