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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/code_emitter_task.dart

Issue 2809203003: Remove Compiler/JavaScriptBackend from metadata_collector (Closed)
Patch Set: Created 3 years, 8 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_emitter.code_emitter_task; 5 library dart2js.js_emitter.code_emitter_task;
6 6
7 import 'package:js_runtime/shared/embedded_names.dart' show JsBuiltin; 7 import 'package:js_runtime/shared/embedded_names.dart' show JsBuiltin;
8 8
9 import '../common.dart'; 9 import '../common.dart';
10 import '../common/tasks.dart' show CompilerTask; 10 import '../common/tasks.dart' show CompilerTask;
11 import '../compiler.dart' show Compiler; 11 import '../compiler.dart' show Compiler;
12 import '../constants/values.dart'; 12 import '../constants/values.dart';
13 import '../deferred_load.dart' show OutputUnit; 13 import '../deferred_load.dart' show OutputUnit;
14 import '../elements/entities.dart'; 14 import '../elements/entities.dart';
15 import '../js/js.dart' as jsAst; 15 import '../js/js.dart' as jsAst;
16 import '../js_backend/js_backend.dart' show JavaScriptBackend, Namer; 16 import '../js_backend/js_backend.dart' show JavaScriptBackend, Namer;
17 import '../universe/world_builder.dart' show CodegenWorldBuilder;
17 import '../world.dart' show ClosedWorld; 18 import '../world.dart' show ClosedWorld;
18 import 'full_emitter/emitter.dart' as full_js_emitter; 19 import 'full_emitter/emitter.dart' as full_js_emitter;
19 import 'lazy_emitter/emitter.dart' as lazy_js_emitter; 20 import 'lazy_emitter/emitter.dart' as lazy_js_emitter;
20 import 'program_builder/program_builder.dart'; 21 import 'program_builder/program_builder.dart';
21 import 'startup_emitter/emitter.dart' as startup_js_emitter; 22 import 'startup_emitter/emitter.dart' as startup_js_emitter;
22 23
23 import 'metadata_collector.dart' show MetadataCollector; 24 import 'metadata_collector.dart' show MetadataCollector;
24 import 'native_emitter.dart' show NativeEmitter; 25 import 'native_emitter.dart' show NativeEmitter;
25 import 'type_test_registry.dart' show TypeTestRegistry; 26 import 'type_test_registry.dart' show TypeTestRegistry;
26 27
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 150
150 Set<ClassEntity> _finalizeRti() { 151 Set<ClassEntity> _finalizeRti() {
151 // Compute the required type checks to know which classes need a 152 // Compute the required type checks to know which classes need a
152 // 'is$' method. 153 // 'is$' method.
153 typeTestRegistry.computeRequiredTypeChecks(); 154 typeTestRegistry.computeRequiredTypeChecks();
154 // Compute the classes needed by RTI. 155 // Compute the classes needed by RTI.
155 return typeTestRegistry.computeRtiNeededClasses(); 156 return typeTestRegistry.computeRtiNeededClasses();
156 } 157 }
157 158
158 /// Creates the [Emitter] for this task. 159 /// Creates the [Emitter] for this task.
159 void createEmitter(Namer namer, ClosedWorld closedWorld) { 160 void createEmitter(Namer namer, ClosedWorld closedWorld,
161 CodegenWorldBuilder codegenWorldBuilder) {
160 measure(() { 162 measure(() {
161 _emitter = _emitterFactory.createEmitter(this, namer, closedWorld); 163 _emitter = _emitterFactory.createEmitter(this, namer, closedWorld);
162 metadataCollector = new MetadataCollector(compiler, _emitter); 164 metadataCollector = new MetadataCollector(
163 typeTestRegistry = new TypeTestRegistry(compiler, closedWorld); 165 compiler.options,
166 compiler.reporter,
167 compiler.deferredLoadTask,
168 _emitter,
169 backend.constants,
170 backend.typeVariableCodegenAnalysis,
171 backend.mirrorsData,
172 backend.rtiEncoder);
173 typeTestRegistry = new TypeTestRegistry(
174 codegenWorldBuilder, compiler.backend, closedWorld);
164 }); 175 });
165 } 176 }
166 177
167 int assembleProgram(Namer namer, ClosedWorld closedWorld) { 178 int assembleProgram(Namer namer, ClosedWorld closedWorld) {
168 return measure(() { 179 return measure(() {
169 Set<ClassEntity> rtiNeededClasses = _finalizeRti(); 180 Set<ClassEntity> rtiNeededClasses = _finalizeRti();
170 ProgramBuilder programBuilder = new ProgramBuilder( 181 ProgramBuilder programBuilder = new ProgramBuilder(
171 compiler, namer, this, emitter, closedWorld, rtiNeededClasses); 182 compiler, namer, this, emitter, closedWorld, rtiNeededClasses);
172 int size = emitter.emitProgram(programBuilder); 183 int size = emitter.emitProgram(programBuilder);
173 // TODO(floitsch): we shouldn't need the `neededClasses` anymore. 184 // TODO(floitsch): we shouldn't need the `neededClasses` anymore.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 245
235 /// Returns the JS code for accessing the given [constant]. 246 /// Returns the JS code for accessing the given [constant].
236 jsAst.Expression constantReference(ConstantValue constant); 247 jsAst.Expression constantReference(ConstantValue constant);
237 248
238 /// Returns the JS template for the given [builtin]. 249 /// Returns the JS template for the given [builtin].
239 jsAst.Template templateForBuiltin(JsBuiltin builtin); 250 jsAst.Template templateForBuiltin(JsBuiltin builtin);
240 251
241 /// Returns the size of the code generated for a given output [unit]. 252 /// Returns the size of the code generated for a given output [unit].
242 int generatedSize(OutputUnit unit); 253 int generatedSize(OutputUnit unit);
243 } 254 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698