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

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: Always emit the functions in incremental compilations. 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 a681f7685c27c208b708866c4b1a6153cba43c81..d27b4e28434cd1575e7bd2daf719199faa956381 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
@@ -143,6 +143,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) {
@@ -173,8 +174,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) {
@@ -186,7 +189,8 @@ jsAst.Expression getReflectionDataParser(OldEmitter oldEmitter,
}
''', {'typeInformation': typeInformationAccess,
'globalFunctions': globalFunctionsAccess,
- 'hasClasses': oldEmitter.needsClassSupport});
+ 'hasClasses': oldEmitter.needsClassSupport,
+ 'needsArrayInitializerSupport': oldEmitter.needsArrayInitializerSupport});
/**
@@ -432,8 +436,10 @@ function $parseReflectionDataName(reflectionData) {
#processClassData;
}
#processStatics;
- #addStubs;
- #tearOffCode;
+ if (#needsArrayInitializerSupport) {
+ #addStubs;
+ #tearOffCode;
+ }
#incrementalSupport;
#init;
}''', {
@@ -447,7 +453,8 @@ function $parseReflectionDataName(reflectionData) {
'tearOffCode': tearOffCode,
'init': init,
'finishClasses': finishClasses,
- 'needsClassSupport': oldEmitter.needsClassSupport});
+ 'needsClassSupport': oldEmitter.needsClassSupport,
+ 'needsArrayInitializerSupport': oldEmitter.needsArrayInitializerSupport});
}

Powered by Google App Engine
This is Rietveld 408576698