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

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

Issue 2675103003: Refactor BackendHelpers to be reusageable with KernelWorldBuilder (Closed)
Patch Set: Updated cf. comments Created 3 years, 10 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.program_builder; 5 library dart2js.js_emitter.program_builder;
6 6
7 import '../../closure.dart' show ClosureFieldElement; 7 import '../../closure.dart' show ClosureFieldElement;
8 import '../../common.dart'; 8 import '../../common.dart';
9 import '../../common/names.dart' show Names, Selectors; 9 import '../../common/names.dart' show Names, Selectors;
10 import '../../compiler.dart' show Compiler; 10 import '../../compiler.dart' show Compiler;
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 Class cls = _classes[element]; 812 Class cls = _classes[element];
813 if (cls != null) cls.isEager = true; 813 if (cls != null) cls.isEager = true;
814 } 814 }
815 } 815 }
816 } 816 }
817 817
818 Iterable<StaticStubMethod> _generateGetInterceptorMethods() { 818 Iterable<StaticStubMethod> _generateGetInterceptorMethods() {
819 InterceptorStubGenerator stubGenerator = 819 InterceptorStubGenerator stubGenerator =
820 new InterceptorStubGenerator(_compiler, namer, backend, closedWorld); 820 new InterceptorStubGenerator(_compiler, namer, backend, closedWorld);
821 821
822 String holderName = namer.globalObjectFor(helpers.interceptorsLibrary); 822 String holderName =
823 namer.globalObjectForLibrary(helpers.interceptorsLibrary);
823 // TODO(floitsch): we shouldn't update the registry in the middle of 824 // TODO(floitsch): we shouldn't update the registry in the middle of
824 // generating the interceptor methods. 825 // generating the interceptor methods.
825 Holder holder = _registry.registerHolder(holderName); 826 Holder holder = _registry.registerHolder(holderName);
826 827
827 Map<js.Name, Set<ClassElement>> specializedGetInterceptors = 828 Map<js.Name, Set<ClassElement>> specializedGetInterceptors =
828 backend.specializedGetInterceptors; 829 backend.specializedGetInterceptors;
829 List<js.Name> names = specializedGetInterceptors.keys.toList()..sort(); 830 List<js.Name> names = specializedGetInterceptors.keys.toList()..sort();
830 return names.map((js.Name name) { 831 return names.map((js.Name name) {
831 Set<ClassElement> classes = specializedGetInterceptors[name]; 832 Set<ClassElement> classes = specializedGetInterceptors[name];
832 js.Expression code = stubGenerator.generateGetInterceptorMethod(classes); 833 js.Expression code = stubGenerator.generateGetInterceptorMethod(classes);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 needsCheckedSetter)); 877 needsCheckedSetter));
877 }); 878 });
878 879
879 return fields; 880 return fields;
880 } 881 }
881 882
882 Iterable<StaticStubMethod> _generateOneShotInterceptors() { 883 Iterable<StaticStubMethod> _generateOneShotInterceptors() {
883 InterceptorStubGenerator stubGenerator = 884 InterceptorStubGenerator stubGenerator =
884 new InterceptorStubGenerator(_compiler, namer, backend, closedWorld); 885 new InterceptorStubGenerator(_compiler, namer, backend, closedWorld);
885 886
886 String holderName = namer.globalObjectFor(helpers.interceptorsLibrary); 887 String holderName =
888 namer.globalObjectForLibrary(helpers.interceptorsLibrary);
887 // TODO(floitsch): we shouldn't update the registry in the middle of 889 // TODO(floitsch): we shouldn't update the registry in the middle of
888 // generating the interceptor methods. 890 // generating the interceptor methods.
889 Holder holder = _registry.registerHolder(holderName); 891 Holder holder = _registry.registerHolder(holderName);
890 892
891 List<js.Name> names = backend.oneShotInterceptors.keys.toList()..sort(); 893 List<js.Name> names = backend.oneShotInterceptors.keys.toList()..sort();
892 return names.map((js.Name name) { 894 return names.map((js.Name name) {
893 js.Expression code = stubGenerator.generateOneShotInterceptor(name); 895 js.Expression code = stubGenerator.generateOneShotInterceptor(name);
894 return new StaticStubMethod(name, holder, code); 896 return new StaticStubMethod(name, holder, code);
895 }); 897 });
896 } 898 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 Constant constant = new Constant(name, holder, constantValue); 963 Constant constant = new Constant(name, holder, constantValue);
962 _constants[constantValue] = constant; 964 _constants[constantValue] = constant;
963 } 965 }
964 } 966 }
965 967
966 Holder _registerStaticStateHolder() { 968 Holder _registerStaticStateHolder() {
967 return _registry.registerHolder(namer.staticStateHolder, 969 return _registry.registerHolder(namer.staticStateHolder,
968 isStaticStateHolder: true); 970 isStaticStateHolder: true);
969 } 971 }
970 } 972 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart ('k') | pkg/compiler/lib/src/kernel/world_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698