Chromium Code Reviews| 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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 504 | 504 |
| 505 SourceInformationStrategy sourceInformationStrategy; | 505 SourceInformationStrategy sourceInformationStrategy; |
| 506 | 506 |
| 507 JavaScriptBackendSerialization serialization; | 507 JavaScriptBackendSerialization serialization; |
| 508 | 508 |
| 509 final NativeData nativeData = new NativeData(); | 509 final NativeData nativeData = new NativeData(); |
| 510 | 510 |
| 511 final BackendHelpers helpers; | 511 final BackendHelpers helpers; |
| 512 final BackendImpacts impacts; | 512 final BackendImpacts impacts; |
| 513 | 513 |
| 514 JSFrontendAccess _frontend; | |
| 515 | |
| 514 JavaScriptBackend(Compiler compiler, | 516 JavaScriptBackend(Compiler compiler, |
| 515 {bool generateSourceMap: true, | 517 {bool generateSourceMap: true, |
| 516 bool useStartupEmitter: false, | 518 bool useStartupEmitter: false, |
| 517 bool useNewSourceInfo: false}) | 519 bool useNewSourceInfo: false}) |
| 518 : namer = determineNamer(compiler), | 520 : namer = determineNamer(compiler), |
| 519 oneShotInterceptors = new Map<jsAst.Name, Selector>(), | 521 oneShotInterceptors = new Map<jsAst.Name, Selector>(), |
| 520 interceptedElements = new Map<String, Set<Element>>(), | 522 interceptedElements = new Map<String, Set<Element>>(), |
| 521 rti = new _RuntimeTypes(compiler), | 523 rti = new _RuntimeTypes(compiler), |
| 522 rtiEncoder = new _RuntimeTypesEncoder(compiler), | 524 rtiEncoder = new _RuntimeTypesEncoder(compiler), |
| 523 specializedGetInterceptors = new Map<jsAst.Name, Set<ClassElement>>(), | 525 specializedGetInterceptors = new Map<jsAst.Name, Set<ClassElement>>(), |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 538 jsInteropAnalysis = new JsInteropAnalysis(this); | 540 jsInteropAnalysis = new JsInteropAnalysis(this); |
| 539 | 541 |
| 540 noSuchMethodRegistry = new NoSuchMethodRegistry(this); | 542 noSuchMethodRegistry = new NoSuchMethodRegistry(this); |
| 541 constantCompilerTask = new JavaScriptConstantTask(compiler); | 543 constantCompilerTask = new JavaScriptConstantTask(compiler); |
| 542 impactTransformer = new JavaScriptImpactTransformer(this); | 544 impactTransformer = new JavaScriptImpactTransformer(this); |
| 543 patchResolverTask = new PatchResolverTask(compiler); | 545 patchResolverTask = new PatchResolverTask(compiler); |
| 544 functionCompiler = compiler.options.useCpsIr | 546 functionCompiler = compiler.options.useCpsIr |
| 545 ? new CpsFunctionCompiler(compiler, this, sourceInformationStrategy) | 547 ? new CpsFunctionCompiler(compiler, this, sourceInformationStrategy) |
| 546 : new SsaFunctionCompiler(this, sourceInformationStrategy); | 548 : new SsaFunctionCompiler(this, sourceInformationStrategy); |
| 547 serialization = new JavaScriptBackendSerialization(this); | 549 serialization = new JavaScriptBackendSerialization(this); |
| 550 _frontend = new JSFrontendAccess(compiler); | |
|
Siggi Cherem (dart-lang)
2016/04/15 15:42:14
seems it should be possible to make this an initia
Johnni Winther
2016/04/18 08:05:43
Done.
| |
| 548 } | 551 } |
| 549 | 552 |
| 550 ConstantSystem get constantSystem => constants.constantSystem; | 553 ConstantSystem get constantSystem => constants.constantSystem; |
| 551 | 554 |
| 552 DiagnosticReporter get reporter => compiler.reporter; | 555 DiagnosticReporter get reporter => compiler.reporter; |
| 553 | 556 |
| 554 CoreClasses get coreClasses => compiler.coreClasses; | 557 CoreClasses get coreClasses => compiler.coreClasses; |
| 555 | 558 |
| 556 CoreTypes get coreTypes => compiler.coreTypes; | 559 CoreTypes get coreTypes => compiler.coreTypes; |
| 557 | 560 |
| (...skipping 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2466 @override | 2469 @override |
| 2467 ImpactStrategy createImpactStrategy( | 2470 ImpactStrategy createImpactStrategy( |
| 2468 {bool supportDeferredLoad: true, | 2471 {bool supportDeferredLoad: true, |
| 2469 bool supportDumpInfo: true, | 2472 bool supportDumpInfo: true, |
| 2470 bool supportSerialization: true}) { | 2473 bool supportSerialization: true}) { |
| 2471 return new JavaScriptImpactStrategy(resolution, compiler.dumpInfoTask, | 2474 return new JavaScriptImpactStrategy(resolution, compiler.dumpInfoTask, |
| 2472 supportDeferredLoad: supportDeferredLoad, | 2475 supportDeferredLoad: supportDeferredLoad, |
| 2473 supportDumpInfo: supportDumpInfo, | 2476 supportDumpInfo: supportDumpInfo, |
| 2474 supportSerialization: supportSerialization); | 2477 supportSerialization: supportSerialization); |
| 2475 } | 2478 } |
| 2479 | |
| 2480 @override | |
| 2481 Frontend get frontend => _frontend; | |
| 2482 } | |
| 2483 | |
| 2484 class JSFrontendAccess implements Frontend { | |
| 2485 final Compiler compiler; | |
| 2486 | |
| 2487 JSFrontendAccess(this.compiler); | |
| 2488 | |
| 2489 Resolution get resolution => compiler.resolution; | |
| 2490 | |
| 2491 @override | |
| 2492 ResolutionImpact getResolutionImpact(Element element) { | |
| 2493 return resolution.getResolutionImpact(element); | |
| 2494 } | |
| 2495 | |
| 2496 @override | |
| 2497 ResolvedAst getResolvedAst(Element element) { | |
| 2498 if (element is SynthesizedCallMethodElementX) { | |
| 2499 return element.resolvedAst; | |
| 2500 } else if (element is ConstructorBodyElementX) { | |
| 2501 return element.resolvedAst; | |
| 2502 } else { | |
| 2503 assert(invariant(element, resolution.hasResolvedAst(element.declaration), | |
| 2504 message: 'No ResolvedAst for $element')); | |
| 2505 return resolution.getResolvedAst(element.declaration); | |
| 2506 } | |
| 2507 } | |
| 2476 } | 2508 } |
| 2477 | 2509 |
| 2478 /// Handling of special annotations for tests. | 2510 /// Handling of special annotations for tests. |
| 2479 class Annotations { | 2511 class Annotations { |
| 2480 static final Uri PACKAGE_EXPECT = | 2512 static final Uri PACKAGE_EXPECT = |
| 2481 new Uri(scheme: 'package', path: 'expect/expect.dart'); | 2513 new Uri(scheme: 'package', path: 'expect/expect.dart'); |
| 2482 | 2514 |
| 2483 final Compiler compiler; | 2515 final Compiler compiler; |
| 2484 | 2516 |
| 2485 ClassElement expectNoInlineClass; | 2517 ClassElement expectNoInlineClass; |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2976 | 3008 |
| 2977 @override | 3009 @override |
| 2978 void onImpactUsed(ImpactUseCase impactUse) { | 3010 void onImpactUsed(ImpactUseCase impactUse) { |
| 2979 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) { | 3011 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) { |
| 2980 // TODO(johnniwinther): Allow emptying when serialization has been | 3012 // TODO(johnniwinther): Allow emptying when serialization has been |
| 2981 // performed. | 3013 // performed. |
| 2982 resolution.emptyCache(); | 3014 resolution.emptyCache(); |
| 2983 } | 3015 } |
| 2984 } | 3016 } |
| 2985 } | 3017 } |
| OLD | NEW |