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

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

Issue 11590018: Avoid known native field names when minifying method names. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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/minify_namer.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/minify_namer.dart b/sdk/lib/_internal/compiler/implementation/js_backend/minify_namer.dart
index 5d176c1530b5a60ed06675f8fbcf9d57c45e400a..9a512d8adb7026f26cf1568dad12d547203d92ca 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/minify_namer.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/minify_namer.dart
@@ -8,7 +8,9 @@ part of js_backend;
* Assigns JavaScript identifiers to Dart variables, class-names and members.
*/
class MinifyNamer extends Namer {
- MinifyNamer(Compiler compiler) : super(compiler);
+ MinifyNamer(Compiler compiler) : super(compiler) {
+ reserveBackendNames();
+ }
String get isolateName => 'I';
String get isolatePropertiesName => 'p';
@@ -32,6 +34,15 @@ class MinifyNamer extends Namer {
return new SourceString("${getMappedInstanceName('closure')}_$id");
}
+ void reserveBackendNames() {
+ for (var name in JsNames.reservedNativeProperties) {
+ if (name.length < 3) {
ngeoffray 2012/12/18 12:34:03 What does this mean? Why 3?
+ instanceNameMap[name] = name;
+ }
+ usedInstanceNames.add(name);
+ }
+ }
+
// This gets a minified name based on a hash of the proposed name. This
// is slightly less efficient than just getting the next name in a series,
// but it means that small changes in the input program will give smallish

Powered by Google App Engine
This is Rietveld 408576698