Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: pkg/compiler/lib/src/js_backend/backend.dart

Issue 1617083002: Base JavaScript code position computation on JavaScript tracer. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 NoSuchMethodRegistry noSuchMethodRegistry; 495 NoSuchMethodRegistry noSuchMethodRegistry;
496 496
497 JavaScriptConstantTask constantCompilerTask; 497 JavaScriptConstantTask constantCompilerTask;
498 498
499 JavaScriptImpactTransformer impactTransformer; 499 JavaScriptImpactTransformer impactTransformer;
500 500
501 PatchResolverTask patchResolverTask; 501 PatchResolverTask patchResolverTask;
502 502
503 bool enabledNoSuchMethod = false; 503 bool enabledNoSuchMethod = false;
504 504
505 final SourceInformationStrategy sourceInformationStrategy; 505 SourceInformationStrategy sourceInformationStrategy;
506 506
507 final BackendHelpers helpers; 507 final BackendHelpers helpers;
508 final BackendImpacts impacts; 508 final BackendImpacts impacts;
509 509
510 JavaScriptBackend(Compiler compiler, 510 JavaScriptBackend(Compiler compiler,
511 {bool generateSourceMap: true, 511 {bool generateSourceMap: true,
512 bool useStartupEmitter: false}) 512 bool useStartupEmitter: false})
513 : namer = determineNamer(compiler), 513 : namer = determineNamer(compiler),
514 oneShotInterceptors = new Map<jsAst.Name, Selector>(), 514 oneShotInterceptors = new Map<jsAst.Name, Selector>(),
515 interceptedElements = new Map<String, Set<Element>>(), 515 interceptedElements = new Map<String, Set<Element>>(),
516 rti = new _RuntimeTypes(compiler), 516 rti = new _RuntimeTypes(compiler),
517 rtiEncoder = new _RuntimeTypesEncoder(compiler), 517 rtiEncoder = new _RuntimeTypesEncoder(compiler),
518 specializedGetInterceptors = new Map<jsAst.Name, Set<ClassElement>>(), 518 specializedGetInterceptors = new Map<jsAst.Name, Set<ClassElement>>(),
519 annotations = new Annotations(compiler), 519 annotations = new Annotations(compiler),
520 this.sourceInformationStrategy = 520 this.sourceInformationStrategy =
521 generateSourceMap 521 generateSourceMap
522 ? (useNewSourceInfo 522 ? (useNewSourceInfo
523 ? const PositionSourceInformationStrategy() 523 ? new PositionSourceInformationStrategy()
524 : const StartEndSourceInformationStrategy()) 524 : const StartEndSourceInformationStrategy())
525 : const JavaScriptSourceInformationStrategy(), 525 : const JavaScriptSourceInformationStrategy(),
526 helpers = new BackendHelpers(compiler), 526 helpers = new BackendHelpers(compiler),
527 impacts = new BackendImpacts(compiler), 527 impacts = new BackendImpacts(compiler),
528 super(compiler) { 528 super(compiler) {
529 emitter = new CodeEmitterTask( 529 emitter = new CodeEmitterTask(
530 compiler, namer, generateSourceMap, useStartupEmitter); 530 compiler, namer, generateSourceMap, useStartupEmitter);
531 typeVariableHandler = new TypeVariableHandler(compiler); 531 typeVariableHandler = new TypeVariableHandler(compiler);
532 customElementsAnalysis = new CustomElementsAnalysis(this); 532 customElementsAnalysis = new CustomElementsAnalysis(this);
533 lookupMapAnalysis = new LookupMapAnalysis(this, reporter); 533 lookupMapAnalysis = new LookupMapAnalysis(this, reporter);
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 // If the constant-handler was not able to produce a result we have to 1623 // If the constant-handler was not able to produce a result we have to
1624 // go through the builder (below) to generate the lazy initializer for 1624 // go through the builder (below) to generate the lazy initializer for
1625 // the static variable. 1625 // the static variable.
1626 // We also need to register the use of the cyclic-error helper. 1626 // We also need to register the use of the cyclic-error helper.
1627 compiler.enqueuer.codegen.registerStaticUse( 1627 compiler.enqueuer.codegen.registerStaticUse(
1628 new StaticUse.staticInvoke( 1628 new StaticUse.staticInvoke(
1629 helpers.cyclicThrowHelper, CallStructure.ONE_ARG)); 1629 helpers.cyclicThrowHelper, CallStructure.ONE_ARG));
1630 } 1630 }
1631 } 1631 }
1632 1632
1633 generatedCode[element] = functionCompiler.compile(work); 1633 jsAst.Fun function = functionCompiler.compile(work);
1634 if (function.sourceInformation == null) {
1635 function = function.withSourceInformation(
1636 sourceInformationStrategy.buildPreambleMarker());
1637 }
1638 generatedCode[element] = function;
1634 WorldImpact worldImpact = 1639 WorldImpact worldImpact =
1635 impactTransformer.transformCodegenImpact(work.registry.worldImpact); 1640 impactTransformer.transformCodegenImpact(work.registry.worldImpact);
1636 compiler.dumpInfoTask.registerImpact(element, worldImpact); 1641 compiler.dumpInfoTask.registerImpact(element, worldImpact);
1637 return worldImpact; 1642 return worldImpact;
1638 } 1643 }
1639 1644
1640 native.NativeEnqueuer nativeResolutionEnqueuer(Enqueuer world) { 1645 native.NativeEnqueuer nativeResolutionEnqueuer(Enqueuer world) {
1641 return new native.NativeResolutionEnqueuer(world, compiler); 1646 return new native.NativeResolutionEnqueuer(world, compiler);
1642 } 1647 }
1643 1648
(...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after
3164 } 3169 }
3165 } 3170 }
3166 3171
3167 @override 3172 @override
3168 void onImpactUsed(ImpactUseCase impactUse) { 3173 void onImpactUsed(ImpactUseCase impactUse) {
3169 if (impactUse == DeferredLoadTask.IMPACT_USE) { 3174 if (impactUse == DeferredLoadTask.IMPACT_USE) {
3170 resolution.emptyCache(); 3175 resolution.emptyCache();
3171 } 3176 }
3172 } 3177 }
3173 } 3178 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698