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

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

Issue 221873002: Compute frontend/backend specific constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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/backend.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
index 64d62e5ddb59080d42670c5b33adced238e82dfa..c3c23c34dc39bf1dfe084067759226429a1cb3d9 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
@@ -288,19 +288,28 @@ class JavaScriptBackend extends Backend {
/// constructors for custom elements.
CustomElementsAnalysis customElementsAnalysis;
+ JavaScriptConstantHandler constantCompiler;
+
JavaScriptBackend(Compiler compiler, bool generateSourceMap)
: namer = determineNamer(compiler),
oneShotInterceptors = new Map<String, Selector>(),
interceptedElements = new Map<String, Set<Element>>(),
rti = new RuntimeTypes(compiler),
specializedGetInterceptors = new Map<String, Set<ClassElement>>(),
- super(compiler, JAVA_SCRIPT_CONSTANT_SYSTEM) {
+ super(compiler) {
emitter = new CodeEmitterTask(compiler, namer, generateSourceMap);
builder = new SsaBuilderTask(this);
optimizer = new SsaOptimizerTask(this);
generator = new SsaCodeGeneratorTask(this);
typeVariableHandler = new TypeVariableHandler(this);
customElementsAnalysis = new CustomElementsAnalysis(this);
+ constantCompiler = new JavaScriptConstantHandler(compiler);
+ }
+
+ ConstantSystem get constantSystem => constantHandler.constantSystem;
+
+ JavaScriptBackendConstantHandler get constantHandler {
+ return constantCompiler.jsConstantCompiler;
}
static Namer determineNamer(Compiler compiler) {
@@ -1142,11 +1151,12 @@ class JavaScriptBackend extends Backend {
return;
}
if (kind.category == ElementCategory.VARIABLE) {
+ JavaScriptBackend backend = compiler.backend;
karlklose 2014/04/02 13:04:44 Isn't this the JavaScriptBackend?
Johnni Winther 2014/04/07 11:42:27 Yes! Removed.
Constant initialValue =
- compiler.constantHandler.getConstantForVariable(element);
+ backend.constantHandler.getConstantForVariable(element);
if (initialValue != null) {
registerCompileTimeConstant(initialValue, work.resolutionTree);
- compiler.constantHandler.addCompileTimeConstantForEmission(
+ backend.constantHandler.addCompileTimeConstantForEmission(
initialValue);
// We don't need to generate code for static or top-level
// variables. For instance variables, we may need to generate
@@ -1607,8 +1617,8 @@ class JavaScriptBackend extends Backend {
if (mustRetainMetadata && isNeededForReflection(element)) {
for (MetadataAnnotation metadata in element.metadata) {
metadata.ensureResolved(compiler);
- compiler.constantHandler.addCompileTimeConstantForEmission(
- metadata.value);
+ Constant constant = constantHandler.getConstantForMetadata(metadata);
+ constantHandler.addCompileTimeConstantForEmission(constant);
}
return true;
}
@@ -1886,4 +1896,3 @@ class Dependency {
const Dependency(this.constant, this.user);
}
-

Powered by Google App Engine
This is Rietveld 408576698