| 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 'dart:async' show Future; | 7 import 'dart:async' show Future; |
| 8 | 8 |
| 9 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; | 9 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; |
| 10 | 10 |
| (...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1384 } | 1384 } |
| 1385 | 1385 |
| 1386 WorldImpact registerGetOfStaticFunction() { | 1386 WorldImpact registerGetOfStaticFunction() { |
| 1387 return impactTransformer.createImpactFor(impacts.staticClosure); | 1387 return impactTransformer.createImpactFor(impacts.staticClosure); |
| 1388 } | 1388 } |
| 1389 | 1389 |
| 1390 WorldImpact _registerComputeSignature() { | 1390 WorldImpact _registerComputeSignature() { |
| 1391 return impactTransformer.createImpactFor(impacts.computeSignature); | 1391 return impactTransformer.createImpactFor(impacts.computeSignature); |
| 1392 } | 1392 } |
| 1393 | 1393 |
| 1394 /// Called to register that the `runtimeType` property has been accessed. Any |
| 1395 /// backend specific [WorldImpact] of this is returned. |
| 1394 WorldImpact registerRuntimeType() { | 1396 WorldImpact registerRuntimeType() { |
| 1395 return impactTransformer.createImpactFor(impacts.runtimeTypeSupport); | 1397 return impactTransformer.createImpactFor(impacts.runtimeTypeSupport); |
| 1396 } | 1398 } |
| 1397 | 1399 |
| 1398 void registerTypeVariableBoundsSubtypeCheck( | 1400 void registerTypeVariableBoundsSubtypeCheck( |
| 1399 DartType typeArgument, DartType bound) { | 1401 DartType typeArgument, DartType bound) { |
| 1400 rti.registerTypeVariableBoundsSubtypeCheck(typeArgument, bound); | 1402 rti.registerTypeVariableBoundsSubtypeCheck(typeArgument, bound); |
| 1401 } | 1403 } |
| 1402 | 1404 |
| 1403 WorldImpact computeDeferredLoadingImpact() { | 1405 WorldImpact computeDeferredLoadingImpact() { |
| 1404 return impactTransformer.createImpactFor(impacts.deferredLoading); | 1406 return impactTransformer.createImpactFor(impacts.deferredLoading); |
| 1405 } | 1407 } |
| 1406 | 1408 |
| 1407 void registerNoSuchMethod(FunctionElement noSuchMethod) { | 1409 /// Called to register a `noSuchMethod` implementation. |
| 1410 void registerNoSuchMethod(MethodElement noSuchMethod) { |
| 1408 noSuchMethodRegistry.registerNoSuchMethod(noSuchMethod); | 1411 noSuchMethodRegistry.registerNoSuchMethod(noSuchMethod); |
| 1409 } | 1412 } |
| 1410 | 1413 |
| 1411 /// Called when resolving a call to a foreign function. | 1414 /// Called when resolving a call to a foreign function. |
| 1412 native.NativeBehavior resolveForeignCall(Send node, Element element, | 1415 native.NativeBehavior resolveForeignCall(Send node, Element element, |
| 1413 CallStructure callStructure, ForeignResolver resolver) { | 1416 CallStructure callStructure, ForeignResolver resolver) { |
| 1414 native.NativeResolutionEnqueuer nativeEnqueuer = | 1417 native.NativeResolutionEnqueuer nativeEnqueuer = |
| 1415 compiler.enqueuer.resolution.nativeEnqueuer; | 1418 compiler.enqueuer.resolution.nativeEnqueuer; |
| 1416 if (element.name == BackendHelpers.JS) { | 1419 if (element.name == BackendHelpers.JS) { |
| 1417 return nativeEnqueuer.resolveJsCall(node, resolver); | 1420 return nativeEnqueuer.resolveJsCall(node, resolver); |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1843 } | 1846 } |
| 1844 } else if (element == helpers.requiresPreambleMarker) { | 1847 } else if (element == helpers.requiresPreambleMarker) { |
| 1845 requiresPreamble = true; | 1848 requiresPreamble = true; |
| 1846 } else if (element == helpers.invokeOnMethod && forResolution) { | 1849 } else if (element == helpers.invokeOnMethod && forResolution) { |
| 1847 hasInvokeOnSupport = true; | 1850 hasInvokeOnSupport = true; |
| 1848 } | 1851 } |
| 1849 customElementsAnalysis.registerStaticUse(element, | 1852 customElementsAnalysis.registerStaticUse(element, |
| 1850 forResolution: forResolution); | 1853 forResolution: forResolution); |
| 1851 | 1854 |
| 1852 if (forResolution) { | 1855 if (forResolution) { |
| 1856 if (element.isFunction && element.isInstanceMember) { |
| 1857 MemberElement function = element; |
| 1858 ClassElement cls = function.enclosingClass; |
| 1859 if (function.name == Identifiers.call && !cls.typeVariables.isEmpty) { |
| 1860 worldImpact.addImpact(registerCallMethodWithFreeTypeVariables( |
| 1861 function, |
| 1862 forResolution: true)); |
| 1863 } |
| 1864 } |
| 1853 // Enable isolate support if we start using something from the isolate | 1865 // Enable isolate support if we start using something from the isolate |
| 1854 // library, or timers for the async library. We exclude constant fields, | 1866 // library, or timers for the async library. We exclude constant fields, |
| 1855 // which are ending here because their initializing expression is | 1867 // which are ending here because their initializing expression is |
| 1856 // compiled. | 1868 // compiled. |
| 1857 LibraryElement library = element.library; | 1869 LibraryElement library = element.library; |
| 1858 if (!hasIsolateSupport && (!element.isField || !element.isConst)) { | 1870 if (!hasIsolateSupport && (!element.isField || !element.isConst)) { |
| 1859 Uri uri = library.canonicalUri; | 1871 Uri uri = library.canonicalUri; |
| 1860 if (uri == Uris.dart_isolate) { | 1872 if (uri == Uris.dart_isolate) { |
| 1861 hasIsolateSupport = true; | 1873 hasIsolateSupport = true; |
| 1862 worldImpact | 1874 worldImpact |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2314 // due to mirrors. | 2326 // due to mirrors. |
| 2315 enqueuer.applyImpact(customElementsAnalysis.flush( | 2327 enqueuer.applyImpact(customElementsAnalysis.flush( |
| 2316 forResolution: enqueuer.isResolutionQueue)); | 2328 forResolution: enqueuer.isResolutionQueue)); |
| 2317 enqueuer.applyImpact( | 2329 enqueuer.applyImpact( |
| 2318 lookupMapAnalysis.flush(forResolution: enqueuer.isResolutionQueue)); | 2330 lookupMapAnalysis.flush(forResolution: enqueuer.isResolutionQueue)); |
| 2319 enqueuer.applyImpact( | 2331 enqueuer.applyImpact( |
| 2320 typeVariableHandler.flush(forResolution: enqueuer.isResolutionQueue)); | 2332 typeVariableHandler.flush(forResolution: enqueuer.isResolutionQueue)); |
| 2321 | 2333 |
| 2322 if (!enqueuer.queueIsEmpty) return false; | 2334 if (!enqueuer.queueIsEmpty) return false; |
| 2323 | 2335 |
| 2336 for (ClassElement cls in recentClasses) { |
| 2337 Element element = cls.lookupLocalMember(Identifiers.noSuchMethod_); |
| 2338 if (element != null && element.isInstanceMember && element.isFunction) { |
| 2339 registerNoSuchMethod(element); |
| 2340 } |
| 2341 } |
| 2324 noSuchMethodRegistry.onQueueEmpty(); | 2342 noSuchMethodRegistry.onQueueEmpty(); |
| 2325 if (!enabledNoSuchMethod && | 2343 if (!enabledNoSuchMethod && |
| 2326 (noSuchMethodRegistry.hasThrowingNoSuchMethod || | 2344 (noSuchMethodRegistry.hasThrowingNoSuchMethod || |
| 2327 noSuchMethodRegistry.hasComplexNoSuchMethod)) { | 2345 noSuchMethodRegistry.hasComplexNoSuchMethod)) { |
| 2328 enqueuer.applyImpact(enableNoSuchMethod()); | 2346 enqueuer.applyImpact(enableNoSuchMethod()); |
| 2329 enabledNoSuchMethod = true; | 2347 enabledNoSuchMethod = true; |
| 2330 } | 2348 } |
| 2331 | 2349 |
| 2332 if (compiler.options.useKernel && compiler.mainApp != null) { | 2350 if (compiler.options.useKernel && compiler.mainApp != null) { |
| 2333 kernelTask.buildKernelIr(); | 2351 kernelTask.buildKernelIr(); |
| (...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3278 ClassElement get mapImplementation => helpers.mapLiteralClass; | 3296 ClassElement get mapImplementation => helpers.mapLiteralClass; |
| 3279 ClassElement get constMapImplementation => helpers.constMapLiteralClass; | 3297 ClassElement get constMapImplementation => helpers.constMapLiteralClass; |
| 3280 ClassElement get typeImplementation => helpers.typeLiteralClass; | 3298 ClassElement get typeImplementation => helpers.typeLiteralClass; |
| 3281 ClassElement get boolImplementation => helpers.jsBoolClass; | 3299 ClassElement get boolImplementation => helpers.jsBoolClass; |
| 3282 ClassElement get nullImplementation => helpers.jsNullClass; | 3300 ClassElement get nullImplementation => helpers.jsNullClass; |
| 3283 ClassElement get syncStarIterableImplementation => helpers.syncStarIterable; | 3301 ClassElement get syncStarIterableImplementation => helpers.syncStarIterable; |
| 3284 ClassElement get asyncFutureImplementation => helpers.futureImplementation; | 3302 ClassElement get asyncFutureImplementation => helpers.futureImplementation; |
| 3285 ClassElement get asyncStarStreamImplementation => helpers.controllerStream; | 3303 ClassElement get asyncStarStreamImplementation => helpers.controllerStream; |
| 3286 ClassElement get functionImplementation => helpers.coreClasses.functionClass; | 3304 ClassElement get functionImplementation => helpers.coreClasses.functionClass; |
| 3287 } | 3305 } |
| OLD | NEW |