OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 js_backend.backend; | 5 library js_backend.backend; |
6 | 6 |
7 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; | 7 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; |
8 | 8 |
9 import '../common.dart'; | 9 import '../common.dart'; |
10 import '../common/backend_api.dart' | 10 import '../common/backend_api.dart' |
(...skipping 24 matching lines...) Expand all Loading... |
35 TreeShakingEnqueuerStrategy; | 35 TreeShakingEnqueuerStrategy; |
36 import '../io/multi_information.dart' show MultiSourceInformationStrategy; | 36 import '../io/multi_information.dart' show MultiSourceInformationStrategy; |
37 import '../io/position_information.dart' show PositionSourceInformationStrategy; | 37 import '../io/position_information.dart' show PositionSourceInformationStrategy; |
38 import '../io/source_information.dart' show SourceInformationStrategy; | 38 import '../io/source_information.dart' show SourceInformationStrategy; |
39 import '../io/start_end_information.dart' | 39 import '../io/start_end_information.dart' |
40 show StartEndSourceInformationStrategy; | 40 show StartEndSourceInformationStrategy; |
41 import '../js/js.dart' as jsAst; | 41 import '../js/js.dart' as jsAst; |
42 import '../js/js.dart' show js; | 42 import '../js/js.dart' show js; |
43 import '../js/js_source_mapping.dart' show JavaScriptSourceInformationStrategy; | 43 import '../js/js_source_mapping.dart' show JavaScriptSourceInformationStrategy; |
44 import '../js/rewrite_async.dart'; | 44 import '../js/rewrite_async.dart'; |
45 import '../js_emitter/js_emitter.dart' show CodeEmitterTask; | 45 import '../js_emitter/js_emitter.dart' show CodeEmitterTask, Emitter; |
46 import '../kernel/task.dart'; | 46 import '../kernel/task.dart'; |
47 import '../library_loader.dart' show LoadedLibraries; | 47 import '../library_loader.dart' show LoadedLibraries; |
48 import '../native/native.dart' as native; | 48 import '../native/native.dart' as native; |
49 import '../native/resolver.dart'; | 49 import '../native/resolver.dart'; |
50 import '../ssa/ssa.dart' show SsaFunctionCompiler; | 50 import '../ssa/ssa.dart' show SsaFunctionCompiler; |
51 import '../tracer.dart'; | 51 import '../tracer.dart'; |
52 import '../tree/tree.dart'; | 52 import '../tree/tree.dart'; |
53 import '../types/types.dart'; | 53 import '../types/types.dart'; |
54 import '../universe/call_structure.dart' show CallStructure; | 54 import '../universe/call_structure.dart' show CallStructure; |
55 import '../universe/selector.dart' show Selector; | 55 import '../universe/selector.dart' show Selector; |
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 : commonElements.objectClass; | 1040 : commonElements.objectClass; |
1041 } | 1041 } |
1042 | 1042 |
1043 /** | 1043 /** |
1044 * Unit test hook that returns code of an element as a String. | 1044 * Unit test hook that returns code of an element as a String. |
1045 * | 1045 * |
1046 * Invariant: [element] must be a declaration element. | 1046 * Invariant: [element] must be a declaration element. |
1047 */ | 1047 */ |
1048 String getGeneratedCode(Element element) { | 1048 String getGeneratedCode(Element element) { |
1049 assert(invariant(element, element.isDeclaration)); | 1049 assert(invariant(element, element.isDeclaration)); |
1050 return jsAst.prettyPrint(generatedCode[element], compiler); | 1050 return jsAst.prettyPrint(generatedCode[element], compiler.options); |
1051 } | 1051 } |
1052 | 1052 |
1053 /// Called to finalize the [RuntimeTypesChecks] information. | 1053 /// Called to finalize the [RuntimeTypesChecks] information. |
1054 void finalizeRti() { | 1054 void finalizeRti() { |
1055 _rtiChecks = rtiChecksBuilder.computeRequiredChecks(); | 1055 _rtiChecks = rtiChecksBuilder.computeRequiredChecks(); |
1056 } | 1056 } |
1057 | 1057 |
1058 /// Generates the output and returns the total size of the generated code. | 1058 /// Generates the output and returns the total size of the generated code. |
1059 int assembleProgram(ClosedWorld closedWorld) { | 1059 int assembleProgram(ClosedWorld closedWorld) { |
1060 int programSize = emitter.assembleProgram(namer, closedWorld); | 1060 int programSize = emitter.assembleProgram(namer, closedWorld); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 _closedWorldCache = value; | 1187 _closedWorldCache = value; |
1188 } | 1188 } |
1189 | 1189 |
1190 /// Called when the compiler starts running the codegen enqueuer. The | 1190 /// Called when the compiler starts running the codegen enqueuer. The |
1191 /// [WorldImpact] of enabled backend features is returned. | 1191 /// [WorldImpact] of enabled backend features is returned. |
1192 WorldImpact onCodegenStart( | 1192 WorldImpact onCodegenStart( |
1193 ClosedWorld closedWorld, CodegenWorldBuilder codegenWorldBuilder) { | 1193 ClosedWorld closedWorld, CodegenWorldBuilder codegenWorldBuilder) { |
1194 _closedWorld = closedWorld; | 1194 _closedWorld = closedWorld; |
1195 _namer = determineNamer(closedWorld, codegenWorldBuilder); | 1195 _namer = determineNamer(closedWorld, codegenWorldBuilder); |
1196 tracer = new Tracer(closedWorld, namer, compiler); | 1196 tracer = new Tracer(closedWorld, namer, compiler); |
1197 emitter.createEmitter(namer, closedWorld); | 1197 _rtiEncoder = _namer.rtiEncoder = new _RuntimeTypesEncoder(namer, helpers); |
1198 _rtiEncoder = | 1198 emitter.createEmitter(namer, closedWorld, codegenWorldBuilder); |
1199 _namer.rtiEncoder = new _RuntimeTypesEncoder(namer, emitter, helpers); | |
1200 _codegenImpactTransformer = new CodegenImpactTransformer( | 1199 _codegenImpactTransformer = new CodegenImpactTransformer( |
1201 compiler.options, | 1200 compiler.options, |
1202 compiler.elementEnvironment, | 1201 compiler.elementEnvironment, |
1203 helpers, | 1202 helpers, |
1204 impacts, | 1203 impacts, |
1205 checkedModeHelpers, | 1204 checkedModeHelpers, |
1206 nativeData, | 1205 nativeData, |
1207 backendUsage, | 1206 backendUsage, |
1208 rtiNeed, | 1207 rtiNeed, |
1209 nativeCodegenEnqueuer, | 1208 nativeCodegenEnqueuer, |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1600 | 1599 |
1601 bool canUseAliasedSuperMember(MemberEntity member, Selector selector) { | 1600 bool canUseAliasedSuperMember(MemberEntity member, Selector selector) { |
1602 return !selector.isGetter; | 1601 return !selector.isGetter; |
1603 } | 1602 } |
1604 | 1603 |
1605 /// Returns `true` if [member] is called from a subclass via `super`. | 1604 /// Returns `true` if [member] is called from a subclass via `super`. |
1606 bool isAliasedSuperMember(MemberEntity member) { | 1605 bool isAliasedSuperMember(MemberEntity member) { |
1607 return _aliasedSuperMembers.contains(member); | 1606 return _aliasedSuperMembers.contains(member); |
1608 } | 1607 } |
1609 } | 1608 } |
OLD | NEW |