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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.dart

Issue 595183003: Always initialize top-level `Isolate` for deferred libraries. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add Tests Created 6 years, 2 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
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 part of dart2js.js_emitter; 5 part of dart2js.js_emitter;
6 6
7 const USE_NEW_EMITTER = const bool.fromEnvironment("dart2js.use.new.emitter"); 7 const USE_NEW_EMITTER = const bool.fromEnvironment("dart2js.use.new.emitter");
8 8
9 /** 9 /**
10 * Generates the code for all used classes in the program. Static fields (even 10 * Generates the code for all used classes in the program. Static fields (even
(...skipping 2057 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 2068
2069 outputBuffer..write(buildGeneratedBy()) 2069 outputBuffer..write(buildGeneratedBy())
2070 ..write('${deferredInitializers}.current$_=$_' 2070 ..write('${deferredInitializers}.current$_=$_'
2071 'function$_(${globalsHolder}) {$N'); 2071 'function$_(${globalsHolder}) {$N');
2072 for (String globalObject in Namer.reservedGlobalObjectNames) { 2072 for (String globalObject in Namer.reservedGlobalObjectNames) {
2073 outputBuffer 2073 outputBuffer
2074 .write('var $globalObject$_=$_' 2074 .write('var $globalObject$_=$_'
2075 '${globalsHolder}.$globalObject$N'); 2075 '${globalsHolder}.$globalObject$N');
2076 } 2076 }
2077 outputBuffer 2077 outputBuffer
2078 .write('var init$_=$_${globalsHolder}.init$N'); 2078 ..write('var init$_=$_${globalsHolder}.init$N')
2079 ..write('var ${namer.isolateName}$_=$_'
2080 '${globalsHolder}.${namer.isolateName}$N');
2079 if (libraryDescriptorBuffer != null) { 2081 if (libraryDescriptorBuffer != null) {
2080 // TODO(ahe): This defines a lot of properties on the 2082 // TODO(ahe): This defines a lot of properties on the
2081 // Isolate.prototype object. We know this will turn it into a 2083 // Isolate.prototype object. We know this will turn it into a
2082 // slow object in V8, so instead we should do something similar 2084 // slow object in V8, so instead we should do something similar
2083 // to Isolate.$finishIsolateConstructor. 2085 // to Isolate.$finishIsolateConstructor.
2084 outputBuffer 2086 outputBuffer
2085 ..write('var ${namer.isolateName}$_=$_' 2087 ..write('var ${namer.currentIsolate}$_=$_$isolatePropertiesName$N')
2086 '${globalsHolder}.${namer.isolateName}$N') 2088 // The classesCollector object ($$).
2087 ..write('var ${namer.currentIsolate}$_=$_$isolatePropertiesName$N') 2089 ..write('$classesCollector$_=${_}Object.create(null);$n')
2088 // The classesCollector object ($$). 2090 ..write('(')
2089 ..write('$classesCollector$_=${_}Object.create(null);$n') 2091 ..write(
2090 ..write('(') 2092 jsAst.prettyPrint(
2091 ..write( 2093 getReflectionDataParser(classesCollector, backend),
2092 jsAst.prettyPrint( 2094 compiler, monitor: compiler.dumpInfoTask))
2093 getReflectionDataParser(classesCollector, backend), 2095 ..write(')')
2094 compiler, monitor: compiler.dumpInfoTask)) 2096 ..write('([$n')
2095 ..write(')') 2097 ..addBuffer(libraryDescriptorBuffer)
2096 ..write('([$n') 2098 ..write('])$N');
2097 ..addBuffer(libraryDescriptorBuffer)
2098 ..write('])$N');
2099 2099
2100 if (outputClassLists.containsKey(outputUnit)) { 2100 if (outputClassLists.containsKey(outputUnit)) {
2101 outputBuffer.write( 2101 outputBuffer.write(
2102 '$finishClassesName($classesCollector,$_${namer.currentIsolate},' 2102 '$finishClassesName($classesCollector,$_${namer.currentIsolate},'
2103 '$_$isolatePropertiesName)$N'); 2103 '$_$isolatePropertiesName)$N');
2104 } 2104 }
2105 2105
2106 } 2106 }
2107 2107
2108 classesCollector = oldClassesCollector; 2108 classesCollector = oldClassesCollector;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
2170 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { 2170 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) {
2171 if (element.isInstanceMember) { 2171 if (element.isInstanceMember) {
2172 cachedClassBuilders.remove(element.enclosingClass); 2172 cachedClassBuilders.remove(element.enclosingClass);
2173 2173
2174 nativeEmitter.cachedBuilders.remove(element.enclosingClass); 2174 nativeEmitter.cachedBuilders.remove(element.enclosingClass);
2175 2175
2176 } 2176 }
2177 } 2177 }
2178 } 2178 }
2179 } 2179 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/deferred_only_constant_lib.dart » ('j') | tests/language/deferred_only_constant_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698