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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart

Issue 832363002: Remove Compiler.assembledCode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 part of dart2js.js_emitter; 5 part of dart2js.js_emitter;
6 6
7 7
8 class OldEmitter implements Emitter { 8 class OldEmitter implements Emitter {
9 final Compiler compiler; 9 final Compiler compiler;
10 final CodeEmitterTask task; 10 final CodeEmitterTask task;
(...skipping 1807 matching lines...) Expand 10 before | Expand all | Expand 10 after
1818 outputSourceMap(assembledCode, mainBuffer, '', 1818 outputSourceMap(assembledCode, mainBuffer, '',
1819 compiler.sourceMapUri, compiler.outputUri); 1819 compiler.sourceMapUri, compiler.outputUri);
1820 mainBuffer.write( 1820 mainBuffer.write(
1821 generateSourceMapTag(compiler.sourceMapUri, compiler.outputUri)); 1821 generateSourceMapTag(compiler.sourceMapUri, compiler.outputUri));
1822 assembledCode = mainBuffer.getText(); 1822 assembledCode = mainBuffer.getText();
1823 } 1823 }
1824 1824
1825 compiler.outputProvider('', 'js') 1825 compiler.outputProvider('', 'js')
1826 ..add(assembledCode) 1826 ..add(assembledCode)
1827 ..close(); 1827 ..close();
1828 compiler.assembledCode = assembledCode;
1829 } 1828 }
1830 1829
1831 /// Used by incremental compilation to patch up the prototype of 1830 /// Used by incremental compilation to patch up the prototype of
1832 /// [oldConstructor] for use as prototype of [newConstructor]. 1831 /// [oldConstructor] for use as prototype of [newConstructor].
1833 jsAst.Fun buildSchemaChangeFunction() { 1832 jsAst.Fun buildSchemaChangeFunction() {
1834 return js(''' 1833 return js('''
1835 function(newConstructor, oldConstructor, superclass) { 1834 function(newConstructor, oldConstructor, superclass) {
1836 // Invariant: newConstructor.prototype has no interesting properties besides 1835 // Invariant: newConstructor.prototype has no interesting properties besides
1837 // generated accessors. These are copied to oldPrototype which will be 1836 // generated accessors. These are copied to oldPrototype which will be
1838 // updated by other incremental changes. 1837 // updated by other incremental changes.
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1997 1996
1998 nativeEmitter.generateNativeClasses(nativeClasses, mainBuffer, 1997 nativeEmitter.generateNativeClasses(nativeClasses, mainBuffer,
1999 additionalProperties); 1998 additionalProperties);
2000 1999
2001 nativeEmitter.finishGenerateNativeClasses(); 2000 nativeEmitter.finishGenerateNativeClasses();
2002 nativeEmitter.assembleCode(nativeBuffer); 2001 nativeEmitter.assembleCode(nativeBuffer);
2003 2002
2004 return nativeBuffer; 2003 return nativeBuffer;
2005 } 2004 }
2006 2005
2007 void emitProgram(Program program) { 2006 int emitProgram(Program program) {
2008 // Shorten the code by using [namer.currentIsolate] as temporary. 2007 // Shorten the code by using [namer.currentIsolate] as temporary.
2009 isolateProperties = namer.currentIsolate; 2008 isolateProperties = namer.currentIsolate;
2010 2009
2011 classesCollector = r"$$"; 2010 classesCollector = r"$$";
2012 2011
2013 // Emit deferred units first, so we have their hashes. 2012 // Emit deferred units first, so we have their hashes.
2014 // Map from OutputUnit to a hash of its content. The hash uniquely 2013 // Map from OutputUnit to a hash of its content. The hash uniquely
2015 // identifies the code of the output-unit. It does not include 2014 // identifies the code of the output-unit. It does not include
2016 // boilerplate JS code, like the sourcemap directives or the hash 2015 // boilerplate JS code, like the sourcemap directives or the hash
2017 // itself. 2016 // itself.
2018 Map<OutputUnit, String> deferredLoadHashes = emitDeferredOutputUnits(); 2017 Map<OutputUnit, String> deferredLoadHashes = emitDeferredOutputUnits();
2019 CodeBuffer nativeBuffer = buildNativesBuffer(); 2018 CodeBuffer nativeBuffer = buildNativesBuffer();
2020 emitMainOutputUnit(deferredLoadHashes, nativeBuffer); 2019 emitMainOutputUnit(deferredLoadHashes, nativeBuffer);
2021 2020
2022 if (backend.requiresPreamble && 2021 if (backend.requiresPreamble &&
2023 !backend.htmlLibraryIsLoaded) { 2022 !backend.htmlLibraryIsLoaded) {
2024 compiler.reportHint(NO_LOCATION_SPANNABLE, MessageKind.PREAMBLE); 2023 compiler.reportHint(NO_LOCATION_SPANNABLE, MessageKind.PREAMBLE);
2025 } 2024 }
2025
2026 // Return the total program size.
2027 return outputBuffers.values.fold(0, (a, b) => a + b.length);
2026 } 2028 }
2027 2029
2028 String generateSourceMapTag(Uri sourceMapUri, Uri fileUri) { 2030 String generateSourceMapTag(Uri sourceMapUri, Uri fileUri) {
2029 if (sourceMapUri != null && fileUri != null) { 2031 if (sourceMapUri != null && fileUri != null) {
2030 String sourceMapFileName = relativize(fileUri, sourceMapUri, false); 2032 String sourceMapFileName = relativize(fileUri, sourceMapUri, false);
2031 return ''' 2033 return '''
2032 2034
2033 //# sourceMappingURL=$sourceMapFileName 2035 //# sourceMappingURL=$sourceMapFileName
2034 '''; 2036 ''';
2035 } 2037 }
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
2276 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { 2278 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) {
2277 if (element.isInstanceMember) { 2279 if (element.isInstanceMember) {
2278 cachedClassBuilders.remove(element.enclosingClass); 2280 cachedClassBuilders.remove(element.enclosingClass);
2279 2281
2280 nativeEmitter.cachedBuilders.remove(element.enclosingClass); 2282 nativeEmitter.cachedBuilders.remove(element.enclosingClass);
2281 2283
2282 } 2284 }
2283 } 2285 }
2284 } 2286 }
2285 } 2287 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698