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

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

Issue 1126423002: Avoid reparsing metadata expressions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 [js(lazyInitializerName), 658 [js(lazyInitializerName),
659 js.string(namer.globalPropertyName(element)), 659 js.string(namer.globalPropertyName(element)),
660 js.string(namer.lazyInitializerName(element)), 660 js.string(namer.lazyInitializerName(element)),
661 code, 661 code,
662 js.string(element.name)]); 662 js.string(element.name)]);
663 } 663 }
664 } 664 }
665 665
666 void emitMetadata(Program program, CodeOutput output, OutputUnit outputUnit) { 666 void emitMetadata(Program program, CodeOutput output, OutputUnit outputUnit) {
667 667
668 jsAst.Expression constructList(List<String> list) { 668 jsAst.Expression constructList(List<jsAst.Expression> list) {
669 String listAsString = list == null ? '[]' : '[${list.join(",")}]'; 669 return new jsAst.ArrayInitializer(list == null ? [] : list);
670 return js.uncachedExpressionTemplate(listAsString).instantiate([]);
671 } 670 }
672 671
673 List<String> types = program.metadataTypes[outputUnit]; 672 List<jsAst.Expression> types = program.metadataTypes[outputUnit];
674 673
675 if (outputUnit == compiler.deferredLoadTask.mainOutputUnit) { 674 if (outputUnit == compiler.deferredLoadTask.mainOutputUnit) {
676 jsAst.Expression metadataAccess = 675 jsAst.Expression metadataAccess =
677 generateEmbeddedGlobalAccess(embeddedNames.METADATA); 676 generateEmbeddedGlobalAccess(embeddedNames.METADATA);
678 jsAst.Expression typesAccess = 677 jsAst.Expression typesAccess =
679 generateEmbeddedGlobalAccess(embeddedNames.TYPES); 678 generateEmbeddedGlobalAccess(embeddedNames.TYPES);
680 679
681 output.addBuffer( 680 output.addBuffer(
682 jsAst.prettyPrint(new jsAst.Block([ 681 jsAst.prettyPrint(new jsAst.Block([
683 js.statement('# = #;', [metadataAccess, 682 js.statement('# = #;', [metadataAccess,
(...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { 1940 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) {
1942 if (element.isInstanceMember) { 1941 if (element.isInstanceMember) {
1943 cachedClassBuilders.remove(element.enclosingClass); 1942 cachedClassBuilders.remove(element.enclosingClass);
1944 1943
1945 nativeEmitter.cachedBuilders.remove(element.enclosingClass); 1944 nativeEmitter.cachedBuilders.remove(element.enclosingClass);
1946 1945
1947 } 1946 }
1948 } 1947 }
1949 } 1948 }
1950 } 1949 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart ('k') | tests/compiler/dart2js_extra/23404_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698