| OLD | NEW |
| 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 1441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1452 if (classes != null) { | 1452 if (classes != null) { |
| 1453 for (ClassElement element in classes) { | 1453 for (ClassElement element in classes) { |
| 1454 generateClass(element, getElementDescriptor(element)); | 1454 generateClass(element, getElementDescriptor(element)); |
| 1455 } | 1455 } |
| 1456 } | 1456 } |
| 1457 | 1457 |
| 1458 if (compiler.enableMinification) { | 1458 if (compiler.enableMinification) { |
| 1459 mainBuffer.write(';'); | 1459 mainBuffer.write(';'); |
| 1460 } | 1460 } |
| 1461 | 1461 |
| 1462 if (elementDescriptors.isNotEmpty) { | 1462 Iterable<LibraryElement> libraries = |
| 1463 Iterable<LibraryElement> libraries = | 1463 task.outputLibraryLists[mainOutputUnit]; |
| 1464 task.outputLibraryLists[mainOutputUnit]; | 1464 if (libraries == null) libraries = []; |
| 1465 if (libraries == null) libraries = []; | 1465 emitLibraries(libraries); |
| 1466 emitLibraries(libraries); | 1466 emitTypedefs(); |
| 1467 emitTypedefs(); | 1467 emitMangledNames(); |
| 1468 emitMangledNames(); | |
| 1469 | 1468 |
| 1470 checkEverythingEmitted(elementDescriptors.keys); | 1469 checkEverythingEmitted(elementDescriptors.keys); |
| 1471 | 1470 |
| 1472 CodeBuffer libraryBuffer = new CodeBuffer(); | 1471 CodeBuffer libraryBuffer = new CodeBuffer(); |
| 1473 for (LibraryElement library in Elements.sortedByPosition(libraries)) { | 1472 for (LibraryElement library in Elements.sortedByPosition(libraries)) { |
| 1474 writeLibraryDescriptors(libraryBuffer, library); | 1473 writeLibraryDescriptors(libraryBuffer, library); |
| 1475 elementDescriptors.remove(library); | 1474 elementDescriptors.remove(library); |
| 1476 } | 1475 } |
| 1477 | 1476 |
| 1478 mainBuffer | 1477 mainBuffer |
| 1479 ..write( | 1478 ..write( |
| 1480 jsAst.prettyPrint( | 1479 jsAst.prettyPrint( |
| 1481 getReflectionDataParser(this, backend), | 1480 getReflectionDataParser(this, backend), |
| 1482 compiler)) | 1481 compiler)) |
| 1483 ..write(n); | 1482 ..write(n); |
| 1484 | 1483 |
| 1485 mainBuffer..write('$parseReflectionDataName([$n') | 1484 mainBuffer..write('$parseReflectionDataName([$n') |
| 1486 ..write(libraryBuffer) | 1485 ..write(libraryBuffer) |
| 1487 ..write('])$N'); | 1486 ..write('])$N'); |
| 1488 } | |
| 1489 | 1487 |
| 1490 interceptorEmitter.emitGetInterceptorMethods(mainBuffer); | 1488 interceptorEmitter.emitGetInterceptorMethods(mainBuffer); |
| 1491 interceptorEmitter.emitOneShotInterceptors(mainBuffer); | 1489 interceptorEmitter.emitOneShotInterceptors(mainBuffer); |
| 1492 | 1490 |
| 1493 if (task.outputContainsConstantList) { | 1491 if (task.outputContainsConstantList) { |
| 1494 emitMakeConstantList(mainBuffer); | 1492 emitMakeConstantList(mainBuffer); |
| 1495 } | 1493 } |
| 1496 | 1494 |
| 1497 // Constants in checked mode call into RTI code to set type information | 1495 // Constants in checked mode call into RTI code to set type information |
| 1498 // which may need getInterceptor (and one-shot interceptor) methods, so | 1496 // which may need getInterceptor (and one-shot interceptor) methods, so |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2033 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { | 2031 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { |
| 2034 if (element.isInstanceMember) { | 2032 if (element.isInstanceMember) { |
| 2035 cachedClassBuilders.remove(element.enclosingClass); | 2033 cachedClassBuilders.remove(element.enclosingClass); |
| 2036 | 2034 |
| 2037 nativeEmitter.cachedBuilders.remove(element.enclosingClass); | 2035 nativeEmitter.cachedBuilders.remove(element.enclosingClass); |
| 2038 | 2036 |
| 2039 } | 2037 } |
| 2040 } | 2038 } |
| 2041 } | 2039 } |
| 2042 } | 2040 } |
| OLD | NEW |