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

Unified Diff: pkg/compiler/lib/src/js_emitter/old_emitter/reflection_data_parser.dart

Issue 810933003: Avoid emitting addStubs and tearOffCode when not needed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/js_emitter/old_emitter/reflection_data_parser.dart
diff --git a/pkg/compiler/lib/src/js_emitter/old_emitter/reflection_data_parser.dart b/pkg/compiler/lib/src/js_emitter/old_emitter/reflection_data_parser.dart
index 29179732ad5ca4f84339c73d26e2ad63d7b6818b..eaeba2b26ada7d1aa097206b0ec27481669a3244 100644
--- a/pkg/compiler/lib/src/js_emitter/old_emitter/reflection_data_parser.dart
+++ b/pkg/compiler/lib/src/js_emitter/old_emitter/reflection_data_parser.dart
@@ -140,6 +140,7 @@ jsAst.Expression getReflectionDataParser(OldEmitter oldEmitter,
'metadata': metadataAccess,
'notInCspMode': !compiler.useContentSecurityPolicy});
+ // TODO(zarah): Remove empty else branches in output when if(#hole) is false.
jsAst.Statement processStatics = js.statement('''
function processStatics(descriptor, processedClasses) {
for (var property in descriptor) {
@@ -170,8 +171,10 @@ jsAst.Expression getReflectionDataParser(OldEmitter oldEmitter,
functions.push(property);
#globalFunctions[property] = element;
} else if (element.constructor === Array) {
- addStubs(globalObject, element, property,
- true, descriptor, functions);
+ if (#needsArrayInitializerSupport) {
+ addStubs(globalObject, element, property,
+ true, descriptor, functions);
+ }
} else {
// We will not enter this case if no classes are defined.
if (#hasClasses) {
@@ -183,7 +186,8 @@ jsAst.Expression getReflectionDataParser(OldEmitter oldEmitter,
}
''', {'typeInformation': typeInformationAccess,
'globalFunctions': globalFunctionsAccess,
- 'hasClasses': oldEmitter.needsClassSupport});
+ 'hasClasses': oldEmitter.needsClassSupport,
+ 'needsArrayInitializerSupport': oldEmitter.needsArrayInitializerSupport});
/**
@@ -429,8 +433,10 @@ jsAst.Expression getReflectionDataParser(OldEmitter oldEmitter,
#processClassData;
}
#processStatics;
- #addStubs;
- #tearOffCode;
+ if (#needsArrayInitializerSupport) {
+ #addStubs;
+ #tearOffCode;
+ }
#incrementalSupport;
#init;
})''', {
@@ -444,7 +450,8 @@ jsAst.Expression getReflectionDataParser(OldEmitter oldEmitter,
'tearOffCode': tearOffCode,
'init': init,
'finishClasses': finishClasses,
- 'needsClassSupport': oldEmitter.needsClassSupport});
+ 'needsClassSupport': oldEmitter.needsClassSupport,
+ 'needsArrayInitializerSupport': oldEmitter.needsArrayInitializerSupport});
}

Powered by Google App Engine
This is Rietveld 408576698