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

Unified Diff: compiler/java/com/google/dart/compiler/backend/js/AbstractJsBackend.java

Issue 8659022: Puts JsScope on a diet (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Changed the strategy to only walk a specific class when TranslationContext is created Created 9 years, 1 month 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 | compiler/java/com/google/dart/compiler/backend/js/TranslationContext.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/java/com/google/dart/compiler/backend/js/AbstractJsBackend.java
diff --git a/compiler/java/com/google/dart/compiler/backend/js/AbstractJsBackend.java b/compiler/java/com/google/dart/compiler/backend/js/AbstractJsBackend.java
index f8a644fee913ed78adbbf3178126bcbbc3579b52..a65a72658b72854630c5f6fd632d70b2b01796ba 100644
--- a/compiler/java/com/google/dart/compiler/backend/js/AbstractJsBackend.java
+++ b/compiler/java/com/google/dart/compiler/backend/js/AbstractJsBackend.java
@@ -12,8 +12,8 @@ import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.Multimaps;
import com.google.common.collect.Multiset;
-import com.google.dart.compiler.CommandLineOptions.CompilerOptions;
import com.google.common.io.Closeables;
+import com.google.dart.compiler.CommandLineOptions.CompilerOptions;
import com.google.dart.compiler.DartCompilerContext;
import com.google.dart.compiler.DartSource;
import com.google.dart.compiler.ast.DartClass;
@@ -358,7 +358,6 @@ public abstract class AbstractJsBackend extends AbstractBackend {
GenerateJavascriptAST nonClassGenerator = null;
TranslationContext nonClassTranslationContext = null;
-
JsProgram staticInitStatements = new JsProgram(baseUnitId + partIndex++);
JsBlock staticInitBlock = staticInitStatements.getGlobalBlock();
@@ -372,8 +371,9 @@ public abstract class AbstractJsBackend extends AbstractBackend {
try {
// Translate the AST to JS.
JsProgram program = new JsProgram(baseUnitId + partIndex++);
+
TranslationContext translationContext = TranslationContext.createContext(unit, program,
- mangler);
+ mangler, node);
// Generate the Javascript AST.
GenerateJavascriptAST generator =
@@ -395,13 +395,16 @@ public abstract class AbstractJsBackend extends AbstractBackend {
Tracer.end(nodeEvent);
}
} else {
+
if (nonClassGenerator == null) {
+ // This block generates the AST used to generate for all non-class nodes at once
+ // and is saved for subsequent iterations.
TraceEvent genInitEvent =
Tracer.canTrace() ? Tracer.start(DartEventType.GEN_AST_INIT, "unit",
unit.getSourceName()) : null;
try {
nonClassTranslationContext = TranslationContext.createContext(unit,
- nonClassStatements, mangler);
+ nonClassStatements, mangler, null);
nonClassGenerator = new GenerateJavascriptAST(unit, typeProvider, context,
optimizationStrategy, generateClosureCompatibleCode());
} finally {
« no previous file with comments | « no previous file | compiler/java/com/google/dart/compiler/backend/js/TranslationContext.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698