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

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

Issue 800903005: dart2js OldEmitter: name anonymous function so it does not need to be copied in deferred parts. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments. 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/old_emitter/reflection_data_parser.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 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 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 if(isProgramSplit) { 1492 if(isProgramSplit) {
1493 mainBuffer.write('${globalsHolder}.$globalObject$_=${_}'); 1493 mainBuffer.write('${globalsHolder}.$globalObject$_=${_}');
1494 } 1494 }
1495 mainBuffer.write('new dart$N'); 1495 mainBuffer.write('new dart$N');
1496 } 1496 }
1497 1497
1498 mainBuffer.write('function ${namer.isolateName}()$_{}\n'); 1498 mainBuffer.write('function ${namer.isolateName}()$_{}\n');
1499 if (isProgramSplit) { 1499 if (isProgramSplit) {
1500 mainBuffer 1500 mainBuffer
1501 .write('${globalsHolder}.${namer.isolateName}$_=$_' 1501 .write('${globalsHolder}.${namer.isolateName}$_=$_'
1502 '${namer.isolateName}$N' 1502 '${namer.isolateName}$N'
1503 '${globalsHolder}.$initName$_=${_}$initName$N'); 1503 '${globalsHolder}.$initName$_=${_}$initName$N'
1504 '${globalsHolder}.$parseReflectionDataName$_=$_'
1505 '$parseReflectionDataName$N');
1504 } 1506 }
1505 mainBuffer.write('init()$N$n'); 1507 mainBuffer.write('init()$N$n');
1506 mainBuffer.write('$isolateProperties$_=$_$isolatePropertiesName$N'); 1508 mainBuffer.write('$isolateProperties$_=$_$isolatePropertiesName$N');
1507 1509
1508 emitStaticFunctions(task.outputStaticLists[mainOutputUnit]); 1510 emitStaticFunctions(task.outputStaticLists[mainOutputUnit]);
1509 1511
1510 List<ClassElement> classes = task.outputClassLists[mainOutputUnit]; 1512 List<ClassElement> classes = task.outputClassLists[mainOutputUnit];
1511 if (classes != null) { 1513 if (classes != null) {
1512 for (ClassElement element in classes) { 1514 for (ClassElement element in classes) {
1513 generateClass(element, getElementDescriptor(element)); 1515 generateClass(element, getElementDescriptor(element));
(...skipping 14 matching lines...) Expand all
1528 1530
1529 checkEverythingEmitted(elementDescriptors.keys); 1531 checkEverythingEmitted(elementDescriptors.keys);
1530 1532
1531 CodeBuffer libraryBuffer = new CodeBuffer(); 1533 CodeBuffer libraryBuffer = new CodeBuffer();
1532 for (LibraryElement library in Elements.sortedByPosition(libraries)) { 1534 for (LibraryElement library in Elements.sortedByPosition(libraries)) {
1533 writeLibraryDescriptors(libraryBuffer, library); 1535 writeLibraryDescriptors(libraryBuffer, library);
1534 elementDescriptors.remove(library); 1536 elementDescriptors.remove(library);
1535 } 1537 }
1536 1538
1537 mainBuffer 1539 mainBuffer
1538 ..write('(')
1539 ..write( 1540 ..write(
1540 jsAst.prettyPrint( 1541 jsAst.prettyPrint(
1541 getReflectionDataParser(this, backend), 1542 getReflectionDataParser(this, backend),
1542 compiler)) 1543 compiler))
1543 ..write(')') 1544 ..write(n);
1544 ..write('([$n') 1545
1545 ..write(libraryBuffer) 1546 mainBuffer..write('$parseReflectionDataName([$n')
1546 ..write('])$N'); 1547 ..write(libraryBuffer)
1548 ..write('])$N');
1547 } 1549 }
1548 1550
1549 interceptorEmitter.emitGetInterceptorMethods(mainBuffer); 1551 interceptorEmitter.emitGetInterceptorMethods(mainBuffer);
1550 interceptorEmitter.emitOneShotInterceptors(mainBuffer); 1552 interceptorEmitter.emitOneShotInterceptors(mainBuffer);
1551 1553
1552 if (task.outputContainsConstantList) { 1554 if (task.outputContainsConstantList) {
1553 emitMakeConstantList(mainBuffer); 1555 emitMakeConstantList(mainBuffer);
1554 } 1556 }
1555 1557
1556 // Constants in checked mode call into RTI code to set type information 1558 // Constants in checked mode call into RTI code to set type information
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1968 outputBuffer..write(buildGeneratedBy()) 1970 outputBuffer..write(buildGeneratedBy())
1969 ..write('${deferredInitializers}.current$_=$_' 1971 ..write('${deferredInitializers}.current$_=$_'
1970 'function$_(${globalsHolder}) {$N'); 1972 'function$_(${globalsHolder}) {$N');
1971 for (String globalObject in Namer.reservedGlobalObjectNames) { 1973 for (String globalObject in Namer.reservedGlobalObjectNames) {
1972 outputBuffer 1974 outputBuffer
1973 .write('var $globalObject$_=$_' 1975 .write('var $globalObject$_=$_'
1974 '${globalsHolder}.$globalObject$N'); 1976 '${globalsHolder}.$globalObject$N');
1975 } 1977 }
1976 outputBuffer 1978 outputBuffer
1977 ..write('var init$_=$_${globalsHolder}.init$N') 1979 ..write('var init$_=$_${globalsHolder}.init$N')
1980 ..write('var $parseReflectionDataName$_=$_'
1981 '$globalsHolder.$parseReflectionDataName$N')
1978 ..write('var ${namer.isolateName}$_=$_' 1982 ..write('var ${namer.isolateName}$_=$_'
1979 '${globalsHolder}.${namer.isolateName}$N'); 1983 '${globalsHolder}.${namer.isolateName}$N');
1980 if (libraryDescriptorBuffer != null) { 1984 if (libraryDescriptorBuffer != null) {
1981 // TODO(ahe): This defines a lot of properties on the 1985 // TODO(ahe): This defines a lot of properties on the
1982 // Isolate.prototype object. We know this will turn it into a 1986 // Isolate.prototype object. We know this will turn it into a
1983 // slow object in V8, so instead we should do something similar 1987 // slow object in V8, so instead we should do something similar
1984 // to Isolate.$finishIsolateConstructor. 1988 // to Isolate.$finishIsolateConstructor.
1985 outputBuffer 1989 outputBuffer
1986 ..write('var ${namer.currentIsolate}$_=$_$isolatePropertiesName;$n') 1990 ..write('var ${namer.currentIsolate}$_=$_$isolatePropertiesName$N')
1987 ..write('(') 1991 ..write('$parseReflectionDataName([$n')
1988 ..write(
1989 jsAst.prettyPrint(
1990 getReflectionDataParser(this, backend),
1991 compiler, monitor: compiler.dumpInfoTask))
1992 ..write(')')
1993 ..write('([$n')
1994 ..addBuffer(libraryDescriptorBuffer) 1992 ..addBuffer(libraryDescriptorBuffer)
1995 ..write('])$N'); 1993 ..write('])$N');
1996 1994
1997 } 1995 }
1998 1996
1999 // Set the currentIsolate variable to the current isolate (which is 1997 // Set the currentIsolate variable to the current isolate (which is
2000 // provided as second argument). 1998 // provided as second argument).
2001 // We need to do this, because we use the same variable for setting up 1999 // We need to do this, because we use the same variable for setting up
2002 // the isolate-properties and for storing the current isolate. During 2000 // the isolate-properties and for storing the current isolate. During
2003 // the setup (the code above this lines) we must set the variable to 2001 // the setup (the code above this lines) we must set the variable to
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
2094 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { 2092 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) {
2095 if (element.isInstanceMember) { 2093 if (element.isInstanceMember) {
2096 cachedClassBuilders.remove(element.enclosingClass); 2094 cachedClassBuilders.remove(element.enclosingClass);
2097 2095
2098 nativeEmitter.cachedBuilders.remove(element.enclosingClass); 2096 nativeEmitter.cachedBuilders.remove(element.enclosingClass);
2099 2097
2100 } 2098 }
2101 } 2099 }
2102 } 2100 }
2103 } 2101 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/old_emitter/reflection_data_parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698