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

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

Issue 851683004: dart2js: register output units explicitly in the program builder. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase Created 5 years, 11 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 | « no previous file | pkg/compiler/lib/src/js_emitter/registry.dart » ('j') | 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 library dart2js.js_emitter.program_builder; 5 library dart2js.js_emitter.program_builder;
6 6
7 import 'js_emitter.dart' show computeMixinClass; 7 import 'js_emitter.dart' show computeMixinClass;
8 import 'model.dart'; 8 import 'model.dart';
9 9
10 import '../common.dart'; 10 import '../common.dart';
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 /// Mapping from [OutputUnit] to constructed [Fragment]. We need this to 52 /// Mapping from [OutputUnit] to constructed [Fragment]. We need this to
53 /// generate the deferredLoadingMap (to know which hunks to load). 53 /// generate the deferredLoadingMap (to know which hunks to load).
54 final Map<OutputUnit, Fragment> _outputs = <OutputUnit, Fragment>{}; 54 final Map<OutputUnit, Fragment> _outputs = <OutputUnit, Fragment>{};
55 55
56 /// Mapping from [ConstantValue] to constructed [Constant]. We need this to 56 /// Mapping from [ConstantValue] to constructed [Constant]. We need this to
57 /// update field-initializers to point to the ConstantModel. 57 /// update field-initializers to point to the ConstantModel.
58 final Map<ConstantValue, Constant> _constants = <ConstantValue, Constant>{}; 58 final Map<ConstantValue, Constant> _constants = <ConstantValue, Constant>{};
59 59
60 Program buildProgram() { 60 Program buildProgram() {
61 // Note: In rare cases (mostly tests) output units can be empty. This
62 // happens when the deferred code is dead-code eliminated but we still need
63 // to check that the library has been loaded.
64 _compiler.deferredLoadTask.allOutputUnits.forEach(
65 _registry.registerOutputUnit);
61 _task.outputClassLists.forEach(_registry.registerElements); 66 _task.outputClassLists.forEach(_registry.registerElements);
62 _task.outputStaticLists.forEach(_registry.registerElements); 67 _task.outputStaticLists.forEach(_registry.registerElements);
63 _task.outputConstantLists.forEach(_registerConstants); 68 _task.outputConstantLists.forEach(_registerConstants);
64 69
65 // TODO(kasperl): There's code that implicitly needs access to the special 70 // TODO(kasperl): There's code that implicitly needs access to the special
66 // $ holder so we have to register that. Can we track if we have to? 71 // $ holder so we have to register that. Can we track if we have to?
67 _registry.registerHolder(r'$'); 72 _registry.registerHolder(r'$');
68 73
69 MainFragment mainOutput = _buildMainOutput(_registry.mainLibrariesMap); 74 MainFragment mainOutput = _buildMainOutput(_registry.mainLibrariesMap);
70 Iterable<Fragment> deferredOutputs = _registry.deferredLibrariesMap 75 Iterable<Fragment> deferredOutputs = _registry.deferredLibrariesMap
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 _registry.registerConstant(outputUnit, constantValue); 448 _registry.registerConstant(outputUnit, constantValue);
444 assert(!_constants.containsKey(constantValue)); 449 assert(!_constants.containsKey(constantValue));
445 String name = namer.constantName(constantValue); 450 String name = namer.constantName(constantValue);
446 String constantObject = namer.globalObjectForConstant(constantValue); 451 String constantObject = namer.globalObjectForConstant(constantValue);
447 Holder holder = _registry.registerHolder(constantObject); 452 Holder holder = _registry.registerHolder(constantObject);
448 Constant constant = new Constant(name, holder, constantValue); 453 Constant constant = new Constant(name, holder, constantValue);
449 _constants[constantValue] = constant; 454 _constants[constantValue] = constant;
450 }; 455 };
451 } 456 }
452 } 457 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/registry.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698