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

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

Issue 785303003: Add option for outputting a deferred loading mapping. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments 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
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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 backend.emitter.staticFunctionAccess(_compiler.mainFunction), 119 backend.emitter.staticFunctionAccess(_compiler.mainFunction),
120 _buildLibraries(fragment), 120 _buildLibraries(fragment),
121 _buildStaticNonFinalFields(fragment), 121 _buildStaticNonFinalFields(fragment),
122 _buildStaticLazilyInitializedFields(fragment), 122 _buildStaticLazilyInitializedFields(fragment),
123 _buildConstants(fragment), 123 _buildConstants(fragment),
124 _registry.holders.toList(growable: false)); 124 _registry.holders.toList(growable: false));
125 _outputs[fragment.outputUnit] = result; 125 _outputs[fragment.outputUnit] = result;
126 return result; 126 return result;
127 } 127 }
128 128
129 /// Returns a name composed of the main output file name and [name].
130 String _outputFileName(String name) {
131 assert(name != "");
132 String outPath = _compiler.outputUri != null
133 ? _compiler.outputUri.path
134 : "out";
135 String outName = outPath.substring(outPath.lastIndexOf('/') + 1);
136 return "${outName}_$name";
137 }
138
139 DeferredOutput _buildDeferredOutput(MainOutput mainOutput, 129 DeferredOutput _buildDeferredOutput(MainOutput mainOutput,
140 Fragment fragment) { 130 Fragment fragment) {
141 DeferredOutput result = new DeferredOutput( 131 DeferredOutput result = new DeferredOutput(
142 _outputFileName(fragment.name), fragment.name, 132 backend.outputFileName(fragment.name), fragment.name,
143 mainOutput, 133 mainOutput,
144 _buildLibraries(fragment), 134 _buildLibraries(fragment),
145 _buildStaticNonFinalFields(fragment), 135 _buildStaticNonFinalFields(fragment),
146 _buildStaticLazilyInitializedFields(fragment), 136 _buildStaticLazilyInitializedFields(fragment),
147 _buildConstants(fragment)); 137 _buildConstants(fragment));
148 _outputs[fragment.outputUnit] = result; 138 _outputs[fragment.outputUnit] = result;
149 return result; 139 return result;
150 } 140 }
151 141
152 List<Constant> _buildConstants(Fragment fragment) { 142 List<Constant> _buildConstants(Fragment fragment) {
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 for (ConstantValue constantValue in constantValues) { 407 for (ConstantValue constantValue in constantValues) {
418 assert(!_constants.containsKey(constantValue)); 408 assert(!_constants.containsKey(constantValue));
419 String name = namer.constantName(constantValue); 409 String name = namer.constantName(constantValue);
420 String constantObject = namer.globalObjectForConstant(constantValue); 410 String constantObject = namer.globalObjectForConstant(constantValue);
421 Holder holder = _registry.registerHolder(constantObject); 411 Holder holder = _registry.registerHolder(constantObject);
422 Constant constant = new Constant(name, holder, constantValue); 412 Constant constant = new Constant(name, holder, constantValue);
423 _constants[constantValue] = constant; 413 _constants[constantValue] = constant;
424 }; 414 };
425 } 415 }
426 } 416 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698