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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_backend/namer.dart

Issue 208043003: Rename [call$...] properties to [$...] in compiled code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: found another use of call Created 6 years, 9 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: sdk/lib/_internal/compiler/implementation/js_backend/namer.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart b/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart
index 00a0bdbb873479e6391b62daec13aea5269f3435..7a33d97692815cf9fa685560c7dac7eac3a63bf4 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart
@@ -221,6 +221,7 @@ class Namer implements ClosureNamer {
final String getterPrefix = r'get$';
final String setterPrefix = r'set$';
final String metadataField = '@';
+ final String callPrefix = 'call';
final String callCatchAllName = r'call$catchAll';
final String reflectableField = r'$reflectable';
final String defaultValuesField = r'$defaultValues';
@@ -290,6 +291,7 @@ class Namer implements ClosureNamer {
switch (name) {
case 'GETTER_PREFIX': return getterPrefix;
case 'SETTER_PREFIX': return setterPrefix;
+ case 'CALL_PREFIX': return callPrefix;
case 'CALL_CATCH_ALL': return callCatchAllName;
case 'REFLECTABLE': return reflectableField;
case 'CLASS_DESCRIPTOR_PROPERTY': return classDescriptorProperty;
@@ -383,8 +385,16 @@ class Namer implements ClosureNamer {
name = Elements.reconstructConstructorNameSourceString(element);
}
FunctionSignature signature = element.functionSignature;
- String methodName =
- '${privateName(library, name)}\$${signature.parameterCount}';
+ // We don't mangle the closure invoking function name because it
+ // is generated by string concatenation in applyFunction from
+ // js_helper.dart. To keep code size down, we potentially shorten
+ // the prefix though.
+ String methodName;
+ if (name == closureInvocationSelectorName) {
+ methodName = '$callPrefix\$${signature.parameterCount}';
+ } else {
+ methodName = '${privateName(library, name)}\$${signature.parameterCount}';
+ }
if (signature.optionalParametersAreNamed &&
!signature.optionalParameters.isEmpty) {
StringBuffer buffer = new StringBuffer();
@@ -403,10 +413,11 @@ class Namer implements ClosureNamer {
assert(!isPrivateName(name));
// We don't mangle the closure invoking function name because it
// is generated by string concatenation in applyFunction from
- // js_helper.dart.
- String proposedName = '$name\$$arity';
- if (name == closureInvocationSelectorName) return proposedName;
- return getMappedInstanceName(proposedName);
+ // js_helper.dart. To keep code size down, we potentially shorten
+ // the prefix though.
+ if (name == closureInvocationSelectorName) return '$callPrefix\$$arity';
+
+ return getMappedInstanceName('$name\$$arity');
}
String invocationName(Selector selector) {
@@ -432,9 +443,9 @@ class Namer implements ClosureNamer {
String suffix = '\$${selector.argumentCount}$buffer';
// We don't mangle the closure invoking function name because it
// is generated by string concatenation in applyFunction from
- // js_helper.dart.
+ // js_helper.dart. We potentially shorten the prefix though.
if (selector.isClosureCall()) {
- return "$name$suffix";
+ return "$callPrefix$suffix";
} else {
String proposedName = privateName(selector.library, name);
return getMappedInstanceName('$proposedName$suffix');
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/js_backend/minify_namer.dart ('k') | sdk/lib/_internal/lib/js_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698