| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.startup_emitter.model_emitter; | 5 library dart2js.js_emitter.startup_emitter.model_emitter; |
| 6 | 6 |
| 7 import 'dart:convert' show JsonEncoder; | 7 import 'dart:convert' show JsonEncoder; |
| 8 import 'dart:math' show Random; |
| 8 | 9 |
| 9 import 'package:js_runtime/shared/embedded_names.dart' | 10 import 'package:js_runtime/shared/embedded_names.dart' |
| 10 show | 11 show |
| 11 CLASS_FIELDS_EXTRACTOR, | 12 CLASS_FIELDS_EXTRACTOR, |
| 12 CLASS_ID_EXTRACTOR, | 13 CLASS_ID_EXTRACTOR, |
| 13 CREATE_NEW_ISOLATE, | 14 CREATE_NEW_ISOLATE, |
| 14 DEFERRED_INITIALIZED, | 15 DEFERRED_INITIALIZED, |
| 15 DEFERRED_LIBRARY_URIS, | 16 DEFERRED_LIBRARY_URIS, |
| 16 DEFERRED_LIBRARY_HASHES, | 17 DEFERRED_LIBRARY_HASHES, |
| 17 GET_TYPE_FROM_NAME, | 18 GET_TYPE_FROM_NAME, |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 writeDeferredFragments(deferredFragmentsCode); | 185 writeDeferredFragments(deferredFragmentsCode); |
| 185 | 186 |
| 186 // Now that we have written the deferred hunks, we can update the hash | 187 // Now that we have written the deferred hunks, we can update the hash |
| 187 // tokens in the main-fragment. | 188 // tokens in the main-fragment. |
| 188 deferredHashTokens | 189 deferredHashTokens |
| 189 .forEach((DeferredFragment key, _DeferredFragmentHash token) { | 190 .forEach((DeferredFragment key, _DeferredFragmentHash token) { |
| 190 token.setHash(hunkHashes[key]); | 191 token.setHash(hunkHashes[key]); |
| 191 }); | 192 }); |
| 192 | 193 |
| 193 writeMainFragment(mainFragment, mainCode, | 194 writeMainFragment(mainFragment, mainCode, |
| 194 isSplit: program.deferredFragments.isNotEmpty); | 195 isSplit: program.deferredFragments.isNotEmpty || |
| 196 program.hasSoftDeferredClasses || |
| 197 compiler.options.experimentalTrackAllocations); |
| 195 | 198 |
| 196 if (backend.backendUsage.requiresPreamble && !backend.htmlLibraryIsLoaded) { | 199 if (backend.backendUsage.requiresPreamble && !backend.htmlLibraryIsLoaded) { |
| 197 reporter.reportHintMessage(NO_LOCATION_SPANNABLE, MessageKind.PREAMBLE); | 200 reporter.reportHintMessage(NO_LOCATION_SPANNABLE, MessageKind.PREAMBLE); |
| 198 } | 201 } |
| 199 | 202 |
| 200 if (compiler.options.deferredMapUri != null) { | 203 if (compiler.options.deferredMapUri != null) { |
| 201 writeDeferredMap(); | 204 writeDeferredMap(); |
| 202 } | 205 } |
| 203 | 206 |
| 204 // Return the total program size. | 207 // Return the total program size. |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 // data. | 381 // data. |
| 379 mapping["_comment"] = "This mapping shows which compiled `.js` files are " | 382 mapping["_comment"] = "This mapping shows which compiled `.js` files are " |
| 380 "needed for a given deferred library import."; | 383 "needed for a given deferred library import."; |
| 381 mapping.addAll(compiler.deferredLoadTask.computeDeferredMap()); | 384 mapping.addAll(compiler.deferredLoadTask.computeDeferredMap()); |
| 382 compiler.outputProvider( | 385 compiler.outputProvider( |
| 383 compiler.options.deferredMapUri.path, '', OutputType.info) | 386 compiler.options.deferredMapUri.path, '', OutputType.info) |
| 384 ..add(const JsonEncoder.withIndent(" ").convert(mapping)) | 387 ..add(const JsonEncoder.withIndent(" ").convert(mapping)) |
| 385 ..close(); | 388 ..close(); |
| 386 } | 389 } |
| 387 } | 390 } |
| OLD | NEW |