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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart

Issue 22909056: Support general expressions as keys in literal maps. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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 js_backend; 5 part of js_backend;
6 6
7 class JavaScriptItemCompilationContext extends ItemCompilationContext { 7 class JavaScriptItemCompilationContext extends ItemCompilationContext {
8 final Set<HInstruction> boundsChecked; 8 final Set<HInstruction> boundsChecked;
9 9
10 JavaScriptItemCompilationContext() 10 JavaScriptItemCompilationContext()
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 helpersUsed.add(cls.declaration); 1134 helpersUsed.add(cls.declaration);
1135 // Both declaration and implementation may declare fields, so we 1135 // Both declaration and implementation may declare fields, so we
1136 // add both to the list of helpers. 1136 // add both to the list of helpers.
1137 if (cls.declaration != cls.implementation) { 1137 if (cls.declaration != cls.implementation) {
1138 helpersUsed.add(cls.implementation); 1138 helpersUsed.add(cls.implementation);
1139 } 1139 }
1140 enqueuer.registerInstantiatedClass(cls, elements); 1140 enqueuer.registerInstantiatedClass(cls, elements);
1141 } 1141 }
1142 1142
1143 void registerConstantMap(TreeElements elements) { 1143 void registerConstantMap(TreeElements elements) {
1144 Element e = compiler.findHelper(const SourceString('ConstantMap')); 1144 void enqueue(SourceString name) {
1145 if (e != null) { 1145 Element e = compiler.findHelper(name);
1146 enqueueClass(compiler.enqueuer.resolution, e, elements); 1146 if (e != null) {
1147 enqueueClass(compiler.enqueuer.resolution, e, elements);
1148 }
1147 } 1149 }
1148 e = compiler.findHelper(const SourceString('ConstantProtoMap')); 1150
1149 if (e != null) { 1151 enqueue(MapConstant.DART_CLASS);
1150 enqueueClass(compiler.enqueuer.resolution, e, elements); 1152 enqueue(MapConstant.DART_PROTO_CLASS);
1151 } 1153 enqueue(MapConstant.DART_STRING_CLASS);
1154 enqueue(MapConstant.DART_GENERAL_CLASS);
1152 } 1155 }
1153 1156
1154 void codegen(CodegenWorkItem work) { 1157 void codegen(CodegenWorkItem work) {
1155 Element element = work.element; 1158 Element element = work.element;
1156 var kind = element.kind; 1159 var kind = element.kind;
1157 if (kind == ElementKind.TYPEDEF) return; 1160 if (kind == ElementKind.TYPEDEF) return;
1158 if (element.isConstructor() && element.getEnclosingClass() == jsNullClass) { 1161 if (element.isConstructor() && element.getEnclosingClass() == jsNullClass) {
1159 // Work around a problem compiling JSNull's constructor. 1162 // Work around a problem compiling JSNull's constructor.
1160 return; 1163 return;
1161 } 1164 }
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
1779 copy(constant.values); 1782 copy(constant.values);
1780 copy(constant.protoValue); 1783 copy(constant.protoValue);
1781 copy(constant); 1784 copy(constant);
1782 } 1785 }
1783 1786
1784 void visitConstructed(ConstructedConstant constant) { 1787 void visitConstructed(ConstructedConstant constant) {
1785 copy(constant.fields); 1788 copy(constant.fields);
1786 copy(constant); 1789 copy(constant);
1787 } 1790 }
1788 } 1791 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698