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

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

Issue 2836733002: dart2js: patch file support cleanup (Closed)
Patch Set: remove js_array change 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;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } 67 }
68 68
69 Emitter get emitter { 69 Emitter get emitter {
70 assert(invariant(NO_LOCATION_SPANNABLE, _emitter != null, 70 assert(invariant(NO_LOCATION_SPANNABLE, _emitter != null,
71 message: "Emitter has not been created yet.")); 71 message: "Emitter has not been created yet."));
72 return _emitter; 72 return _emitter;
73 } 73 }
74 74
75 String get name => 'Code emitter'; 75 String get name => 'Code emitter';
76 76
77 /// Returns the string that is used to find library patches that are
78 /// specialized for the emitter.
79 String get patchVersion => _emitterFactory.patchVersion;
80
81 /// Returns true, if the emitter supports reflection. 77 /// Returns true, if the emitter supports reflection.
82 bool get supportsReflection => _emitterFactory.supportsReflection; 78 bool get supportsReflection => _emitterFactory.supportsReflection;
83 79
84 /// Returns the closure expression of a static function. 80 /// Returns the closure expression of a static function.
85 jsAst.Expression isolateStaticClosureAccess(FunctionEntity element) { 81 jsAst.Expression isolateStaticClosureAccess(FunctionEntity element) {
86 return emitter.isolateStaticClosureAccess(element); 82 return emitter.isolateStaticClosureAccess(element);
87 } 83 }
88 84
89 /// Returns the JS function that must be invoked to get the value of the 85 /// Returns the JS function that must be invoked to get the value of the
90 /// lazily initialized static. 86 /// lazily initialized static.
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 isMockCompilation: compiler.isMockCompilation); 204 isMockCompilation: compiler.isMockCompilation);
209 int size = emitter.emitProgram(programBuilder); 205 int size = emitter.emitProgram(programBuilder);
210 // TODO(floitsch): we shouldn't need the `neededClasses` anymore. 206 // TODO(floitsch): we shouldn't need the `neededClasses` anymore.
211 neededClasses = programBuilder.collector.neededClasses; 207 neededClasses = programBuilder.collector.neededClasses;
212 return size; 208 return size;
213 }); 209 });
214 } 210 }
215 } 211 }
216 212
217 abstract class EmitterFactory { 213 abstract class EmitterFactory {
218 /// Returns the string that is used to find library patches that are
219 /// specialized for this emitter.
220 String get patchVersion;
221
222 /// Returns true, if the emitter supports reflection. 214 /// Returns true, if the emitter supports reflection.
223 bool get supportsReflection; 215 bool get supportsReflection;
224 216
225 /// Create the [Emitter] for the emitter [task] that uses the given [namer]. 217 /// Create the [Emitter] for the emitter [task] that uses the given [namer].
226 Emitter createEmitter( 218 Emitter createEmitter(
227 CodeEmitterTask task, Namer namer, ClosedWorld closedWorld); 219 CodeEmitterTask task, Namer namer, ClosedWorld closedWorld);
228 } 220 }
229 221
230 abstract class Emitter { 222 abstract class Emitter {
231 /// Uses the [programBuilder] to generate a model of the program, emits 223 /// Uses the [programBuilder] to generate a model of the program, emits
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 263
272 /// Returns the JS code for accessing the given [constant]. 264 /// Returns the JS code for accessing the given [constant].
273 jsAst.Expression constantReference(ConstantValue constant); 265 jsAst.Expression constantReference(ConstantValue constant);
274 266
275 /// Returns the JS template for the given [builtin]. 267 /// Returns the JS template for the given [builtin].
276 jsAst.Template templateForBuiltin(JsBuiltin builtin); 268 jsAst.Template templateForBuiltin(JsBuiltin builtin);
277 269
278 /// Returns the size of the code generated for a given output [unit]. 270 /// Returns the size of the code generated for a given output [unit].
279 int generatedSize(OutputUnit unit); 271 int generatedSize(OutputUnit unit);
280 } 272 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend.dart ('k') | pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698