| 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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 | 326 |
| 327 /// If [true], the compiler will emit code that logs whenever a method is | 327 /// If [true], the compiler will emit code that logs whenever a method is |
| 328 /// called. When TRACE_METHOD is 'console' this will be logged | 328 /// called. When TRACE_METHOD is 'console' this will be logged |
| 329 /// directly in the JavaScript console. When TRACE_METHOD is 'post' the | 329 /// directly in the JavaScript console. When TRACE_METHOD is 'post' the |
| 330 /// information will be sent to a server via a POST request. | 330 /// information will be sent to a server via a POST request. |
| 331 static const String TRACE_METHOD = const String.fromEnvironment('traceCalls'); | 331 static const String TRACE_METHOD = const String.fromEnvironment('traceCalls'); |
| 332 static const bool TRACE_CALLS = | 332 static const bool TRACE_CALLS = |
| 333 TRACE_METHOD == 'post' || TRACE_METHOD == 'console'; | 333 TRACE_METHOD == 'post' || TRACE_METHOD == 'console'; |
| 334 Element traceHelper; | 334 Element traceHelper; |
| 335 | 335 |
| 336 TypeMask get stringType => compiler.typesTask.stringType; | 336 TypeMask get stringType => compiler.commonMasks.stringType; |
| 337 TypeMask get doubleType => compiler.typesTask.doubleType; | 337 TypeMask get doubleType => compiler.commonMasks.doubleType; |
| 338 TypeMask get intType => compiler.typesTask.intType; | 338 TypeMask get intType => compiler.commonMasks.intType; |
| 339 TypeMask get uint32Type => compiler.typesTask.uint32Type; | 339 TypeMask get uint32Type => compiler.commonMasks.uint32Type; |
| 340 TypeMask get uint31Type => compiler.typesTask.uint31Type; | 340 TypeMask get uint31Type => compiler.commonMasks.uint31Type; |
| 341 TypeMask get positiveIntType => compiler.typesTask.positiveIntType; | 341 TypeMask get positiveIntType => compiler.commonMasks.positiveIntType; |
| 342 TypeMask get numType => compiler.typesTask.numType; | 342 TypeMask get numType => compiler.commonMasks.numType; |
| 343 TypeMask get boolType => compiler.typesTask.boolType; | 343 TypeMask get boolType => compiler.commonMasks.boolType; |
| 344 TypeMask get dynamicType => compiler.typesTask.dynamicType; | 344 TypeMask get dynamicType => compiler.commonMasks.dynamicType; |
| 345 TypeMask get nullType => compiler.typesTask.nullType; | 345 TypeMask get nullType => compiler.commonMasks.nullType; |
| 346 TypeMask get emptyType => const TypeMask.nonNullEmpty(); | 346 TypeMask get emptyType => const TypeMask.nonNullEmpty(); |
| 347 TypeMask get nonNullType => compiler.commonMasks.nonNullType; |
| 347 | 348 |
| 348 TypeMask _indexablePrimitiveTypeCache; | 349 TypeMask _indexablePrimitiveTypeCache; |
| 349 TypeMask get indexablePrimitiveType { | 350 TypeMask get indexablePrimitiveType { |
| 350 if (_indexablePrimitiveTypeCache == null) { | 351 if (_indexablePrimitiveTypeCache == null) { |
| 351 _indexablePrimitiveTypeCache = | 352 _indexablePrimitiveTypeCache = |
| 352 new TypeMask.nonNullSubtype(helpers.jsIndexableClass, compiler.world); | 353 new TypeMask.nonNullSubtype(helpers.jsIndexableClass, compiler.world); |
| 353 } | 354 } |
| 354 return _indexablePrimitiveTypeCache; | 355 return _indexablePrimitiveTypeCache; |
| 355 } | 356 } |
| 356 | 357 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 | 393 |
| 393 TypeMask _unmodifiableArrayTypeCache; | 394 TypeMask _unmodifiableArrayTypeCache; |
| 394 TypeMask get unmodifiableArrayType { | 395 TypeMask get unmodifiableArrayType { |
| 395 if (_unmodifiableArrayTypeCache == null) { | 396 if (_unmodifiableArrayTypeCache == null) { |
| 396 _unmodifiableArrayTypeCache = new TypeMask.nonNullExact( | 397 _unmodifiableArrayTypeCache = new TypeMask.nonNullExact( |
| 397 helpers.jsUnmodifiableArrayClass, compiler.world); | 398 helpers.jsUnmodifiableArrayClass, compiler.world); |
| 398 } | 399 } |
| 399 return _fixedArrayTypeCache; | 400 return _fixedArrayTypeCache; |
| 400 } | 401 } |
| 401 | 402 |
| 402 TypeMask _nonNullTypeCache; | |
| 403 TypeMask get nonNullType { | |
| 404 if (_nonNullTypeCache == null) { | |
| 405 _nonNullTypeCache = compiler.typesTask.dynamicType.nonNullable(); | |
| 406 } | |
| 407 return _nonNullTypeCache; | |
| 408 } | |
| 409 | 403 |
| 410 /// Maps special classes to their implementation (JSXxx) class. | 404 /// Maps special classes to their implementation (JSXxx) class. |
| 411 Map<ClassElement, ClassElement> implementationClasses; | 405 Map<ClassElement, ClassElement> implementationClasses; |
| 412 | 406 |
| 413 bool needToInitializeIsolateAffinityTag = false; | 407 bool needToInitializeIsolateAffinityTag = false; |
| 414 bool needToInitializeDispatchProperty = false; | 408 bool needToInitializeDispatchProperty = false; |
| 415 | 409 |
| 416 final Namer namer; | 410 final Namer namer; |
| 417 | 411 |
| 418 /** | 412 /** |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 compiler, namer, generateSourceMap, useStartupEmitter); | 613 compiler, namer, generateSourceMap, useStartupEmitter); |
| 620 typeVariableHandler = new TypeVariableHandler(compiler); | 614 typeVariableHandler = new TypeVariableHandler(compiler); |
| 621 customElementsAnalysis = new CustomElementsAnalysis(this); | 615 customElementsAnalysis = new CustomElementsAnalysis(this); |
| 622 lookupMapAnalysis = new LookupMapAnalysis(this, reporter); | 616 lookupMapAnalysis = new LookupMapAnalysis(this, reporter); |
| 623 jsInteropAnalysis = new JsInteropAnalysis(this); | 617 jsInteropAnalysis = new JsInteropAnalysis(this); |
| 624 | 618 |
| 625 noSuchMethodRegistry = new NoSuchMethodRegistry(this); | 619 noSuchMethodRegistry = new NoSuchMethodRegistry(this); |
| 626 constantCompilerTask = new JavaScriptConstantTask(compiler); | 620 constantCompilerTask = new JavaScriptConstantTask(compiler); |
| 627 impactTransformer = new JavaScriptImpactTransformer(this); | 621 impactTransformer = new JavaScriptImpactTransformer(this); |
| 628 patchResolverTask = new PatchResolverTask(compiler); | 622 patchResolverTask = new PatchResolverTask(compiler); |
| 629 functionCompiler = new SsaFunctionCompiler( | 623 functionCompiler = |
| 630 this, sourceInformationStrategy, useKernel); | 624 new SsaFunctionCompiler(this, sourceInformationStrategy, useKernel); |
| 631 serialization = new JavaScriptBackendSerialization(this); | 625 serialization = new JavaScriptBackendSerialization(this); |
| 632 } | 626 } |
| 633 | 627 |
| 634 ConstantSystem get constantSystem => constants.constantSystem; | 628 ConstantSystem get constantSystem => constants.constantSystem; |
| 635 | 629 |
| 636 DiagnosticReporter get reporter => compiler.reporter; | 630 DiagnosticReporter get reporter => compiler.reporter; |
| 637 | 631 |
| 638 CoreClasses get coreClasses => compiler.coreClasses; | 632 CoreClasses get coreClasses => compiler.coreClasses; |
| 639 | 633 |
| 640 CoreTypes get coreTypes => compiler.coreTypes; | 634 CoreTypes get coreTypes => compiler.coreTypes; |
| (...skipping 2557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3198 | 3192 |
| 3199 @override | 3193 @override |
| 3200 void onImpactUsed(ImpactUseCase impactUse) { | 3194 void onImpactUsed(ImpactUseCase impactUse) { |
| 3201 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) { | 3195 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) { |
| 3202 // TODO(johnniwinther): Allow emptying when serialization has been | 3196 // TODO(johnniwinther): Allow emptying when serialization has been |
| 3203 // performed. | 3197 // performed. |
| 3204 resolution.emptyCache(); | 3198 resolution.emptyCache(); |
| 3205 } | 3199 } |
| 3206 } | 3200 } |
| 3207 } | 3201 } |
| OLD | NEW |