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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/codegen.dart

Issue 11467007: Allow variable minification in generative constructors. (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
index 8b6b0dcd553b71fbbb9af25752ded0bc7633d4d9..de3fd4a9eea5e47c7afcaf825eeb6c007bc93504 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
@@ -73,7 +73,7 @@ class SsaCodeGeneratorTask extends CompilerTask {
FunctionElement element = work.element;
js.Block body;
ClassElement enclosingClass = element.getEnclosingClass();
- bool allowVariableMinification = !codegen.visitedForeignCode;
+ bool allowVariableMinification = !codegen.inhibitVariableMinification;
if (element.isInstanceMember()
&& enclosingClass.isNative()
@@ -163,7 +163,7 @@ abstract class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
*/
bool isGeneratingExpression = false;
- bool visitedForeignCode = false;
+ bool inhibitVariableMinification = false;
final JavaScriptBackend backend;
final WorkItem work;
@@ -1778,7 +1778,11 @@ abstract class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
}
visitForeign(HForeign node) {
- visitedForeignCode = true;
+ // TODO(sra): We could be a lot more picky about when to inhibit renaming of
+ // locals - most JS strings don't contain free variables, or contain safe
+ // ones like 'Object'. JS strings like "#.length" and "#[#]" are perfectly
+ // safe for variable renaming.
+ inhibitVariableMinification = true;
String code = node.code.slowToString();
List<HInstruction> inputs = node.inputs;
if (node.isJsStatement(types)) {
@@ -1803,7 +1807,6 @@ abstract class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
}
visitForeignNew(HForeignNew node) {
- visitedForeignCode = true;
String jsClassReference = backend.namer.isolateAccess(node.element);
List<HInstruction> inputs = node.inputs;
// We can't use 'visitArguments', since our arguments start at input[0].
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698