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

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

Issue 574683002: Use ConstExp for storing constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes and further implementation. 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 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 void emitStaticNonFinalFieldInitializations(CodeBuffer buffer) { 952 void emitStaticNonFinalFieldInitializations(CodeBuffer buffer) {
953 JavaScriptConstantCompiler handler = backend.constants; 953 JavaScriptConstantCompiler handler = backend.constants;
954 Iterable<VariableElement> staticNonFinalFields = 954 Iterable<VariableElement> staticNonFinalFields =
955 handler.getStaticNonFinalFieldsForEmission(); 955 handler.getStaticNonFinalFieldsForEmission();
956 for (Element element in Elements.sortedByPosition(staticNonFinalFields)) { 956 for (Element element in Elements.sortedByPosition(staticNonFinalFields)) {
957 // [:interceptedNames:] is handled in [emitInterceptedNames]. 957 // [:interceptedNames:] is handled in [emitInterceptedNames].
958 if (element == backend.interceptedNames) continue; 958 if (element == backend.interceptedNames) continue;
959 // `mapTypeToInterceptor` is handled in [emitMapTypeToInterceptor]. 959 // `mapTypeToInterceptor` is handled in [emitMapTypeToInterceptor].
960 if (element == backend.mapTypeToInterceptor) continue; 960 if (element == backend.mapTypeToInterceptor) continue;
961 compiler.withCurrentElement(element, () { 961 compiler.withCurrentElement(element, () {
962 Constant initialValue = handler.getInitialValueFor(element); 962 Constant initialValue = handler.getInitialValueFor(element).value;
963 jsAst.Expression init = 963 jsAst.Expression init =
964 js('$isolateProperties.# = #', 964 js('$isolateProperties.# = #',
965 [namer.getNameOfGlobalField(element), 965 [namer.getNameOfGlobalField(element),
966 constantEmitter.referenceInInitializationContext(initialValue)]); 966 constantEmitter.referenceInInitializationContext(initialValue)]);
967 buffer.write(jsAst.prettyPrint(init, compiler, 967 buffer.write(jsAst.prettyPrint(init, compiler,
968 monitor: compiler.dumpInfoTask)); 968 monitor: compiler.dumpInfoTask));
969 buffer.write('$N'); 969 buffer.write('$N');
970 }); 970 });
971 } 971 }
972 } 972 }
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after
2111 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { 2111 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) {
2112 if (element.isInstanceMember) { 2112 if (element.isInstanceMember) {
2113 cachedClassBuilders.remove(element.enclosingClass); 2113 cachedClassBuilders.remove(element.enclosingClass);
2114 2114
2115 nativeEmitter.cachedBuilders.remove(element.enclosingClass); 2115 nativeEmitter.cachedBuilders.remove(element.enclosingClass);
2116 2116
2117 } 2117 }
2118 } 2118 }
2119 } 2119 }
2120 } 2120 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698