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

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

Issue 1227643003: dart2js: Move most of the code_emitter_task code into the program-builder. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Upload Created 5 years, 5 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 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;
11 11
12 // The following fields will be set to copies of the program-builder's
13 // collector.
14 Map<OutputUnit, List<VariableElement>> outputStaticNonFinalFieldLists;
15 Map<OutputUnit, Set<LibraryElement>> outputLibraryLists;
16 List<TypedefElement> typedefsNeededForReflection;
17
12 final ContainerBuilder containerBuilder = new ContainerBuilder(); 18 final ContainerBuilder containerBuilder = new ContainerBuilder();
13 final ClassEmitter classEmitter = new ClassEmitter(); 19 final ClassEmitter classEmitter = new ClassEmitter();
14 final NsmEmitter nsmEmitter = new NsmEmitter(); 20 final NsmEmitter nsmEmitter = new NsmEmitter();
15 final InterceptorEmitter interceptorEmitter = new InterceptorEmitter(); 21 final InterceptorEmitter interceptorEmitter = new InterceptorEmitter();
16 22
17 // TODO(johnniwinther): Wrap these fields in a caching strategy. 23 // TODO(johnniwinther): Wrap these fields in a caching strategy.
18 final Set<ConstantValue> cachedEmittedConstants; 24 final Set<ConstantValue> cachedEmittedConstants;
19 final List<jsAst.Statement> cachedEmittedConstantsAst = <jsAst.Statement>[]; 25 final List<jsAst.Statement> cachedEmittedConstantsAst = <jsAst.Statement>[];
20 final Map<Element, ClassBuilder> cachedClassBuilders; 26 final Map<Element, ClassBuilder> cachedClassBuilders;
21 final Set<Element> cachedElements; 27 final Set<Element> cachedElements;
(...skipping 15 matching lines...) Expand all
37 // The full code that is written to each hunk part-file. 43 // The full code that is written to each hunk part-file.
38 Map<OutputUnit, CodeOutput> outputBuffers = new Map<OutputUnit, CodeOutput>(); 44 Map<OutputUnit, CodeOutput> outputBuffers = new Map<OutputUnit, CodeOutput>();
39 45
40 String classesCollector; 46 String classesCollector;
41 final Map<jsAst.Name, String> mangledFieldNames = 47 final Map<jsAst.Name, String> mangledFieldNames =
42 new HashMap<jsAst.Name, String>(); 48 new HashMap<jsAst.Name, String>();
43 final Map<jsAst.Name, String> mangledGlobalFieldNames = 49 final Map<jsAst.Name, String> mangledGlobalFieldNames =
44 new HashMap<jsAst.Name, String>(); 50 new HashMap<jsAst.Name, String>();
45 final Set<jsAst.Name> recordedMangledNames = new Set<jsAst.Name>(); 51 final Set<jsAst.Name> recordedMangledNames = new Set<jsAst.Name>();
46 52
47 List<TypedefElement> get typedefsNeededForReflection =>
48 task.typedefsNeededForReflection;
49
50 JavaScriptBackend get backend => compiler.backend; 53 JavaScriptBackend get backend => compiler.backend;
51 TypeVariableHandler get typeVariableHandler => backend.typeVariableHandler; 54 TypeVariableHandler get typeVariableHandler => backend.typeVariableHandler;
52 55
53 String get _ => space; 56 String get _ => space;
54 String get space => compiler.enableMinification ? "" : " "; 57 String get space => compiler.enableMinification ? "" : " ";
55 String get n => compiler.enableMinification ? "" : "\n"; 58 String get n => compiler.enableMinification ? "" : "\n";
56 String get N => compiler.enableMinification ? "\n" : ";\n"; 59 String get N => compiler.enableMinification ? "\n" : ";\n";
57 60
58 /** 61 /**
59 * List of expressions and statements that will be included in the 62 * List of expressions and statements that will be included in the
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 jsAst.Expression initialValue) { 529 jsAst.Expression initialValue) {
527 // Note: `namer.currentIsolate` refers to the isolate properties here. 530 // Note: `namer.currentIsolate` refers to the isolate properties here.
528 return js.statement('${namer.currentIsolate}.# = #', 531 return js.statement('${namer.currentIsolate}.# = #',
529 [namer.globalPropertyName(element), initialValue]); 532 [namer.globalPropertyName(element), initialValue]);
530 } 533 }
531 534
532 bool inMainUnit = (outputUnit == compiler.deferredLoadTask.mainOutputUnit); 535 bool inMainUnit = (outputUnit == compiler.deferredLoadTask.mainOutputUnit);
533 JavaScriptConstantCompiler handler = backend.constants; 536 JavaScriptConstantCompiler handler = backend.constants;
534 List<jsAst.Statement> parts = <jsAst.Statement>[]; 537 List<jsAst.Statement> parts = <jsAst.Statement>[];
535 538
536 Iterable<Element> fields = task.outputStaticNonFinalFieldLists[outputUnit]; 539 Iterable<Element> fields = outputStaticNonFinalFieldLists[outputUnit];
537 // If the outputUnit does not contain any static non-final fields, then 540 // If the outputUnit does not contain any static non-final fields, then
538 // [fields] is `null`. 541 // [fields] is `null`.
539 if (fields != null) { 542 if (fields != null) {
540 for (Element element in fields) { 543 for (Element element in fields) {
541 compiler.withCurrentElement(element, () { 544 compiler.withCurrentElement(element, () {
542 ConstantValue constant = handler.getInitialValueFor(element); 545 ConstantValue constant = handler.getInitialValueFor(element);
543 parts.add(buildInitialization(element, constantReference(constant))); 546 parts.add(buildInitialization(element, constantReference(constant)));
544 }); 547 });
545 } 548 }
546 } 549 }
547 550
548 if (inMainUnit && task.outputStaticNonFinalFieldLists.length > 1) { 551 if (inMainUnit && outputStaticNonFinalFieldLists.length > 1) {
549 // In the main output-unit we output a stub initializer for deferred 552 // In the main output-unit we output a stub initializer for deferred
550 // variables, so that `isolateProperties` stays a fast object. 553 // variables, so that `isolateProperties` stays a fast object.
551 task.outputStaticNonFinalFieldLists.forEach( 554 outputStaticNonFinalFieldLists.forEach(
552 (OutputUnit fieldsOutputUnit, Iterable<VariableElement> fields) { 555 (OutputUnit fieldsOutputUnit, Iterable<VariableElement> fields) {
553 if (fieldsOutputUnit == outputUnit) return; // Skip the main unit. 556 if (fieldsOutputUnit == outputUnit) return; // Skip the main unit.
554 for (Element element in fields) { 557 for (Element element in fields) {
555 compiler.withCurrentElement(element, () { 558 compiler.withCurrentElement(element, () {
556 parts.add(buildInitialization(element, jsAst.number(0))); 559 parts.add(buildInitialization(element, jsAst.number(0)));
557 }); 560 });
558 } 561 }
559 }); 562 });
560 } 563 }
561 564
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 return js.statement('#.# = #', 706 return js.statement('#.# = #',
704 [namer.globalObjectForConstant(constant), name, 707 [namer.globalObjectForConstant(constant), name,
705 constantInitializerExpression(constant)]); 708 constantInitializerExpression(constant)]);
706 } 709 }
707 710
708 jsAst.Expression constantListGenerator(jsAst.Expression array) { 711 jsAst.Expression constantListGenerator(jsAst.Expression array) {
709 // TODO(floitsch): there is no harm in caching the template. 712 // TODO(floitsch): there is no harm in caching the template.
710 return js('${namer.isolateName}.#(#)', [makeConstListProperty, array]); 713 return js('${namer.isolateName}.#(#)', [makeConstListProperty, array]);
711 } 714 }
712 715
713 jsAst.Statement buildMakeConstantList() { 716 jsAst.Statement buildMakeConstantList(bool outputContainsConstantList) {
714 if (task.outputContainsConstantList) { 717 if (outputContainsConstantList) {
715 return js.statement(r''' 718 return js.statement(r'''
716 // Functions are stored in the hidden class and not as properties in 719 // Functions are stored in the hidden class and not as properties in
717 // the object. We never actually look at the value, but only want 720 // the object. We never actually look at the value, but only want
718 // to know if the property exists. 721 // to know if the property exists.
719 #.# = function (list) { 722 #.# = function (list) {
720 list.immutable$list = Array; 723 list.immutable$list = Array;
721 list.fixed$length = Array; 724 list.fixed$length = Array;
722 return list; 725 return list;
723 }''', 726 }''',
724 [namer.isolateName, makeConstListProperty]); 727 [namer.isolateName, makeConstListProperty]);
(...skipping 26 matching lines...) Expand all
751 js("convertToFastObject", []))); 754 js("convertToFastObject", [])));
752 } 755 }
753 756
754 parts..add(js.comment('BEGIN invoke [main].')) 757 parts..add(js.comment('BEGIN invoke [main].'))
755 ..add(invokeMain) 758 ..add(invokeMain)
756 ..add(js.comment('END invoke [main].')); 759 ..add(js.comment('END invoke [main].'));
757 760
758 return new jsAst.Block(parts); 761 return new jsAst.Block(parts);
759 } 762 }
760 763
761 jsAst.Statement buildInitFunction() { 764 jsAst.Statement buildInitFunction(bool outputContainsConstantList) {
762 jsAst.Expression allClassesAccess = 765 jsAst.Expression allClassesAccess =
763 generateEmbeddedGlobalAccess(embeddedNames.ALL_CLASSES); 766 generateEmbeddedGlobalAccess(embeddedNames.ALL_CLASSES);
764 jsAst.Expression getTypeFromNameAccess = 767 jsAst.Expression getTypeFromNameAccess =
765 generateEmbeddedGlobalAccess(embeddedNames.GET_TYPE_FROM_NAME); 768 generateEmbeddedGlobalAccess(embeddedNames.GET_TYPE_FROM_NAME);
766 jsAst.Expression interceptorsByTagAccess = 769 jsAst.Expression interceptorsByTagAccess =
767 generateEmbeddedGlobalAccess(embeddedNames.INTERCEPTORS_BY_TAG); 770 generateEmbeddedGlobalAccess(embeddedNames.INTERCEPTORS_BY_TAG);
768 jsAst.Expression leafTagsAccess = 771 jsAst.Expression leafTagsAccess =
769 generateEmbeddedGlobalAccess(embeddedNames.LEAF_TAGS); 772 generateEmbeddedGlobalAccess(embeddedNames.LEAF_TAGS);
770 jsAst.Expression finishedClassesAccess = 773 jsAst.Expression finishedClassesAccess =
771 generateEmbeddedGlobalAccess(embeddedNames.FINISHED_CLASSES); 774 generateEmbeddedGlobalAccess(embeddedNames.FINISHED_CLASSES);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 } 888 }
886 889
887 }''', {'allClasses': allClassesAccess, 890 }''', {'allClasses': allClassesAccess,
888 'getTypeFromName': getTypeFromNameAccess, 891 'getTypeFromName': getTypeFromNameAccess,
889 'interceptorsByTag': interceptorsByTagAccess, 892 'interceptorsByTag': interceptorsByTagAccess,
890 'leafTags': leafTagsAccess, 893 'leafTags': leafTagsAccess,
891 'finishedClasses': finishedClassesAccess, 894 'finishedClasses': finishedClassesAccess,
892 'needsLazyInitializer': needsLazyInitializer, 895 'needsLazyInitializer': needsLazyInitializer,
893 'lazies': laziesAccess, 'cyclicThrow': cyclicThrow, 896 'lazies': laziesAccess, 'cyclicThrow': cyclicThrow,
894 'isolatePropertiesName': namer.isolatePropertiesName, 897 'isolatePropertiesName': namer.isolatePropertiesName,
895 'outputContainsConstantList': task.outputContainsConstantList, 898 'outputContainsConstantList': outputContainsConstantList,
896 'makeConstListProperty': makeConstListProperty, 899 'makeConstListProperty': makeConstListProperty,
897 'functionThatReturnsNullProperty': 900 'functionThatReturnsNullProperty':
898 backend.rti.getFunctionThatReturnsNullName, 901 backend.rti.getFunctionThatReturnsNullName,
899 'hasIncrementalSupport': compiler.hasIncrementalSupport, 902 'hasIncrementalSupport': compiler.hasIncrementalSupport,
900 'lazyInitializerProperty': lazyInitializerProperty,}); 903 'lazyInitializerProperty': lazyInitializerProperty,});
901 } 904 }
902 905
903 jsAst.Statement buildConvertToFastObjectFunction() { 906 jsAst.Statement buildConvertToFastObjectFunction() {
904 List<jsAst.Statement> debugCode = <jsAst.Statement>[]; 907 List<jsAst.Statement> debugCode = <jsAst.Statement>[];
905 if (DEBUG_FAST_OBJECTS) { 908 if (DEBUG_FAST_OBJECTS) {
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 'self.#deferredInitializers || Object.create(null);', 1273 'self.#deferredInitializers || Object.create(null);',
1271 {'deferredInitializers': deferredInitializers})); 1274 {'deferredInitializers': deferredInitializers}));
1272 } 1275 }
1273 1276
1274 // Collect the AST for the decriptors 1277 // Collect the AST for the decriptors
1275 Map<Element, ClassBuilder> descriptors = elementDescriptors[mainFragment]; 1278 Map<Element, ClassBuilder> descriptors = elementDescriptors[mainFragment];
1276 if (descriptors == null) descriptors = const {}; 1279 if (descriptors == null) descriptors = const {};
1277 1280
1278 checkEverythingEmitted(descriptors.keys); 1281 checkEverythingEmitted(descriptors.keys);
1279 1282
1280 Iterable<LibraryElement> libraries = 1283 Iterable<LibraryElement> libraries = outputLibraryLists[mainOutputUnit];
1281 task.outputLibraryLists[mainOutputUnit];
1282 if (libraries == null) libraries = <LibraryElement>[]; 1284 if (libraries == null) libraries = <LibraryElement>[];
1283 1285
1284 List<jsAst.Expression> parts = <jsAst.Expression>[]; 1286 List<jsAst.Expression> parts = <jsAst.Expression>[];
1285 for (LibraryElement library in Elements.sortedByPosition(libraries)) { 1287 for (LibraryElement library in Elements.sortedByPosition(libraries)) {
1286 parts.add(generateLibraryDescriptor(library, mainFragment)); 1288 parts.add(generateLibraryDescriptor(library, mainFragment));
1287 descriptors.remove(library); 1289 descriptors.remove(library);
1288 } 1290 }
1289 1291
1290 if (descriptors.isNotEmpty) { 1292 if (descriptors.isNotEmpty) {
1291 List<Element> remainingLibraries = descriptors.keys 1293 List<Element> remainingLibraries = descriptors.keys
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 "isolatePropertiesName": js(isolatePropertiesName), 1433 "isolatePropertiesName": js(isolatePropertiesName),
1432 "initName": initName, 1434 "initName": initName,
1433 "functionThatReturnsNull": buildFunctionThatReturnsNull(), 1435 "functionThatReturnsNull": buildFunctionThatReturnsNull(),
1434 "mangledNames": buildMangledNames(), 1436 "mangledNames": buildMangledNames(),
1435 "setupProgram": buildSetupProgram(program, compiler, backend, namer, this) , 1437 "setupProgram": buildSetupProgram(program, compiler, backend, namer, this) ,
1436 "setupProgramName": setupProgramName, 1438 "setupProgramName": setupProgramName,
1437 "descriptors": descriptorsAst, 1439 "descriptors": descriptorsAst,
1438 "cspPrecompiledFunctions": buildCspPrecompiledFunctionFor(mainOutputUnit), 1440 "cspPrecompiledFunctions": buildCspPrecompiledFunctionFor(mainOutputUnit),
1439 "getInterceptorMethods": interceptorEmitter.buildGetInterceptorMethods(), 1441 "getInterceptorMethods": interceptorEmitter.buildGetInterceptorMethods(),
1440 "oneShotInterceptors": interceptorEmitter.buildOneShotInterceptors(), 1442 "oneShotInterceptors": interceptorEmitter.buildOneShotInterceptors(),
1441 "makeConstantList": buildMakeConstantList(), 1443 "makeConstantList":
1444 buildMakeConstantList(program.outputContainsConstantList),
1442 "compileTimeConstants": buildCompileTimeConstants(mainFragment.constants, 1445 "compileTimeConstants": buildCompileTimeConstants(mainFragment.constants,
1443 isMainFragment: true), 1446 isMainFragment: true),
1444 "deferredBoilerPlate": buildDeferredBoilerPlate(deferredLoadHashes), 1447 "deferredBoilerPlate": buildDeferredBoilerPlate(deferredLoadHashes),
1445 "staticNonFinalInitializers": buildStaticNonFinalFieldInitializations( 1448 "staticNonFinalInitializers": buildStaticNonFinalFieldInitializations(
1446 mainOutputUnit), 1449 mainOutputUnit),
1447 "typeToInterceptorMap": 1450 "typeToInterceptorMap":
1448 interceptorEmitter.buildTypeToInterceptorMap(program), 1451 interceptorEmitter.buildTypeToInterceptorMap(program),
1449 "lazyStaticFields": buildLazilyInitializedStaticFields(), 1452 "lazyStaticFields": buildLazilyInitializedStaticFields(),
1450 "metadata": buildMetadata(program, mainOutputUnit), 1453 "metadata": buildMetadata(program, mainOutputUnit),
1451 "convertToFastObject": buildConvertToFastObjectFunction(), 1454 "convertToFastObject": buildConvertToFastObjectFunction(),
1452 "convertToSlowObject": buildConvertToSlowObjectFunction(), 1455 "convertToSlowObject": buildConvertToSlowObjectFunction(),
1453 "convertGlobalObjectsToFastObjects": 1456 "convertGlobalObjectsToFastObjects":
1454 buildConvertGlobalObjectToFastObjects(), 1457 buildConvertGlobalObjectToFastObjects(),
1455 "debugFastObjects": buildDebugFastObjectCode(), 1458 "debugFastObjects": buildDebugFastObjectCode(),
1456 "init": buildInitFunction(), 1459 "init": buildInitFunction(program.outputContainsConstantList),
1457 "main": buildMain(mainFragment.invokeMain) 1460 "main": buildMain(mainFragment.invokeMain)
1458 })); 1461 }));
1459 1462
1460 return new jsAst.Program(statements); 1463 return new jsAst.Program(statements);
1461 } 1464 }
1462 1465
1463 void emitMainOutputUnit(OutputUnit mainOutputUnit, jsAst.Program program) { 1466 void emitMainOutputUnit(OutputUnit mainOutputUnit, jsAst.Program program) {
1464 LineColumnCollector lineColumnCollector; 1467 LineColumnCollector lineColumnCollector;
1465 List<CodeOutputListener> codeOutputListeners; 1468 List<CodeOutputListener> codeOutputListeners;
1466 if (generateSourceMap) { 1469 if (generateSourceMap) {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 Program program) { 1619 Program program) {
1617 Map<OutputUnit, jsAst.Expression> outputs = 1620 Map<OutputUnit, jsAst.Expression> outputs =
1618 new Map<OutputUnit, jsAst.Expression>(); 1621 new Map<OutputUnit, jsAst.Expression>();
1619 1622
1620 for (Fragment fragment in program.deferredFragments) { 1623 for (Fragment fragment in program.deferredFragments) {
1621 OutputUnit outputUnit = fragment.outputUnit; 1624 OutputUnit outputUnit = fragment.outputUnit;
1622 1625
1623 Map<Element, ClassBuilder> descriptors = elementDescriptors[fragment]; 1626 Map<Element, ClassBuilder> descriptors = elementDescriptors[fragment];
1624 1627
1625 if (descriptors != null && descriptors.isNotEmpty) { 1628 if (descriptors != null && descriptors.isNotEmpty) {
1626 Iterable<LibraryElement> libraries = 1629 Iterable<LibraryElement> libraries = outputLibraryLists[outputUnit];
1627 task.outputLibraryLists[outputUnit];
1628 if (libraries == null) libraries = []; 1630 if (libraries == null) libraries = [];
1629 1631
1630 // TODO(johnniwinther): Avoid creating [CodeBuffer]s. 1632 // TODO(johnniwinther): Avoid creating [CodeBuffer]s.
1631 List<jsAst.Expression> parts = <jsAst.Expression>[]; 1633 List<jsAst.Expression> parts = <jsAst.Expression>[];
1632 for (LibraryElement library in Elements.sortedByPosition(libraries)) { 1634 for (LibraryElement library in Elements.sortedByPosition(libraries)) {
1633 parts.add(generateLibraryDescriptor(library, fragment)); 1635 parts.add(generateLibraryDescriptor(library, fragment));
1634 descriptors.remove(library); 1636 descriptors.remove(library);
1635 } 1637 }
1636 1638
1637 outputs[outputUnit] = new jsAst.ArrayInitializer(parts); 1639 outputs[outputUnit] = new jsAst.ArrayInitializer(parts);
1638 } 1640 }
1639 } 1641 }
1640 1642
1641 return outputs; 1643 return outputs;
1642 } 1644 }
1643 1645
1644 void finalizeTokensInAst(jsAst.Program main, 1646 void finalizeTokensInAst(jsAst.Program main,
1645 Iterable<jsAst.Program> deferredParts) { 1647 Iterable<jsAst.Program> deferredParts) {
1646 jsAst.TokenCounter counter = new jsAst.TokenCounter(); 1648 jsAst.TokenCounter counter = new jsAst.TokenCounter();
1647 counter.countTokens(main); 1649 counter.countTokens(main);
1648 deferredParts.forEach(counter.countTokens); 1650 deferredParts.forEach(counter.countTokens);
1649 task.metadataCollector.finalizeTokens(); 1651 task.metadataCollector.finalizeTokens();
1650 if (backend.namer is jsAst.TokenFinalizer) { 1652 if (backend.namer is jsAst.TokenFinalizer) {
1651 var finalizer = backend.namer; 1653 var finalizer = backend.namer;
1652 finalizer.finalizeTokens(); 1654 finalizer.finalizeTokens();
1653 } 1655 }
1654 } 1656 }
1655 1657
1656 int emitProgram(ProgramBuilder programBuilder) { 1658 int emitProgram(ProgramBuilder programBuilder) {
1657 Program program = programBuilder.buildProgram( 1659 Program program =
1658 storeFunctionTypesInMetadata: true); 1660 programBuilder.buildProgram(storeFunctionTypesInMetadata: true);
1661
1662 outputStaticNonFinalFieldLists =
1663 programBuilder.collector.outputStaticNonFinalFieldLists;
1664 outputLibraryLists = programBuilder.collector.outputLibraryLists;
1665 typedefsNeededForReflection =
1666 programBuilder.collector.typedefsNeededForReflection;
1659 1667
1660 assembleProgram(program); 1668 assembleProgram(program);
1661 1669
1662 // Construct the ASTs for all deferred output units. 1670 // Construct the ASTs for all deferred output units.
1663 Map<OutputUnit, jsAst.Program> deferredParts = 1671 Map<OutputUnit, jsAst.Program> deferredParts =
1664 buildOutputAstForDeferredCode(program); 1672 buildOutputAstForDeferredCode(program);
1665 1673
1666 Map<OutputUnit, _DeferredOutputUnitHash> deferredHashTokens = 1674 Map<OutputUnit, _DeferredOutputUnitHash> deferredHashTokens =
1667 new Map<OutputUnit, _DeferredOutputUnitHash>.fromIterables( 1675 new Map<OutputUnit, _DeferredOutputUnitHash>.fromIterables(
1668 deferredParts.keys, 1676 deferredParts.keys,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 return ''' 1711 return '''
1704 1712
1705 //# sourceMappingURL=$sourceMapFileName 1713 //# sourceMappingURL=$sourceMapFileName
1706 '''; 1714 ''';
1707 } 1715 }
1708 return ''; 1716 return '';
1709 } 1717 }
1710 1718
1711 ClassBuilder getElementDescriptor(Element element, Fragment fragment) { 1719 ClassBuilder getElementDescriptor(Element element, Fragment fragment) {
1712 Element owner = element.library; 1720 Element owner = element.library;
1713 bool isClass = false;
1714 if (!element.isLibrary && !element.isTopLevel && !element.isNative) { 1721 if (!element.isLibrary && !element.isTopLevel && !element.isNative) {
1715 // For static (not top level) elements, record their code in a buffer 1722 // For static (not top level) elements, record their code in a buffer
1716 // specific to the class. For now, not supported for native classes and 1723 // specific to the class. For now, not supported for native classes and
1717 // native elements. 1724 // native elements.
1718 ClassElement cls = 1725 ClassElement cls =
1719 element.enclosingClassOrCompilationUnit.declaration; 1726 element.enclosingClassOrCompilationUnit.declaration;
1720 if (compiler.codegenWorld.directlyInstantiatedClasses.contains(cls) && 1727 if (compiler.codegenWorld.directlyInstantiatedClasses.contains(cls) &&
1721 !cls.isNative && 1728 !cls.isNative &&
1722 compiler.deferredLoadTask.outputUnitForElement(element) == 1729 compiler.deferredLoadTask.outputUnitForElement(element) ==
1723 compiler.deferredLoadTask.outputUnitForElement(cls)) { 1730 compiler.deferredLoadTask.outputUnitForElement(cls)) {
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
2003 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { 2010 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) {
2004 if (element.isInstanceMember) { 2011 if (element.isInstanceMember) {
2005 cachedClassBuilders.remove(element.enclosingClass); 2012 cachedClassBuilders.remove(element.enclosingClass);
2006 2013
2007 nativeEmitter.cachedBuilders.remove(element.enclosingClass); 2014 nativeEmitter.cachedBuilders.remove(element.enclosingClass);
2008 2015
2009 } 2016 }
2010 } 2017 }
2011 } 2018 }
2012 } 2019 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/code_emitter_task.dart ('k') | pkg/compiler/lib/src/js_emitter/native_emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698