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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_emitter/registry.dart

Issue 649873003: dart2js: Use computed classes/statics from code-emitter-task in new emitter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/js_emitter/program_builder.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/js_emitter/registry.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_emitter/registry.dart b/sdk/lib/_internal/compiler/implementation/js_emitter/registry.dart
index ee992647d30c4fcbb3446ef3b9e5ead398288a42..a0a078dac9352319bfb1e1e5b0027bb4d55e4c4f 100644
--- a/sdk/lib/_internal/compiler/implementation/js_emitter/registry.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_emitter/registry.dart
@@ -64,22 +64,26 @@ class Registry {
bool get _isProgramSplit => _deferredLoadTask.isProgramSplit;
OutputUnit get _mainOutputUnit => _deferredLoadTask.mainOutputUnit;
- Fragment _computeTargetFragment(Element element) {
+ Fragment _mapUnitToFragment(OutputUnit targetUnit) {
if (mainFragment == null) {
mainFragment = new Fragment.main(_deferredLoadTask.mainOutputUnit);
}
- if (!_isProgramSplit) return mainFragment;
- OutputUnit targetUnit = _deferredLoadTask.outputUnitForElement(element);
+ if (!_isProgramSplit) {
+ assert(targetUnit == _deferredLoadTask.mainOutputUnit);
+ return mainFragment;
+ }
if (targetUnit == _mainOutputUnit) return mainFragment;
String name = targetUnit.name;
return _deferredFragmentsMap.putIfAbsent(
targetUnit, () => new Fragment.deferred(targetUnit, name));
}
- /// Adds the element to the list of elements of the library in the right
- /// fragment.
- void registerElement(Element element) {
- _computeTargetFragment(element).add(element.library, element);
+ /// Adds all elements to their respective libraries in the correct fragment.
+ void registerElements(OutputUnit outputUnit, List<Element> elements) {
+ Fragment targetFragment = _mapUnitToFragment(outputUnit);
+ for (Element element in Elements.sortedByPosition(elements)) {
+ targetFragment.add(element.library, element);
+ }
}
Holder registerHolder(String name) {
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/js_emitter/program_builder.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698