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

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

Issue 1301903002: Record information about constants in dump info (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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
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 library dart2js.js_emitter.full_emitter; 5 library dart2js.js_emitter.full_emitter;
6 6
7 import 'dart:convert'; 7 import 'dart:convert';
8 import 'dart:collection' show HashMap; 8 import 'dart:collection' show HashMap;
9 9
10 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; 10 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames;
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 cachedEmittedConstants.add(constantValue); 799 cachedEmittedConstants.add(constantValue);
800 } 800 }
801 parts.add(buildConstantInitializer(constantValue)); 801 parts.add(buildConstantInitializer(constantValue));
802 } 802 }
803 803
804 return new jsAst.Block(parts); 804 return new jsAst.Block(parts);
805 } 805 }
806 806
807 jsAst.Statement buildConstantInitializer(ConstantValue constant) { 807 jsAst.Statement buildConstantInitializer(ConstantValue constant) {
808 jsAst.Name name = namer.constantName(constant); 808 jsAst.Name name = namer.constantName(constant);
809 return js.statement('#.# = #', 809 jsAst.Statement initializer = js.statement('#.# = #',
810 [namer.globalObjectForConstant(constant), name, 810 [namer.globalObjectForConstant(constant), name,
811 constantInitializerExpression(constant)]); 811 constantInitializerExpression(constant)]);
812 compiler.dumpInfoTask.registerConstantAst(constant, initializer);
813 return initializer;
812 } 814 }
813 815
814 jsAst.Expression constantListGenerator(jsAst.Expression array) { 816 jsAst.Expression constantListGenerator(jsAst.Expression array) {
815 // TODO(floitsch): there is no harm in caching the template. 817 // TODO(floitsch): there is no harm in caching the template.
816 return js('${namer.isolateName}.#(#)', [makeConstListProperty, array]); 818 return js('${namer.isolateName}.#(#)', [makeConstListProperty, array]);
817 } 819 }
818 820
819 jsAst.Statement buildMakeConstantList(bool outputContainsConstantList) { 821 jsAst.Statement buildMakeConstantList(bool outputContainsConstantList) {
820 if (outputContainsConstantList) { 822 if (outputContainsConstantList) {
821 return js.statement(r''' 823 return js.statement(r'''
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after
2119 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { 2121 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) {
2120 if (element.isInstanceMember) { 2122 if (element.isInstanceMember) {
2121 cachedClassBuilders.remove(element.enclosingClass); 2123 cachedClassBuilders.remove(element.enclosingClass);
2122 2124
2123 nativeEmitter.cachedBuilders.remove(element.enclosingClass); 2125 nativeEmitter.cachedBuilders.remove(element.enclosingClass);
2124 2126
2125 } 2127 }
2126 } 2128 }
2127 } 2129 }
2128 } 2130 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698