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

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

Issue 2302363003: No longer store the compilation-context in WorkItem. (Closed)
Patch Set: ... lint 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 dart2js.js.enqueue; 5 library dart2js.js.enqueue;
6 6
7 import 'dart:collection' show Queue; 7 import 'dart:collection' show Queue;
8 8
9 import '../common/codegen.dart' show CodegenWorkItem; 9 import '../common/codegen.dart' show CodegenWorkItem;
10 import '../common/names.dart' show Identifiers; 10 import '../common/names.dart' show Identifiers;
(...skipping 26 matching lines...) Expand all
37 show DynamicUse, StaticUse, StaticUseKind, TypeUse, TypeUseKind; 37 show DynamicUse, StaticUse, StaticUseKind, TypeUse, TypeUseKind;
38 import '../universe/world_impact.dart' 38 import '../universe/world_impact.dart'
39 show ImpactUseCase, WorldImpact, WorldImpactVisitor; 39 show ImpactUseCase, WorldImpact, WorldImpactVisitor;
40 import '../util/util.dart' show Setlet; 40 import '../util/util.dart' show Setlet;
41 41
42 /// [Enqueuer] which is specific to code generation. 42 /// [Enqueuer] which is specific to code generation.
43 class CodegenEnqueuer implements Enqueuer { 43 class CodegenEnqueuer implements Enqueuer {
44 final String name; 44 final String name;
45 final Compiler compiler; // TODO(ahe): Remove this dependency. 45 final Compiler compiler; // TODO(ahe): Remove this dependency.
46 final EnqueuerStrategy strategy; 46 final EnqueuerStrategy strategy;
47 final ItemCompilationContextCreator itemCompilationContextCreator;
48 final Map<String, Set<Element>> instanceMembersByName = 47 final Map<String, Set<Element>> instanceMembersByName =
49 new Map<String, Set<Element>>(); 48 new Map<String, Set<Element>>();
50 final Map<String, Set<Element>> instanceFunctionsByName = 49 final Map<String, Set<Element>> instanceFunctionsByName =
51 new Map<String, Set<Element>>(); 50 new Map<String, Set<Element>>();
52 final Set<ClassElement> _processedClasses = new Set<ClassElement>(); 51 final Set<ClassElement> _processedClasses = new Set<ClassElement>();
53 Set<ClassElement> recentClasses = new Setlet<ClassElement>(); 52 Set<ClassElement> recentClasses = new Setlet<ClassElement>();
54 final Universe universe = new Universe(const TypeMaskStrategy()); 53 final Universe universe = new Universe(const TypeMaskStrategy());
55 54
56 static final TRACE_MIRROR_ENQUEUING = 55 static final TRACE_MIRROR_ENQUEUING =
57 const bool.fromEnvironment("TRACE_MIRROR_ENQUEUING"); 56 const bool.fromEnvironment("TRACE_MIRROR_ENQUEUING");
58 57
59 bool queueIsClosed = false; 58 bool queueIsClosed = false;
60 EnqueueTask task; 59 EnqueueTask task;
61 native.NativeEnqueuer nativeEnqueuer; // Set by EnqueueTask 60 native.NativeEnqueuer nativeEnqueuer; // Set by EnqueueTask
62 61
63 bool hasEnqueuedReflectiveElements = false; 62 bool hasEnqueuedReflectiveElements = false;
64 bool hasEnqueuedReflectiveStaticFields = false; 63 bool hasEnqueuedReflectiveStaticFields = false;
65 64
66 WorldImpactVisitor impactVisitor; 65 WorldImpactVisitor impactVisitor;
67 66
68 CodegenEnqueuer( 67 CodegenEnqueuer(Compiler compiler, this.strategy)
69 Compiler compiler, this.itemCompilationContextCreator, this.strategy)
70 : queue = new Queue<CodegenWorkItem>(), 68 : queue = new Queue<CodegenWorkItem>(),
71 newlyEnqueuedElements = compiler.cacheStrategy.newSet(), 69 newlyEnqueuedElements = compiler.cacheStrategy.newSet(),
72 newlySeenSelectors = compiler.cacheStrategy.newSet(), 70 newlySeenSelectors = compiler.cacheStrategy.newSet(),
73 this.name = 'codegen enqueuer', 71 this.name = 'codegen enqueuer',
74 this.compiler = compiler { 72 this.compiler = compiler {
75 impactVisitor = new _EnqueuerImpactVisitor(this); 73 impactVisitor = new _EnqueuerImpactVisitor(this);
76 } 74 }
77 75
78 // TODO(johnniwinther): Move this to [ResolutionEnqueuer]. 76 // TODO(johnniwinther): Move this to [ResolutionEnqueuer].
79 Resolution get resolution => compiler.resolution; 77 Resolution get resolution => compiler.resolution;
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 } 663 }
666 664
667 if (compiler.options.hasIncrementalSupport && !isProcessed(element)) { 665 if (compiler.options.hasIncrementalSupport && !isProcessed(element)) {
668 newlyEnqueuedElements.add(element); 666 newlyEnqueuedElements.add(element);
669 } 667 }
670 668
671 if (queueIsClosed) { 669 if (queueIsClosed) {
672 throw new SpannableAssertionFailure( 670 throw new SpannableAssertionFailure(
673 element, "Codegen work list is closed. Trying to add $element"); 671 element, "Codegen work list is closed. Trying to add $element");
674 } 672 }
675 CodegenWorkItem workItem = 673 queue.add(new CodegenWorkItem(compiler, element));
676 new CodegenWorkItem(compiler, element, itemCompilationContextCreator());
677 queue.add(workItem);
678 return true; 674 return true;
679 } 675 }
680 676
681 void registerNoSuchMethod(Element element) { 677 void registerNoSuchMethod(Element element) {
682 if (!enabledNoSuchMethod && compiler.backend.enabledNoSuchMethod) { 678 if (!enabledNoSuchMethod && compiler.backend.enabledNoSuchMethod) {
683 compiler.backend.enableNoSuchMethod(this); 679 compiler.backend.enableNoSuchMethod(this);
684 enabledNoSuchMethod = true; 680 enabledNoSuchMethod = true;
685 } 681 }
686 } 682 }
687 683
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 @override 727 @override
732 void visitStaticUse(StaticUse staticUse) { 728 void visitStaticUse(StaticUse staticUse) {
733 enqueuer.registerStaticUse(staticUse); 729 enqueuer.registerStaticUse(staticUse);
734 } 730 }
735 731
736 @override 732 @override
737 void visitTypeUse(TypeUse typeUse) { 733 void visitTypeUse(TypeUse typeUse) {
738 enqueuer.registerTypeUse(typeUse); 734 enqueuer.registerTypeUse(typeUse);
739 } 735 }
740 } 736 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend.dart ('k') | pkg/compiler/lib/src/serialization/task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698