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

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

Issue 878553002: dart2js: native classes go through the normal code path. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase 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) 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 part of dart2js.js_emitter; 5 part of dart2js.js_emitter;
6 6
7 const USE_NEW_EMITTER = const bool.fromEnvironment("dart2js.use.new.emitter"); 7 const USE_NEW_EMITTER = const bool.fromEnvironment("dart2js.use.new.emitter");
8 8
9 /** 9 /**
10 * Generates the code for all used classes in the program. Static fields (even 10 * Generates the code for all used classes in the program. Static fields (even
(...skipping 19 matching lines...) Expand all
30 final Map<OutputUnit, List<VariableElement>> outputStaticNonFinalFieldLists = 30 final Map<OutputUnit, List<VariableElement>> outputStaticNonFinalFieldLists =
31 new Map<OutputUnit, List<VariableElement>>(); 31 new Map<OutputUnit, List<VariableElement>>();
32 final Map<OutputUnit, Set<LibraryElement>> outputLibraryLists = 32 final Map<OutputUnit, Set<LibraryElement>> outputLibraryLists =
33 new Map<OutputUnit, Set<LibraryElement>>(); 33 new Map<OutputUnit, Set<LibraryElement>>();
34 34
35 /// True, if the output contains a constant list. 35 /// True, if the output contains a constant list.
36 /// 36 ///
37 /// This flag is updated in [computeNeededConstants]. 37 /// This flag is updated in [computeNeededConstants].
38 bool outputContainsConstantList = false; 38 bool outputContainsConstantList = false;
39 39
40 final List<ClassElement> nativeClasses = <ClassElement>[]; 40 final List<ClassElement> nativeOrExtendsNativeClasses = <ClassElement>[];
herhut 2015/01/26 14:58:08 How about nativeClassesAndSubclasses ?
floitsch 2015/01/26 17:57:50 Done.
41 41
42 /// Records if a type variable is read dynamically for type tests. 42 /// Records if a type variable is read dynamically for type tests.
43 final Set<TypeVariableElement> readTypeVariables = 43 final Set<TypeVariableElement> readTypeVariables =
44 new Set<TypeVariableElement>(); 44 new Set<TypeVariableElement>();
45 45
46 List<TypedefElement> typedefsNeededForReflection; 46 List<TypedefElement> typedefsNeededForReflection;
47 47
48 JavaScriptBackend get backend => compiler.backend; 48 JavaScriptBackend get backend => compiler.backend;
49 49
50 CodeEmitterTask(Compiler compiler, Namer namer, bool generateSourceMap) 50 CodeEmitterTask(Compiler compiler, Namer namer, bool generateSourceMap)
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 neededClasses.add(compiler.listClass); 331 neededClasses.add(compiler.listClass);
332 } 332 }
333 333
334 // 5. Finally, sort the classes. 334 // 5. Finally, sort the classes.
335 List<ClassElement> sortedClasses = Elements.sortedByPosition(neededClasses); 335 List<ClassElement> sortedClasses = Elements.sortedByPosition(neededClasses);
336 336
337 for (ClassElement element in sortedClasses) { 337 for (ClassElement element in sortedClasses) {
338 if (Elements.isNativeOrExtendsNative(element) && 338 if (Elements.isNativeOrExtendsNative(element) &&
339 !typeTestRegistry.rtiNeededClasses.contains(element)) { 339 !typeTestRegistry.rtiNeededClasses.contains(element)) {
340 // For now, native classes and related classes cannot be deferred. 340 // For now, native classes and related classes cannot be deferred.
341 nativeClasses.add(element); 341 nativeOrExtendsNativeClasses.add(element);
342 if (!element.isNative) { 342 assert(invariant(element,
343 assert(invariant(element, 343 !compiler.deferredLoadTask.isDeferred(element)));
344 !compiler.deferredLoadTask.isDeferred(element))); 344 outputClassLists.putIfAbsent(compiler.deferredLoadTask.mainOutputUnit,
345 outputClassLists.putIfAbsent(compiler.deferredLoadTask.mainOutputUnit, 345 () => new List<ClassElement>()).add(element);
346 () => new List<ClassElement>()).add(element);
347 }
348 } else { 346 } else {
349 outputClassLists.putIfAbsent( 347 outputClassLists.putIfAbsent(
350 compiler.deferredLoadTask.outputUnitForElement(element), 348 compiler.deferredLoadTask.outputUnitForElement(element),
351 () => new List<ClassElement>()) 349 () => new List<ClassElement>())
352 .add(element); 350 .add(element);
353 } 351 }
354 } 352 }
355 } 353 }
356 354
357 void computeNeededStatics() { 355 void computeNeededStatics() {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 jsAst.Expression typeAccess(Element e); 455 jsAst.Expression typeAccess(Element e);
458 456
459 /// Returns the JS expression representing a function that returns 'null' 457 /// Returns the JS expression representing a function that returns 'null'
460 jsAst.Expression generateFunctionThatReturnsNull(); 458 jsAst.Expression generateFunctionThatReturnsNull();
461 459
462 int compareConstants(ConstantValue a, ConstantValue b); 460 int compareConstants(ConstantValue a, ConstantValue b);
463 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant); 461 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant);
464 462
465 void invalidateCaches(); 463 void invalidateCaches();
466 } 464 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/model.dart » ('j') | pkg/compiler/lib/src/js_emitter/native_emitter.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698