| 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; | |
| 8 | |
| 9 import '../common.dart'; | 7 import '../common.dart'; |
| 10 import '../common/backend_api.dart' | 8 import '../common/backend_api.dart' |
| 11 show BackendClasses, ForeignResolver, NativeRegistry, ImpactTransformer; | 9 show BackendClasses, ForeignResolver, NativeRegistry, ImpactTransformer; |
| 12 import '../common/codegen.dart' show CodegenImpact, CodegenWorkItem; | 10 import '../common/codegen.dart' show CodegenImpact, CodegenWorkItem; |
| 13 import '../common/names.dart' show Uris; | 11 import '../common/names.dart' show Uris; |
| 14 import '../common/resolution.dart' | 12 import '../common/resolution.dart' |
| 15 show Frontend, Resolution, ResolutionImpact, Target; | 13 show Frontend, Resolution, ResolutionImpact, Target; |
| 16 import '../common/tasks.dart' show CompilerTask; | 14 import '../common/tasks.dart' show CompilerTask; |
| 17 import '../compiler.dart' show Compiler; | 15 import '../compiler.dart' show Compiler; |
| 18 import '../constants/constant_system.dart'; | 16 import '../constants/constant_system.dart'; |
| (...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1147 inlineCache.markAsNonInlinable(commonElements.getInterceptorMethod, | 1145 inlineCache.markAsNonInlinable(commonElements.getInterceptorMethod, |
| 1148 insideLoop: true); | 1146 insideLoop: true); |
| 1149 | 1147 |
| 1150 specialOperatorEqClasses | 1148 specialOperatorEqClasses |
| 1151 ..add(commonElements.objectClass) | 1149 ..add(commonElements.objectClass) |
| 1152 ..add(commonElements.jsInterceptorClass) | 1150 ..add(commonElements.jsInterceptorClass) |
| 1153 ..add(commonElements.jsNullClass); | 1151 ..add(commonElements.jsNullClass); |
| 1154 } | 1152 } |
| 1155 } | 1153 } |
| 1156 | 1154 |
| 1157 jsAst.Call generateIsJsIndexableCall( | |
| 1158 jsAst.Expression use1, jsAst.Expression use2) { | |
| 1159 String dispatchPropertyName = embeddedNames.DISPATCH_PROPERTY_NAME; | |
| 1160 jsAst.Expression dispatchProperty = | |
| 1161 emitter.generateEmbeddedGlobalAccess(dispatchPropertyName); | |
| 1162 | |
| 1163 // We pass the dispatch property record to the isJsIndexable | |
| 1164 // helper rather than reading it inside the helper to increase the | |
| 1165 // chance of making the dispatch record access monomorphic. | |
| 1166 jsAst.PropertyAccess record = | |
| 1167 new jsAst.PropertyAccess(use2, dispatchProperty); | |
| 1168 | |
| 1169 List<jsAst.Expression> arguments = <jsAst.Expression>[use1, record]; | |
| 1170 MethodElement helper = commonElements.isJsIndexable; | |
| 1171 jsAst.Expression helperExpression = emitter.staticFunctionAccess(helper); | |
| 1172 return new jsAst.Call(helperExpression, arguments); | |
| 1173 } | |
| 1174 | |
| 1175 /// Called after the queue is closed. [onQueueEmpty] may be called multiple | 1155 /// Called after the queue is closed. [onQueueEmpty] may be called multiple |
| 1176 /// times, but [onQueueClosed] is only called once. | 1156 /// times, but [onQueueClosed] is only called once. |
| 1177 void onQueueClosed() { | 1157 void onQueueClosed() { |
| 1178 jsInteropAnalysis.onQueueClosed(); | 1158 jsInteropAnalysis.onQueueClosed(); |
| 1179 } | 1159 } |
| 1180 | 1160 |
| 1181 // TODO(johnniwinther): Create a CodegenPhase object for the backend to hold | 1161 // TODO(johnniwinther): Create a CodegenPhase object for the backend to hold |
| 1182 // data only available during code generation. | 1162 // data only available during code generation. |
| 1183 ClosedWorld _closedWorldCache; | 1163 ClosedWorld _closedWorldCache; |
| 1184 ClosedWorld get _closedWorld { | 1164 ClosedWorld get _closedWorld { |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1609 | 1589 |
| 1610 bool canUseAliasedSuperMember(MemberEntity member, Selector selector) { | 1590 bool canUseAliasedSuperMember(MemberEntity member, Selector selector) { |
| 1611 return !selector.isGetter; | 1591 return !selector.isGetter; |
| 1612 } | 1592 } |
| 1613 | 1593 |
| 1614 /// Returns `true` if [member] is called from a subclass via `super`. | 1594 /// Returns `true` if [member] is called from a subclass via `super`. |
| 1615 bool isAliasedSuperMember(MemberEntity member) { | 1595 bool isAliasedSuperMember(MemberEntity member) { |
| 1616 return _aliasedSuperMembers.contains(member); | 1596 return _aliasedSuperMembers.contains(member); |
| 1617 } | 1597 } |
| 1618 } | 1598 } |
| OLD | NEW |