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

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

Issue 2324213003: build kernel for the entire program after resolution (Closed)
Patch Set: Created 4 years, 3 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 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 22 matching lines...) Expand all
33 import '../io/start_end_information.dart' 33 import '../io/start_end_information.dart'
34 show StartEndSourceInformationStrategy; 34 show StartEndSourceInformationStrategy;
35 import '../js/js.dart' as jsAst; 35 import '../js/js.dart' as jsAst;
36 import '../js/js.dart' show js; 36 import '../js/js.dart' show js;
37 import '../js/js_source_mapping.dart' show JavaScriptSourceInformationStrategy; 37 import '../js/js_source_mapping.dart' show JavaScriptSourceInformationStrategy;
38 import '../js/rewrite_async.dart'; 38 import '../js/rewrite_async.dart';
39 import '../js_emitter/js_emitter.dart' show CodeEmitterTask; 39 import '../js_emitter/js_emitter.dart' show CodeEmitterTask;
40 import '../library_loader.dart' show LibraryLoader, LoadedLibraries; 40 import '../library_loader.dart' show LibraryLoader, LoadedLibraries;
41 import '../native/native.dart' as native; 41 import '../native/native.dart' as native;
42 import '../ssa/ssa.dart' show SsaFunctionCompiler; 42 import '../ssa/ssa.dart' show SsaFunctionCompiler;
43 import '../ssa/nodes.dart' show HInstruction;
44 import '../tree/tree.dart'; 43 import '../tree/tree.dart';
45 import '../types/types.dart'; 44 import '../types/types.dart';
46 import '../universe/call_structure.dart' show CallStructure; 45 import '../universe/call_structure.dart' show CallStructure;
47 import '../universe/selector.dart' show Selector, SelectorKind; 46 import '../universe/feature.dart';
47 import '../universe/selector.dart' show Selector;
48 import '../universe/universe.dart'; 48 import '../universe/universe.dart';
49 import '../universe/use.dart' 49 import '../universe/use.dart'
50 show DynamicUse, StaticUse, StaticUseKind, TypeUse, TypeUseKind; 50 show DynamicUse, StaticUse, StaticUseKind, TypeUse, TypeUseKind;
51 import '../universe/feature.dart';
52 import '../universe/world_impact.dart' 51 import '../universe/world_impact.dart'
53 show 52 show
54 ImpactStrategy, 53 ImpactStrategy,
55 ImpactUseCase, 54 ImpactUseCase,
56 TransformedWorldImpact, 55 TransformedWorldImpact,
57 WorldImpact, 56 WorldImpact,
58 WorldImpactVisitor; 57 WorldImpactVisitor;
59 import '../util/util.dart'; 58 import '../util/util.dart';
60 import '../world.dart' show ClassWorld; 59 import '../world.dart' show ClassWorld;
61 import 'backend_helpers.dart'; 60 import 'backend_helpers.dart';
62 import 'backend_impact.dart'; 61 import 'backend_impact.dart';
63 import 'backend_serialization.dart' show JavaScriptBackendSerialization; 62 import 'backend_serialization.dart' show JavaScriptBackendSerialization;
64 import 'checked_mode_helpers.dart'; 63 import 'checked_mode_helpers.dart';
65 import 'constant_handler_javascript.dart'; 64 import 'constant_handler_javascript.dart';
66 import 'custom_elements_analysis.dart'; 65 import 'custom_elements_analysis.dart';
67 import 'enqueuer.dart'; 66 import 'enqueuer.dart';
68 import 'js_interop_analysis.dart' show JsInteropAnalysis; 67 import 'js_interop_analysis.dart' show JsInteropAnalysis;
68 import 'kernel_task.dart';
69 import 'lookup_map_analysis.dart' show LookupMapAnalysis; 69 import 'lookup_map_analysis.dart' show LookupMapAnalysis;
70 import 'namer.dart'; 70 import 'namer.dart';
71 import 'native_data.dart' show NativeData; 71 import 'native_data.dart' show NativeData;
72 import 'no_such_method_registry.dart'; 72 import 'no_such_method_registry.dart';
73 import 'patch_resolver.dart'; 73 import 'patch_resolver.dart';
74 import 'type_variable_handler.dart'; 74 import 'type_variable_handler.dart';
75 75
76 part 'runtime_types.dart'; 76 part 'runtime_types.dart';
77 77
78 const VERBOSE_OPTIMIZER_HINTS = false; 78 const VERBOSE_OPTIMIZER_HINTS = false;
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 557
558 /// Codegen support for tree-shaking entries of `LookupMap`. 558 /// Codegen support for tree-shaking entries of `LookupMap`.
559 LookupMapAnalysis lookupMapAnalysis; 559 LookupMapAnalysis lookupMapAnalysis;
560 560
561 /// Codegen support for typed JavaScript interop. 561 /// Codegen support for typed JavaScript interop.
562 JsInteropAnalysis jsInteropAnalysis; 562 JsInteropAnalysis jsInteropAnalysis;
563 563
564 /// Support for classifying `noSuchMethod` implementations. 564 /// Support for classifying `noSuchMethod` implementations.
565 NoSuchMethodRegistry noSuchMethodRegistry; 565 NoSuchMethodRegistry noSuchMethodRegistry;
566 566
567 /// Builds kernel representation for the program.
568 KernelTask kernelTask;
569
567 JavaScriptConstantTask constantCompilerTask; 570 JavaScriptConstantTask constantCompilerTask;
568 571
569 JavaScriptImpactTransformer impactTransformer; 572 JavaScriptImpactTransformer impactTransformer;
570 573
571 PatchResolverTask patchResolverTask; 574 PatchResolverTask patchResolverTask;
572 575
573 bool enabledNoSuchMethod = false; 576 bool enabledNoSuchMethod = false;
574 577
575 SourceInformationStrategy sourceInformationStrategy; 578 SourceInformationStrategy sourceInformationStrategy;
576 579
(...skipping 28 matching lines...) Expand all
605 frontend = new JSFrontendAccess(compiler), 608 frontend = new JSFrontendAccess(compiler),
606 super(compiler) { 609 super(compiler) {
607 emitter = new CodeEmitterTask( 610 emitter = new CodeEmitterTask(
608 compiler, namer, generateSourceMap, useStartupEmitter); 611 compiler, namer, generateSourceMap, useStartupEmitter);
609 typeVariableHandler = new TypeVariableHandler(compiler); 612 typeVariableHandler = new TypeVariableHandler(compiler);
610 customElementsAnalysis = new CustomElementsAnalysis(this); 613 customElementsAnalysis = new CustomElementsAnalysis(this);
611 lookupMapAnalysis = new LookupMapAnalysis(this, reporter); 614 lookupMapAnalysis = new LookupMapAnalysis(this, reporter);
612 jsInteropAnalysis = new JsInteropAnalysis(this); 615 jsInteropAnalysis = new JsInteropAnalysis(this);
613 616
614 noSuchMethodRegistry = new NoSuchMethodRegistry(this); 617 noSuchMethodRegistry = new NoSuchMethodRegistry(this);
618 kernelTask = new KernelTask(this);
615 constantCompilerTask = new JavaScriptConstantTask(compiler); 619 constantCompilerTask = new JavaScriptConstantTask(compiler);
616 impactTransformer = new JavaScriptImpactTransformer(this); 620 impactTransformer = new JavaScriptImpactTransformer(this);
617 patchResolverTask = new PatchResolverTask(compiler); 621 patchResolverTask = new PatchResolverTask(compiler);
618 functionCompiler = 622 functionCompiler =
619 new SsaFunctionCompiler(this, sourceInformationStrategy, useKernel); 623 new SsaFunctionCompiler(this, sourceInformationStrategy, useKernel);
620 serialization = new JavaScriptBackendSerialization(this); 624 serialization = new JavaScriptBackendSerialization(this);
621 } 625 }
622 626
623 ConstantSystem get constantSystem => constants.constantSystem; 627 ConstantSystem get constantSystem => constants.constantSystem;
624 628
(...skipping 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after
2358 if (!enqueuer.queueIsEmpty) return false; 2362 if (!enqueuer.queueIsEmpty) return false;
2359 2363
2360 noSuchMethodRegistry.onQueueEmpty(); 2364 noSuchMethodRegistry.onQueueEmpty();
2361 if (!enabledNoSuchMethod && 2365 if (!enabledNoSuchMethod &&
2362 (noSuchMethodRegistry.hasThrowingNoSuchMethod || 2366 (noSuchMethodRegistry.hasThrowingNoSuchMethod ||
2363 noSuchMethodRegistry.hasComplexNoSuchMethod)) { 2367 noSuchMethodRegistry.hasComplexNoSuchMethod)) {
2364 enableNoSuchMethod(enqueuer); 2368 enableNoSuchMethod(enqueuer);
2365 enabledNoSuchMethod = true; 2369 enabledNoSuchMethod = true;
2366 } 2370 }
2367 2371
2372 if (compiler.options.useKernel) {
2373 kernelTask.onQueueEmpty();
Siggi Cherem (dart-lang) 2016/09/09 22:49:23 nit: rename "onQueueEmpty" to "buildKernelIr"? I
Harry Terkelsen 2016/09/09 22:56:47 Done. I think that's better, I was mainly naming i
2374 }
2375
2368 if (compiler.options.hasIncrementalSupport) { 2376 if (compiler.options.hasIncrementalSupport) {
2369 // Always enable tear-off closures during incremental compilation. 2377 // Always enable tear-off closures during incremental compilation.
2370 Element e = helpers.closureFromTearOff; 2378 Element e = helpers.closureFromTearOff;
2371 if (e != null && !enqueuer.isProcessed(e)) { 2379 if (e != null && !enqueuer.isProcessed(e)) {
2372 registerBackendUse(e); 2380 registerBackendUse(e);
2373 enqueuer.addToWorkList(e); 2381 enqueuer.addToWorkList(e);
2374 } 2382 }
2375 } 2383 }
2376 2384
2377 if (!enqueuer.isResolutionQueue && preMirrorsMethodCount == 0) { 2385 if (!enqueuer.isResolutionQueue && preMirrorsMethodCount == 0) {
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
3206 3214
3207 @override 3215 @override
3208 void onImpactUsed(ImpactUseCase impactUse) { 3216 void onImpactUsed(ImpactUseCase impactUse) {
3209 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) { 3217 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) {
3210 // TODO(johnniwinther): Allow emptying when serialization has been 3218 // TODO(johnniwinther): Allow emptying when serialization has been
3211 // performed. 3219 // performed.
3212 resolution.emptyCache(); 3220 resolution.emptyCache();
3213 } 3221 }
3214 } 3222 }
3215 } 3223 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/kernel_task.dart » ('j') | pkg/compiler/lib/src/kernel/kernel.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698