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 '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/backend_api.dart' | 8 import '../common/backend_api.dart' |
9 show ForeignResolver, NativeRegistry, ImpactTransformer; | 9 show ForeignResolver, NativeRegistry, ImpactTransformer; |
10 import '../common/codegen.dart' show CodegenWorkItem; | 10 import '../common/codegen.dart' show CodegenWorkItem; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 import 'native_data.dart'; | 71 import 'native_data.dart'; |
72 import 'no_such_method_registry.dart'; | 72 import 'no_such_method_registry.dart'; |
73 import 'patch_resolver.dart'; | 73 import 'patch_resolver.dart'; |
74 import 'resolution_listener.dart'; | 74 import 'resolution_listener.dart'; |
75 import 'runtime_types.dart'; | 75 import 'runtime_types.dart'; |
76 import 'type_variable_handler.dart'; | 76 import 'type_variable_handler.dart'; |
77 | 77 |
78 const VERBOSE_OPTIMIZER_HINTS = false; | 78 const VERBOSE_OPTIMIZER_HINTS = false; |
79 | 79 |
80 abstract class FunctionCompiler { | 80 abstract class FunctionCompiler { |
| 81 void onCodegenStart(); |
| 82 |
81 /// Generates JavaScript code for `work.element`. | 83 /// Generates JavaScript code for `work.element`. |
82 jsAst.Fun compile(CodegenWorkItem work, ClosedWorld closedWorld); | 84 jsAst.Fun compile(CodegenWorkItem work, ClosedWorld closedWorld); |
83 | 85 |
84 Iterable get tasks; | 86 Iterable get tasks; |
85 } | 87 } |
86 | 88 |
87 /* | 89 /* |
88 * Invariants: | 90 * Invariants: |
89 * canInline(function) implies canInline(function, insideLoop:true) | 91 * canInline(function) implies canInline(function, insideLoop:true) |
90 * !canInline(function, insideLoop: true) implies !canInline(function) | 92 * !canInline(function, insideLoop: true) implies !canInline(function) |
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 ..add(commonElements.objectClass) | 1057 ..add(commonElements.objectClass) |
1056 ..add(commonElements.jsInterceptorClass) | 1058 ..add(commonElements.jsInterceptorClass) |
1057 ..add(commonElements.jsNullClass); | 1059 ..add(commonElements.jsNullClass); |
1058 } | 1060 } |
1059 } | 1061 } |
1060 | 1062 |
1061 /// Called when the compiler starts running the codegen enqueuer. The | 1063 /// Called when the compiler starts running the codegen enqueuer. The |
1062 /// [WorldImpact] of enabled backend features is returned. | 1064 /// [WorldImpact] of enabled backend features is returned. |
1063 WorldImpact onCodegenStart( | 1065 WorldImpact onCodegenStart( |
1064 ClosedWorld closedWorld, CodegenWorldBuilder codegenWorldBuilder) { | 1066 ClosedWorld closedWorld, CodegenWorldBuilder codegenWorldBuilder) { |
| 1067 functionCompiler.onCodegenStart(); |
1065 _oneShotInterceptorData = new OneShotInterceptorData( | 1068 _oneShotInterceptorData = new OneShotInterceptorData( |
1066 closedWorld.interceptorData, closedWorld.commonElements); | 1069 closedWorld.interceptorData, closedWorld.commonElements); |
1067 _namer = determineNamer(closedWorld, codegenWorldBuilder); | 1070 _namer = determineNamer(closedWorld, codegenWorldBuilder); |
1068 tracer = new Tracer(closedWorld, namer, compiler); | 1071 tracer = new Tracer(closedWorld, namer, compiler); |
1069 _rtiEncoder = _namer.rtiEncoder = new RuntimeTypesEncoderImpl( | 1072 _rtiEncoder = _namer.rtiEncoder = new RuntimeTypesEncoderImpl( |
1070 namer, closedWorld.elementEnvironment, closedWorld.commonElements); | 1073 namer, closedWorld.elementEnvironment, closedWorld.commonElements); |
1071 emitter.createEmitter(namer, closedWorld, codegenWorldBuilder); | 1074 emitter.createEmitter(namer, closedWorld, codegenWorldBuilder); |
1072 _codegenImpactTransformer = new CodegenImpactTransformer( | 1075 _codegenImpactTransformer = new CodegenImpactTransformer( |
1073 compiler.options, | 1076 compiler.options, |
1074 closedWorld.elementEnvironment, | 1077 closedWorld.elementEnvironment, |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1394 | 1397 |
1395 bool canUseAliasedSuperMember(MemberEntity member, Selector selector) { | 1398 bool canUseAliasedSuperMember(MemberEntity member, Selector selector) { |
1396 return !selector.isGetter; | 1399 return !selector.isGetter; |
1397 } | 1400 } |
1398 | 1401 |
1399 /// Returns `true` if [member] is called from a subclass via `super`. | 1402 /// Returns `true` if [member] is called from a subclass via `super`. |
1400 bool isAliasedSuperMember(MemberEntity member) { | 1403 bool isAliasedSuperMember(MemberEntity member) { |
1401 return _aliasedSuperMembers.contains(member); | 1404 return _aliasedSuperMembers.contains(member); |
1402 } | 1405 } |
1403 } | 1406 } |
OLD | NEW |