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

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

Issue 859843002: dart2js: use model in native emitter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revert debug code. 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/native_emitter.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.model; 5 library dart2js.new_js_emitter.model;
6 6
7 import '../js/js.dart' as js show Expression; 7 import '../js/js.dart' as js show Expression;
8 import '../constants/values.dart' show ConstantValue; 8 import '../constants/values.dart' show ConstantValue;
9 9
10 import '../deferred_load.dart' show OutputUnit; 10 import '../deferred_load.dart' show OutputUnit;
11 11
12 import '../common.dart'; 12 import '../common.dart';
13 13
14 class Program { 14 class Program {
15 final List<Fragment> fragments; 15 final List<Fragment> fragments;
16 final List<Class> nativeClasses;
16 final bool outputContainsConstantList; 17 final bool outputContainsConstantList;
17 /// A map from load id to the list of fragments that need to be loaded. 18 /// A map from load id to the list of fragments that need to be loaded.
18 final Map<String, List<Fragment>> loadMap; 19 final Map<String, List<Fragment>> loadMap;
19 20
20 Program(this.fragments, this.outputContainsConstantList, this.loadMap); 21 Program(this.fragments,
22 this.nativeClasses,
23 this.outputContainsConstantList,
24 this.loadMap);
21 25
22 bool get isSplit => fragments.length > 1; 26 bool get isSplit => fragments.length > 1;
23 Iterable<Fragment> get deferredFragments => fragments.skip(1); 27 Iterable<Fragment> get deferredFragments => fragments.skip(1);
24 } 28 }
25 29
26 /** 30 /**
27 * This class represents a JavaScript object that contains static state, like 31 * This class represents a JavaScript object that contains static state, like
28 * classes or functions. 32 * classes or functions.
29 */ 33 */
30 class Holder { 34 class Holder {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 /// Uses indicate missing information in the model. 165 /// Uses indicate missing information in the model.
162 final Element element; 166 final Element element;
163 167
164 final String name; 168 final String name;
165 final Holder holder; 169 final Holder holder;
166 Class _superclass; 170 Class _superclass;
167 final List<Method> methods; 171 final List<Method> methods;
168 final List<InstanceField> fields; 172 final List<InstanceField> fields;
169 final bool onlyForRti; 173 final bool onlyForRti;
170 final bool isDirectlyInstantiated; 174 final bool isDirectlyInstantiated;
175 final bool isNative;
171 176
172 /// Whether the class must be evaluated eagerly. 177 /// Whether the class must be evaluated eagerly.
173 bool isEager = false; 178 bool isEager = false;
174 179
175 Class(this.element, 180 Class(this.element,
176 this.name, this.holder, this.methods, this.fields, 181 this.name, this.holder, this.methods, this.fields,
177 {this.onlyForRti, 182 {this.onlyForRti,
178 this.isDirectlyInstantiated}) { 183 this.isDirectlyInstantiated,
184 this.isNative}) {
179 assert(onlyForRti != null); 185 assert(onlyForRti != null);
180 assert(isDirectlyInstantiated != null); 186 assert(isDirectlyInstantiated != null);
187 assert(isNative != null);
181 } 188 }
182 189
183 bool get isMixinApplication => false; 190 bool get isMixinApplication => false;
184 Class get superclass => _superclass; 191 Class get superclass => _superclass;
185 192
186 void setSuperclass(Class superclass) { 193 void setSuperclass(Class superclass) {
187 _superclass = superclass; 194 _superclass = superclass;
188 } 195 }
189 196
190 String get superclassName 197 String get superclassName
191 => (superclass == null) ? "" : superclass.name; 198 => (superclass == null) ? "" : superclass.name;
192 int get superclassHolderIndex 199 int get superclassHolderIndex
193 => (superclass == null) ? 0 : superclass.holder.index; 200 => (superclass == null) ? 0 : superclass.holder.index;
194 } 201 }
195 202
196 class MixinApplication extends Class { 203 class MixinApplication extends Class {
197 Class _mixinClass; 204 Class _mixinClass;
198 205
199 MixinApplication(Element element, 206 MixinApplication(Element element,
200 String name, Holder holder, 207 String name, Holder holder,
201 List<Method> methods, 208 List<Method> methods,
202 List<InstanceField> fields, 209 List<InstanceField> fields,
203 {bool onlyForRti, 210 {bool onlyForRti,
204 bool isDirectlyInstantiated}) 211 bool isDirectlyInstantiated})
205 : super(element, 212 : super(element,
206 name, holder, methods, fields, 213 name, holder, methods, fields,
207 onlyForRti: onlyForRti, 214 onlyForRti: onlyForRti,
208 isDirectlyInstantiated: isDirectlyInstantiated); 215 isDirectlyInstantiated: isDirectlyInstantiated,
216 isNative: false);
sra1 2015/01/21 06:27:06 I believe that you can create a custom element tha
209 217
210 bool get isMixinApplication => true; 218 bool get isMixinApplication => true;
211 Class get mixinClass => _mixinClass; 219 Class get mixinClass => _mixinClass;
212 220
213 void setMixinClass(Class mixinClass) { 221 void setMixinClass(Class mixinClass) {
214 _mixinClass = mixinClass; 222 _mixinClass = mixinClass;
215 } 223 }
216 } 224 }
217 225
218 class InstanceField { 226 class InstanceField {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 StaticMethod(Element element, String name, this.holder, js.Expression code, 273 StaticMethod(Element element, String name, this.holder, js.Expression code,
266 {bool needsTearOff}) 274 {bool needsTearOff})
267 : super(element, name, code, needsTearOff: needsTearOff); 275 : super(element, name, code, needsTearOff: needsTearOff);
268 } 276 }
269 277
270 class StaticStubMethod extends StaticMethod { 278 class StaticStubMethod extends StaticMethod {
271 StaticStubMethod(String name, Holder holder, js.Expression code, 279 StaticStubMethod(String name, Holder holder, js.Expression code,
272 {bool needsTearOff}) 280 {bool needsTearOff})
273 : super(null, name, holder, code, needsTearOff: needsTearOff); 281 : super(null, name, holder, code, needsTearOff: needsTearOff);
274 } 282 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/native_emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698