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 part of js_backend; | 5 part of js_backend; |
6 | 6 |
7 const VERBOSE_OPTIMIZER_HINTS = false; | 7 const VERBOSE_OPTIMIZER_HINTS = false; |
8 | 8 |
9 class JavaScriptItemCompilationContext extends ItemCompilationContext { | 9 class JavaScriptItemCompilationContext extends ItemCompilationContext { |
10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); | 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); |
(...skipping 2490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2501 final Compiler compiler; | 2501 final Compiler compiler; |
2502 | 2502 |
2503 JSFrontendAccess(this.compiler); | 2503 JSFrontendAccess(this.compiler); |
2504 | 2504 |
2505 Resolution get resolution => compiler.resolution; | 2505 Resolution get resolution => compiler.resolution; |
2506 | 2506 |
2507 @override | 2507 @override |
2508 ResolutionImpact getResolutionImpact(Element element) { | 2508 ResolutionImpact getResolutionImpact(Element element) { |
2509 return resolution.getResolutionImpact(element); | 2509 return resolution.getResolutionImpact(element); |
2510 } | 2510 } |
2511 | |
2512 @override | |
2513 bool hasResolvedAst(ExecutableElement element) { | |
2514 if (element is SynthesizedCallMethodElementX) { | |
2515 return true; | |
2516 } else if (element is ConstructorBodyElementX) { | |
2517 return true; | |
2518 } else if (element is FieldElementX) { | |
2519 return true; | |
2520 } else if (element is DeferredLoaderGetterElementX) { | |
2521 return true; | |
2522 } else { | |
2523 return resolution.hasResolvedAst(element); | |
2524 } | |
2525 } | |
2526 | |
2527 @override | |
2528 ResolvedAst getResolvedAst(ExecutableElement element) { | |
2529 if (element is SynthesizedCallMethodElementX) { | |
2530 return element.resolvedAst; | |
2531 } else if (element is ConstructorBodyElementX) { | |
2532 return element.resolvedAst; | |
2533 } else if (element is DeferredLoaderGetterElementX) { | |
2534 return element.resolvedAst; | |
2535 } else if (element is FieldElementX) { | |
2536 // TODO(johnniwinther): Find a good invariant for resolution of fields. | |
2537 // Currently some but not all are resolved (maybe it has to do with | |
2538 // initializers?) | |
2539 return element.resolvedAst; | |
2540 } else { | |
2541 assert(invariant(element, resolution.hasResolvedAst(element.declaration), | |
2542 message: 'No ResolvedAst for $element')); | |
2543 return resolution.getResolvedAst(element.declaration); | |
2544 } | |
2545 } | |
2546 } | 2511 } |
2547 | 2512 |
2548 /// Handling of special annotations for tests. | 2513 /// Handling of special annotations for tests. |
2549 class Annotations { | 2514 class Annotations { |
2550 static final Uri PACKAGE_EXPECT = | 2515 static final Uri PACKAGE_EXPECT = |
2551 new Uri(scheme: 'package', path: 'expect/expect.dart'); | 2516 new Uri(scheme: 'package', path: 'expect/expect.dart'); |
2552 | 2517 |
2553 final Compiler compiler; | 2518 final Compiler compiler; |
2554 | 2519 |
2555 ClassElement expectNoInlineClass; | 2520 ClassElement expectNoInlineClass; |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3055 | 3020 |
3056 @override | 3021 @override |
3057 void onImpactUsed(ImpactUseCase impactUse) { | 3022 void onImpactUsed(ImpactUseCase impactUse) { |
3058 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) { | 3023 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) { |
3059 // TODO(johnniwinther): Allow emptying when serialization has been | 3024 // TODO(johnniwinther): Allow emptying when serialization has been |
3060 // performed. | 3025 // performed. |
3061 resolution.emptyCache(); | 3026 resolution.emptyCache(); |
3062 } | 3027 } |
3063 } | 3028 } |
3064 } | 3029 } |
OLD | NEW |