| OLD | NEW |
| 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.lazy_emitter.model_emitter; | 5 library dart2js.js_emitter.lazy_emitter.model_emitter; |
| 6 | 6 |
| 7 import 'package:js_runtime/shared/embedded_names.dart' | 7 import 'package:js_runtime/shared/embedded_names.dart' |
| 8 show | 8 show |
| 9 CREATE_NEW_ISOLATE, | 9 CREATE_NEW_ISOLATE, |
| 10 DEFERRED_LIBRARY_URIS, | 10 DEFERRED_LIBRARY_URIS, |
| 11 DEFERRED_LIBRARY_HASHES, | 11 DEFERRED_LIBRARY_HASHES, |
| 12 GET_TYPE_FROM_NAME, | 12 GET_TYPE_FROM_NAME, |
| 13 INITIALIZE_LOADED_HUNK, | 13 INITIALIZE_LOADED_HUNK, |
| 14 INTERCEPTORS_BY_TAG, | 14 INTERCEPTORS_BY_TAG, |
| 15 IS_HUNK_INITIALIZED, | 15 IS_HUNK_INITIALIZED, |
| 16 IS_HUNK_LOADED, | 16 IS_HUNK_LOADED, |
| 17 LEAF_TAGS, | 17 LEAF_TAGS, |
| 18 MANGLED_GLOBAL_NAMES, | 18 MANGLED_GLOBAL_NAMES, |
| 19 METADATA, | 19 METADATA, |
| 20 TYPE_TO_INTERCEPTOR_MAP, | 20 TYPE_TO_INTERCEPTOR_MAP, |
| 21 TYPES; | 21 TYPES; |
| 22 | 22 |
| 23 import '../../../compiler_new.dart'; |
| 23 import '../../compiler.dart' show Compiler; | 24 import '../../compiler.dart' show Compiler; |
| 24 import '../../constants/values.dart' show ConstantValue, FunctionConstantValue; | 25 import '../../constants/values.dart' show ConstantValue, FunctionConstantValue; |
| 25 import '../../core_types.dart' show CommonElements; | 26 import '../../core_types.dart' show CommonElements; |
| 26 import '../../elements/elements.dart' show ClassElement, MethodElement; | 27 import '../../elements/elements.dart' show ClassElement, MethodElement; |
| 27 import '../../js/js.dart' as js; | 28 import '../../js/js.dart' as js; |
| 28 import '../../js_backend/js_backend.dart' | 29 import '../../js_backend/js_backend.dart' |
| 29 show JavaScriptBackend, Namer, ConstantEmitter; | 30 show JavaScriptBackend, Namer, ConstantEmitter; |
| 30 import '../constant_ordering.dart' show deepCompareConstants; | 31 import '../constant_ordering.dart' show deepCompareConstants; |
| 31 import '../js_emitter.dart' show NativeEmitter; | 32 import '../js_emitter.dart' show NativeEmitter; |
| 32 import '../js_emitter.dart' show NativeGenerator, buildTearOffCode; | 33 import '../js_emitter.dart' show NativeGenerator, buildTearOffCode; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 fragmentsCode.forEach(counter.countTokens); | 147 fragmentsCode.forEach(counter.countTokens); |
| 147 counter.countTokens(mainAst); | 148 counter.countTokens(mainAst); |
| 148 | 149 |
| 149 program.finalizers.forEach((js.TokenFinalizer f) => f.finalizeTokens()); | 150 program.finalizers.forEach((js.TokenFinalizer f) => f.finalizeTokens()); |
| 150 | 151 |
| 151 // TODO(johnnniwinther): Support source maps in this emitter. | 152 // TODO(johnnniwinther): Support source maps in this emitter. |
| 152 for (int i = 0; i < fragmentsCode.length; ++i) { | 153 for (int i = 0; i < fragmentsCode.length; ++i) { |
| 153 String code = js.createCodeBuffer(fragmentsCode[i], compiler).getText(); | 154 String code = js.createCodeBuffer(fragmentsCode[i], compiler).getText(); |
| 154 totalSize += code.length; | 155 totalSize += code.length; |
| 155 compiler.outputProvider( | 156 compiler.outputProvider( |
| 156 fragments[i + 1].outputFileName, deferredExtension) | 157 fragments[i + 1].outputFileName, deferredExtension, OutputType.part) |
| 157 ..add(code) | 158 ..add(code) |
| 158 ..close(); | 159 ..close(); |
| 159 } | 160 } |
| 160 | 161 |
| 161 String mainCode = js.createCodeBuffer(mainAst, compiler).getText(); | 162 String mainCode = js.createCodeBuffer(mainAst, compiler).getText(); |
| 162 compiler.outputProvider(mainFragment.outputFileName, 'js') | 163 compiler.outputProvider(mainFragment.outputFileName, 'js', OutputType.js) |
| 163 ..add(buildGeneratedBy(compiler)) | 164 ..add(buildGeneratedBy(compiler)) |
| 164 ..add(mainCode) | 165 ..add(mainCode) |
| 165 ..close(); | 166 ..close(); |
| 166 totalSize += mainCode.length; | 167 totalSize += mainCode.length; |
| 167 | 168 |
| 168 return totalSize; | 169 return totalSize; |
| 169 } | 170 } |
| 170 | 171 |
| 171 /// Returns a [js.Literal] that represents the string result of unparsing | 172 /// Returns a [js.Literal] that represents the string result of unparsing |
| 172 /// [value]. | 173 /// [value]. |
| (...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1269 #eagerClasses; | 1270 #eagerClasses; |
| 1270 | 1271 |
| 1271 var end = Date.now(); | 1272 var end = Date.now(); |
| 1272 // print('Setup: ' + (end - start) + ' ms.'); | 1273 // print('Setup: ' + (end - start) + ' ms.'); |
| 1273 | 1274 |
| 1274 #invokeMain; // Start main. | 1275 #invokeMain; // Start main. |
| 1275 | 1276 |
| 1276 })(Date.now(), #code) | 1277 })(Date.now(), #code) |
| 1277 }"""; | 1278 }"""; |
| 1278 } | 1279 } |
| OLD | NEW |