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

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

Issue 872403002: Don't create builders to determine if a native class is trivial or not. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 | Annotate | Revision Log
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/old_emitter/class_emitter.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 Set<ClassElement> get neededClasses => task.neededClasses; 45 Set<ClassElement> get neededClasses => task.neededClasses;
46 Map<OutputUnit, List<ClassElement>> get outputClassLists 46 Map<OutputUnit, List<ClassElement>> get outputClassLists
47 => task.outputClassLists; 47 => task.outputClassLists;
48 Map<OutputUnit, List<ConstantValue>> get outputConstantLists 48 Map<OutputUnit, List<ConstantValue>> get outputConstantLists
49 => task.outputConstantLists; 49 => task.outputConstantLists;
50 List<ClassElement> get nativeClasses => task.nativeClasses; 50 List<ClassElement> get nativeClasses => task.nativeClasses;
51 final Map<String, String> mangledFieldNames = <String, String>{}; 51 final Map<String, String> mangledFieldNames = <String, String>{};
52 final Map<String, String> mangledGlobalFieldNames = <String, String>{}; 52 final Map<String, String> mangledGlobalFieldNames = <String, String>{};
53 final Set<String> recordedMangledNames = new Set<String>(); 53 final Set<String> recordedMangledNames = new Set<String>();
54 54
55 final Map<ClassElement, Map<String, jsAst.Expression>> additionalProperties = 55 final Map<Class, Map<String, jsAst.Expression>> additionalProperties =
56 new Map<ClassElement, Map<String, jsAst.Expression>>(); 56 new Map<Class, Map<String, jsAst.Expression>>();
57 57
58 List<TypedefElement> get typedefsNeededForReflection => 58 List<TypedefElement> get typedefsNeededForReflection =>
59 task.typedefsNeededForReflection; 59 task.typedefsNeededForReflection;
60 60
61 JavaScriptBackend get backend => compiler.backend; 61 JavaScriptBackend get backend => compiler.backend;
62 TypeVariableHandler get typeVariableHandler => backend.typeVariableHandler; 62 TypeVariableHandler get typeVariableHandler => backend.typeVariableHandler;
63 63
64 String get _ => space; 64 String get _ => space;
65 String get space => compiler.enableMinification ? "" : " "; 65 String get space => compiler.enableMinification ? "" : " ";
66 String get n => compiler.enableMinification ? "" : "\n"; 66 String get n => compiler.enableMinification ? "" : "\n";
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 var \$desc; 709 var \$desc;
710 #; 710 #;
711 return #; 711 return #;
712 }''', 712 }''',
713 [cspPrecompiledFunctionFor(outputUnit), 713 [cspPrecompiledFunctionFor(outputUnit),
714 new jsAst.ArrayInitializer( 714 new jsAst.ArrayInitializer(
715 cspPrecompiledConstructorNamesFor(outputUnit))]); 715 cspPrecompiledConstructorNamesFor(outputUnit))]);
716 } 716 }
717 717
718 void emitClass(Class cls, ClassBuilder enclosingBuilder) { 718 void emitClass(Class cls, ClassBuilder enclosingBuilder) {
719 // Native classes are handled by the native emitter.
720 assert(!cls.isNative || cls.onlyForRti);
721
722 ClassElement classElement = cls.element; 719 ClassElement classElement = cls.element;
723 compiler.withCurrentElement(classElement, () { 720 compiler.withCurrentElement(classElement, () {
724 if (compiler.hasIncrementalSupport) { 721 if (compiler.hasIncrementalSupport) {
725 ClassBuilder cachedBuilder = 722 ClassBuilder cachedBuilder =
726 cachedClassBuilders.putIfAbsent(classElement, () { 723 cachedClassBuilders.putIfAbsent(classElement, () {
727 ClassBuilder builder = new ClassBuilder(classElement, namer); 724 ClassBuilder builder = new ClassBuilder(classElement, namer);
728 classEmitter.emitClass( 725 classEmitter.emitClass(
729 cls, builder, additionalProperties[classElement]); 726 cls, builder, additionalProperties[cls]);
730 return builder; 727 return builder;
731 }); 728 });
732 invariant(classElement, cachedBuilder.fields.isEmpty); 729 invariant(classElement, cachedBuilder.fields.isEmpty);
733 invariant(classElement, cachedBuilder.superName == null); 730 invariant(classElement, cachedBuilder.superName == null);
734 invariant(classElement, cachedBuilder.functionType == null); 731 invariant(classElement, cachedBuilder.functionType == null);
735 invariant(classElement, cachedBuilder.fieldMetadata == null); 732 invariant(classElement, cachedBuilder.fieldMetadata == null);
736 enclosingBuilder.properties.addAll(cachedBuilder.properties); 733 enclosingBuilder.properties.addAll(cachedBuilder.properties);
737 } else { 734 } else {
738 classEmitter.emitClass( 735 classEmitter.emitClass(
739 cls, enclosingBuilder, additionalProperties[classElement]); 736 cls, enclosingBuilder, additionalProperties[cls]);
740 } 737 }
741 }); 738 });
742 } 739 }
743 740
744 void emitStaticFunctions(Iterable<Method> staticFunctions) { 741 void emitStaticFunctions(Iterable<Method> staticFunctions) {
745 if (staticFunctions == null) return; 742 if (staticFunctions == null) return;
746 // We need to filter out null-elements for the interceptors. 743 // We need to filter out null-elements for the interceptors.
747 Iterable<Element> elements = staticFunctions 744 Iterable<Element> elements = staticFunctions
748 .where((Method method) => method.element != null) 745 .where((Method method) => method.element != null)
749 .map((Method method) => method.element); 746 .map((Method method) => method.element);
(...skipping 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after
2095 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { 2092 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) {
2096 if (element.isInstanceMember) { 2093 if (element.isInstanceMember) {
2097 cachedClassBuilders.remove(element.enclosingClass); 2094 cachedClassBuilders.remove(element.enclosingClass);
2098 2095
2099 nativeEmitter.cachedBuilders.remove(element.enclosingClass); 2096 nativeEmitter.cachedBuilders.remove(element.enclosingClass);
2100 2097
2101 } 2098 }
2102 } 2099 }
2103 } 2100 }
2104 } 2101 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/old_emitter/class_emitter.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698