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

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

Issue 1057513002: Also intialize methods inherited from mixin classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added a regression test. Created 5 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 | 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 part of dart2js.js_emitter; 5 part of dart2js.js_emitter;
6 6
7 7
8 class OldEmitter implements Emitter { 8 class OldEmitter implements Emitter {
9 final Compiler compiler; 9 final Compiler compiler;
10 final CodeEmitterTask task; 10 final CodeEmitterTask task;
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 'hasIncrementalSupport': compiler.hasIncrementalSupport, 821 'hasIncrementalSupport': compiler.hasIncrementalSupport,
822 'lazyInitializerProperty': lazyInitializerProperty,}); 822 'lazyInitializerProperty': lazyInitializerProperty,});
823 823
824 output.addBuffer( 824 output.addBuffer(
825 jsAst.prettyPrint(decl, compiler, monitor: compiler.dumpInfoTask)); 825 jsAst.prettyPrint(decl, compiler, monitor: compiler.dumpInfoTask));
826 if (compiler.enableMinification) { 826 if (compiler.enableMinification) {
827 output.add('\n'); 827 output.add('\n');
828 } 828 }
829 } 829 }
830 830
831 String get markerFun => 'markerFun';
832
833 void emitMarkerFun(CodeOutput output) {
834 jsAst.Statement markerFunStmt = js.statement('''
835 // This function is used to mark the end of the inheritance chain so that
836 // finishAddStubsHelper knows where to stop searching for deferred work.
837 // We have to put it at the top level so that we only get one instance of
838 // it even if we call parseReflectionData multiple times, e.g., due to
839 // deferred loading.
840 function #() {}''', markerFun);
841 output.addBuffer(jsAst.prettyPrint(markerFunStmt, compiler));
842 output.add(N);
843 }
844
845 void emitConvertToFastObjectFunction(CodeOutput output) { 831 void emitConvertToFastObjectFunction(CodeOutput output) {
846 List<jsAst.Statement> debugCode = <jsAst.Statement>[]; 832 List<jsAst.Statement> debugCode = <jsAst.Statement>[];
847 if (DEBUG_FAST_OBJECTS) { 833 if (DEBUG_FAST_OBJECTS) {
848 debugCode.add(js.statement(r''' 834 debugCode.add(js.statement(r'''
849 // The following only works on V8 when run with option 835 // The following only works on V8 when run with option
850 // "--allow-natives-syntax". We use'new Function' because the 836 // "--allow-natives-syntax". We use'new Function' because the
851 // miniparser does not understand V8 native syntax. 837 // miniparser does not understand V8 native syntax.
852 if (typeof print === "function") { 838 if (typeof print === "function") {
853 var HasFastProperties = 839 var HasFastProperties =
854 new Function("a", "return %HasFastProperties(a)"); 840 new Function("a", "return %HasFastProperties(a)");
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 // The following code should not use the short-hand for the 1281 // The following code should not use the short-hand for the
1296 // initialStatics. 1282 // initialStatics.
1297 mainOutput.add('${namer.currentIsolate}$_=${_}null$N'); 1283 mainOutput.add('${namer.currentIsolate}$_=${_}null$N');
1298 1284
1299 emitFinishIsolateConstructorInvocation(mainOutput); 1285 emitFinishIsolateConstructorInvocation(mainOutput);
1300 mainOutput.add( 1286 mainOutput.add(
1301 '${namer.currentIsolate}$_=${_}new ${namer.isolateName}()$N'); 1287 '${namer.currentIsolate}$_=${_}new ${namer.isolateName}()$N');
1302 1288
1303 emitConvertToFastObjectFunction(mainOutput); 1289 emitConvertToFastObjectFunction(mainOutput);
1304 emitConvertToSlowObjectFunction(mainOutput); 1290 emitConvertToSlowObjectFunction(mainOutput);
1305 emitMarkerFun(mainOutput);
1306 1291
1307 for (String globalObject in Namer.reservedGlobalObjectNames) { 1292 for (String globalObject in Namer.reservedGlobalObjectNames) {
1308 mainOutput.add('$globalObject = convertToFastObject($globalObject)$N'); 1293 mainOutput.add('$globalObject = convertToFastObject($globalObject)$N');
1309 } 1294 }
1310 if (DEBUG_FAST_OBJECTS) { 1295 if (DEBUG_FAST_OBJECTS) {
1311 mainOutput.add(r''' 1296 mainOutput.add(r'''
1312 // The following only works on V8 when run with option 1297 // The following only works on V8 when run with option
1313 // "--allow-natives-syntax". We use'new Function' because the 1298 // "--allow-natives-syntax". We use'new Function' because the
1314 // miniparser does not understand V8 native syntax. 1299 // miniparser does not understand V8 native syntax.
1315 if (typeof print === "function") { 1300 if (typeof print === "function") {
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
1823 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { 1808 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) {
1824 if (element.isInstanceMember) { 1809 if (element.isInstanceMember) {
1825 cachedClassBuilders.remove(element.enclosingClass); 1810 cachedClassBuilders.remove(element.enclosingClass);
1826 1811
1827 nativeEmitter.cachedBuilders.remove(element.enclosingClass); 1812 nativeEmitter.cachedBuilders.remove(element.enclosingClass);
1828 1813
1829 } 1814 }
1830 } 1815 }
1831 } 1816 }
1832 } 1817 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698