| OLD | NEW |
| 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 dart2js.js_emitter; | 5 part of dart2js.js_emitter; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Generates the code for all used classes in the program. Static fields (even | 8 * Generates the code for all used classes in the program. Static fields (even |
| 9 * in classes) are ignored, since they can be treated as non-class elements. | 9 * in classes) are ignored, since they can be treated as non-class elements. |
| 10 * | 10 * |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 try { | 590 try { |
| 591 if (result === sentinelUndefined) { | 591 if (result === sentinelUndefined) { |
| 592 $isolate[fieldName] = sentinelInProgress; | 592 $isolate[fieldName] = sentinelInProgress; |
| 593 | 593 |
| 594 try { | 594 try { |
| 595 result = $isolate[fieldName] = lazyValue(); | 595 result = $isolate[fieldName] = lazyValue(); |
| 596 } finally { | 596 } finally { |
| 597 // Use try-finally, not try-catch/throw as it destroys the | 597 // Use try-finally, not try-catch/throw as it destroys the |
| 598 // stack trace. | 598 // stack trace. |
| 599 if (result === sentinelUndefined) | 599 if (result === sentinelUndefined) |
| 600 if ($isolate[fieldName] === sentinelInProgress) | 600 $isolate[fieldName] = null; |
| 601 $isolate[fieldName] = null; | |
| 602 } | 601 } |
| 603 } else { | 602 } else { |
| 604 if (result === sentinelInProgress) | 603 if (result === sentinelInProgress) |
| 605 #(staticName); | 604 #(staticName); |
| 606 } | 605 } |
| 607 | 606 |
| 608 return result; | 607 return result; |
| 609 } finally { | 608 } finally { |
| 610 $isolate[getterName] = function() { return this[fieldName]; }; | 609 $isolate[getterName] = function() { return this[fieldName]; }; |
| 611 } | 610 } |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1329 } | 1328 } |
| 1330 } | 1329 } |
| 1331 Map<OutputUnit, ClassBuilder> descriptors = elementDescriptors[library]; | 1330 Map<OutputUnit, ClassBuilder> descriptors = elementDescriptors[library]; |
| 1332 String libraryName = | 1331 String libraryName = |
| 1333 (!compiler.enableMinification || backend.mustRetainLibraryNames) ? | 1332 (!compiler.enableMinification || backend.mustRetainLibraryNames) ? |
| 1334 library.getLibraryName() : | 1333 library.getLibraryName() : |
| 1335 ""; | 1334 ""; |
| 1336 | 1335 |
| 1337 for (OutputUnit outputUnit in compiler.deferredLoadTask.allOutputUnits) { | 1336 for (OutputUnit outputUnit in compiler.deferredLoadTask.allOutputUnits) { |
| 1338 if (!descriptors.containsKey(outputUnit)) continue; | 1337 if (!descriptors.containsKey(outputUnit)) continue; |
| 1339 | 1338 |
| 1340 ClassBuilder descriptor = descriptors[outputUnit]; | 1339 ClassBuilder descriptor = descriptors[outputUnit]; |
| 1341 | 1340 |
| 1342 jsAst.Fun metadata = metadataEmitter.buildMetadataFunction(library); | 1341 jsAst.Fun metadata = metadataEmitter.buildMetadataFunction(library); |
| 1343 | 1342 |
| 1344 jsAst.ObjectInitializer initializers = descriptor.toObjectInitializer(); | 1343 jsAst.ObjectInitializer initializers = descriptor.toObjectInitializer(); |
| 1345 | 1344 |
| 1346 CodeBuffer libraryDescriptorBuffer = | 1345 CodeBuffer libraryDescriptorBuffer = |
| 1347 libraryDescriptorBuffers.putIfAbsent(outputUnit, | 1346 libraryDescriptorBuffers.putIfAbsent(outputUnit, |
| 1348 () => new CodeBuffer()); | 1347 () => new CodeBuffer()); |
| 1349 | 1348 |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1903 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { | 1902 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { |
| 1904 if (element.isInstanceMember) { | 1903 if (element.isInstanceMember) { |
| 1905 cachedClassBuilders.remove(element.enclosingClass); | 1904 cachedClassBuilders.remove(element.enclosingClass); |
| 1906 | 1905 |
| 1907 nativeEmitter.cachedBuilders.remove(element.enclosingClass); | 1906 nativeEmitter.cachedBuilders.remove(element.enclosingClass); |
| 1908 | 1907 |
| 1909 } | 1908 } |
| 1910 } | 1909 } |
| 1911 } | 1910 } |
| 1912 } | 1911 } |
| OLD | NEW |