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

Unified Diff: pkg/compiler/lib/src/js_emitter/native_generator.dart

Issue 836753002: dart2js: First part of native support in the new emitter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/new_emitter/emitter.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_emitter/native_generator.dart
diff --git a/pkg/compiler/lib/src/js_emitter/native_generator.dart b/pkg/compiler/lib/src/js_emitter/native_generator.dart
index 6aba6f1d2aeef34347f2aae0e2d53f3c1ee61efc..60f6c3d17fffebd90f416752cf3adf54095e94f2 100644
--- a/pkg/compiler/lib/src/js_emitter/native_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/native_generator.dart
@@ -6,17 +6,19 @@ part of dart2js.js_emitter;
class NativeGenerator {
+ static bool needsIsolateAffinityTagInitialization(JavaScriptBackend backend) {
+ return backend.needToInitializeIsolateAffinityTag;
+ }
+
/// Generates the code for isolate affinity tags.
///
/// Independently Dart programs on the same page must not interfer and
/// this code sets up the variables needed to guarantee that behavior.
static jsAst.Statement generateIsolateAffinityTagInitialization(
+ JavaScriptBackend backend,
jsAst.Expression generateEmbeddedGlobalAccess(String global),
- {bool initializeIsolateAffinityTag,
- bool initializeDispatchProperty}) {
- assert(initializeIsolateAffinityTag != null);
- assert(initializeDispatchProperty != null);
- assert(!initializeDispatchProperty || initializeIsolateAffinityTag);
+ jsAst.Expression convertToFastObject) {
+ assert(backend.needToInitializeIsolateAffinityTag);
jsAst.Expression getIsolateTagAccess =
generateEmbeddedGlobalAccess(embeddedNames.GET_ISOLATE_TAG);
@@ -26,14 +28,13 @@ class NativeGenerator {
generateEmbeddedGlobalAccess(embeddedNames.DISPATCH_PROPERTY_NAME);
return js.statement('''
- if (#initializeIsolateAffinityTag)
!function() {
// On V8, the 'intern' function converts a string to a symbol, which
// makes property access much faster.
function intern(s) {
var o = {};
o[s] = 1;
- return Object.keys(convertToFastObject(o))[0];
+ return Object.keys(#convertToFastObject(o))[0];
}
#getIsolateTag = function(name) {
@@ -61,8 +62,8 @@ class NativeGenerator {
}
}();
''',
- {'initializeIsolateAffinityTag': initializeIsolateAffinityTag,
- 'initializeDispatchProperty': initializeDispatchProperty,
+ {'initializeDispatchProperty': backend.needToInitializeDispatchProperty,
+ 'convertToFastObject': convertToFastObject,
'getIsolateTag': getIsolateTagAccess,
'isolateTag': isolateTagAccess,
'dispatchPropertyName': dispatchPropertyNameAccess});
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/new_emitter/emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698