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

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

Issue 832363002: Remove Compiler.assembledCode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.new_js_emitter.emitter; 5 library dart2js.new_js_emitter.emitter;
6 6
7 import '../model.dart'; 7 import '../model.dart';
8 import 'model_emitter.dart'; 8 import 'model_emitter.dart';
9 import '../../common.dart'; 9 import '../../common.dart';
10 import '../../js/js.dart' as js; 10 import '../../js/js.dart' as js;
11 11
12 import '../../js_backend/js_backend.dart' show Namer, JavaScriptBackend; 12 import '../../js_backend/js_backend.dart' show Namer, JavaScriptBackend;
13 import '../../js_emitter/js_emitter.dart' as emitterTask show 13 import '../../js_emitter/js_emitter.dart' as emitterTask show
14 CodeEmitterTask, 14 CodeEmitterTask,
15 Emitter; 15 Emitter;
16 16
17 class Emitter implements emitterTask.Emitter { 17 class Emitter implements emitterTask.Emitter {
18 final Compiler _compiler; 18 final Compiler _compiler;
19 final Namer namer; 19 final Namer namer;
20 final ModelEmitter _emitter; 20 final ModelEmitter _emitter;
21 21
22 Emitter(Compiler compiler, Namer namer) 22 Emitter(Compiler compiler, Namer namer)
23 : this._compiler = compiler, 23 : this._compiler = compiler,
24 this.namer = namer, 24 this.namer = namer,
25 _emitter = new ModelEmitter(compiler, namer); 25 _emitter = new ModelEmitter(compiler, namer);
26 26
27 void emitProgram(Program program) { 27 int emitProgram(Program program) {
28 _emitter.emitProgram(program); 28 return _emitter.emitProgram(program);
29 } 29 }
30 30
31 // TODO(floitsch): copied from OldEmitter. Adjust or share. 31 // TODO(floitsch): copied from OldEmitter. Adjust or share.
32 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant) { 32 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant) {
33 if (constant.isFunction) return true; // Already emitted. 33 if (constant.isFunction) return true; // Already emitted.
34 if (constant.isPrimitive) return true; // Inlined. 34 if (constant.isPrimitive) return true; // Inlined.
35 if (constant.isDummy) return true; // Inlined. 35 if (constant.isDummy) return true; // Inlined.
36 // The name is null when the constant is already a JS constant. 36 // The name is null when the constant is already a JS constant.
37 // TODO(floitsch): every constant should be registered, so that we can 37 // TODO(floitsch): every constant should be registered, so that we can
38 // share the ones that take up too much space (like some strings). 38 // share the ones that take up too much space (like some strings).
(...skipping 27 matching lines...) Expand all
66 js.Expression generateEmbeddedGlobalAccess(String global) { 66 js.Expression generateEmbeddedGlobalAccess(String global) {
67 // TODO(floitsch): We should not use "init" for globals. 67 // TODO(floitsch): We should not use "init" for globals.
68 return js.string("init.$global"); 68 return js.string("init.$global");
69 } 69 }
70 70
71 js.Expression constantReference(ConstantValue value) { 71 js.Expression constantReference(ConstantValue value) {
72 return _emitter.constantEmitter.reference(value); 72 return _emitter.constantEmitter.reference(value);
73 } 73 }
74 74
75 js.Expression isolateLazyInitializerAccess(Element element) { 75 js.Expression isolateLazyInitializerAccess(Element element) {
76 return js.js('#.#', [namer.globalObjectFor(element), 76 return js.js('#.#', [namer.globalObjectFor(element),
77 namer.getLazyInitializerName(element)]); 77 namer.getLazyInitializerName(element)]);
78 } 78 }
79 79
80 js.Expression isolateStaticClosureAccess(Element element) { 80 js.Expression isolateStaticClosureAccess(Element element) {
81 return js.js('#.#()', 81 return js.js('#.#()',
82 [namer.globalObjectFor(element), namer.getStaticClosureName(element)]); 82 [namer.globalObjectFor(element), namer.getStaticClosureName(element)]);
83 } 83 }
84 84
85 js.PropertyAccess globalPropertyAccess(Element element) { 85 js.PropertyAccess globalPropertyAccess(Element element) {
86 String name = namer.getNameX(element); 86 String name = namer.getNameX(element);
87 js.PropertyAccess pa = new js.PropertyAccess.field( 87 js.PropertyAccess pa = new js.PropertyAccess.field(
88 new js.VariableUse(namer.globalObjectFor(element)), 88 new js.VariableUse(namer.globalObjectFor(element)),
89 name); 89 name);
90 return pa; 90 return pa;
91 } 91 }
92 92
93 js.PropertyAccess staticFieldAccess(Element element) { 93 js.PropertyAccess staticFieldAccess(Element element) {
94 return globalPropertyAccess(element); 94 return globalPropertyAccess(element);
95 } 95 }
96 96
97 js.PropertyAccess staticFunctionAccess(Element element) { 97 js.PropertyAccess staticFunctionAccess(Element element) {
98 return globalPropertyAccess(element); 98 return globalPropertyAccess(element);
99 } 99 }
100 100
101 js.PropertyAccess classAccess(Element element) { 101 js.PropertyAccess classAccess(Element element) {
102 return globalPropertyAccess(element); 102 return globalPropertyAccess(element);
103 } 103 }
104 104
105 js.PropertyAccess typedefAccess(Element element) { 105 js.PropertyAccess typedefAccess(Element element) {
106 return globalPropertyAccess(element); 106 return globalPropertyAccess(element);
107 } 107 }
108 108
109 void invalidateCaches() {} 109 void invalidateCaches() {}
110 } 110 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698