| OLD | NEW |
| 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 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 list.fixed$length = Array; | 726 list.fixed$length = Array; |
| 727 return list; | 727 return list; |
| 728 }''', | 728 }''', |
| 729 [namer.isolateName, makeConstListProperty]); | 729 [namer.isolateName, makeConstListProperty]); |
| 730 } else { | 730 } else { |
| 731 return js.comment("Output contains no constant list."); | 731 return js.comment("Output contains no constant list."); |
| 732 } | 732 } |
| 733 } | 733 } |
| 734 | 734 |
| 735 jsAst.Statement buildFunctionThatReturnsNull() { | 735 jsAst.Statement buildFunctionThatReturnsNull() { |
| 736 return js.statement('# = function() {}', | 736 return js.statement('#.# = function() {}', |
| 737 [backend.rti.getFunctionThatReturnsNullName]); | 737 [namer.isolateName, |
| 738 backend.rti.getFunctionThatReturnsNullName]); |
| 738 } | 739 } |
| 739 | 740 |
| 740 jsAst.Expression generateFunctionThatReturnsNull() { | 741 jsAst.Expression generateFunctionThatReturnsNull() { |
| 741 return js("#", [backend.rti.getFunctionThatReturnsNullName]); | 742 return js("#.#", [namer.isolateName, |
| 743 backend.rti.getFunctionThatReturnsNullName]); |
| 742 } | 744 } |
| 743 | 745 |
| 744 buildMain(jsAst.Statement invokeMain) { | 746 buildMain(jsAst.Statement invokeMain) { |
| 745 if (compiler.isMockCompilation) return js.comment("Mock compilation"); | 747 if (compiler.isMockCompilation) return js.comment("Mock compilation"); |
| 746 | 748 |
| 747 List<jsAst.Statement> parts = <jsAst.Statement>[]; | 749 List<jsAst.Statement> parts = <jsAst.Statement>[]; |
| 748 | 750 |
| 749 if (NativeGenerator.needsIsolateAffinityTagInitialization(backend)) { | 751 if (NativeGenerator.needsIsolateAffinityTagInitialization(backend)) { |
| 750 parts.add( | 752 parts.add( |
| 751 NativeGenerator.generateIsolateAffinityTagInitialization( | 753 NativeGenerator.generateIsolateAffinityTagInitialization( |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 var lazyInitName = lazies[lazyInitializers[i]]; | 873 var lazyInitName = lazies[lazyInitializers[i]]; |
| 872 this[lazyInitName] = isolateProperties[lazyInitName]; | 874 this[lazyInitName] = isolateProperties[lazyInitName]; |
| 873 } | 875 } |
| 874 } | 876 } |
| 875 Isolate.prototype = oldIsolate.prototype; | 877 Isolate.prototype = oldIsolate.prototype; |
| 876 Isolate.prototype.constructor = Isolate; | 878 Isolate.prototype.constructor = Isolate; |
| 877 Isolate.#isolatePropertiesName = isolateProperties; | 879 Isolate.#isolatePropertiesName = isolateProperties; |
| 878 if (#outputContainsConstantList) { | 880 if (#outputContainsConstantList) { |
| 879 Isolate.#makeConstListProperty = oldIsolate.#makeConstListProperty; | 881 Isolate.#makeConstListProperty = oldIsolate.#makeConstListProperty; |
| 880 } | 882 } |
| 883 Isolate.#functionThatReturnsNullProperty = |
| 884 oldIsolate.#functionThatReturnsNullProperty; |
| 881 if (#hasIncrementalSupport) { | 885 if (#hasIncrementalSupport) { |
| 882 Isolate.#lazyInitializerProperty = | 886 Isolate.#lazyInitializerProperty = |
| 883 oldIsolate.#lazyInitializerProperty; | 887 oldIsolate.#lazyInitializerProperty; |
| 884 } | 888 } |
| 885 return Isolate; | 889 return Isolate; |
| 886 } | 890 } |
| 887 | 891 |
| 888 }''', {'allClasses': allClassesAccess, | 892 }''', {'allClasses': allClassesAccess, |
| 889 'getTypeFromName': getTypeFromNameAccess, | 893 'getTypeFromName': getTypeFromNameAccess, |
| 890 'interceptorsByTag': interceptorsByTagAccess, | 894 'interceptorsByTag': interceptorsByTagAccess, |
| 891 'leafTags': leafTagsAccess, | 895 'leafTags': leafTagsAccess, |
| 892 'finishedClasses': finishedClassesAccess, | 896 'finishedClasses': finishedClassesAccess, |
| 893 'needsLazyInitializer': needsLazyInitializer, | 897 'needsLazyInitializer': needsLazyInitializer, |
| 894 'lazies': laziesAccess, 'cyclicThrow': cyclicThrow, | 898 'lazies': laziesAccess, 'cyclicThrow': cyclicThrow, |
| 895 'isolatePropertiesName': namer.isolatePropertiesName, | 899 'isolatePropertiesName': namer.isolatePropertiesName, |
| 896 'outputContainsConstantList': task.outputContainsConstantList, | 900 'outputContainsConstantList': task.outputContainsConstantList, |
| 897 'makeConstListProperty': makeConstListProperty, | 901 'makeConstListProperty': makeConstListProperty, |
| 902 'functionThatReturnsNullProperty': |
| 903 backend.rti.getFunctionThatReturnsNullName, |
| 898 'hasIncrementalSupport': compiler.hasIncrementalSupport, | 904 'hasIncrementalSupport': compiler.hasIncrementalSupport, |
| 899 'lazyInitializerProperty': lazyInitializerProperty,}); | 905 'lazyInitializerProperty': lazyInitializerProperty,}); |
| 900 } | 906 } |
| 901 | 907 |
| 902 jsAst.Statement buildConvertToFastObjectFunction() { | 908 jsAst.Statement buildConvertToFastObjectFunction() { |
| 903 List<jsAst.Statement> debugCode = <jsAst.Statement>[]; | 909 List<jsAst.Statement> debugCode = <jsAst.Statement>[]; |
| 904 if (DEBUG_FAST_OBJECTS) { | 910 if (DEBUG_FAST_OBJECTS) { |
| 905 debugCode.add(js.statement(r''' | 911 debugCode.add(js.statement(r''' |
| 906 // The following only works on V8 when run with option | 912 // The following only works on V8 when run with option |
| 907 // "--allow-natives-syntax". We use'new Function' because the | 913 // "--allow-natives-syntax". We use'new Function' because the |
| (...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2002 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { | 2008 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { |
| 2003 if (element.isInstanceMember) { | 2009 if (element.isInstanceMember) { |
| 2004 cachedClassBuilders.remove(element.enclosingClass); | 2010 cachedClassBuilders.remove(element.enclosingClass); |
| 2005 | 2011 |
| 2006 nativeEmitter.cachedBuilders.remove(element.enclosingClass); | 2012 nativeEmitter.cachedBuilders.remove(element.enclosingClass); |
| 2007 | 2013 |
| 2008 } | 2014 } |
| 2009 } | 2015 } |
| 2010 } | 2016 } |
| 2011 } | 2017 } |
| OLD | NEW |