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

Unified Diff: lib/compiler/implementation/compiler.dart

Issue 10825386: Use JavaScript runtime semantics when constant folding. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 3 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: lib/compiler/implementation/compiler.dart
diff --git a/lib/compiler/implementation/compiler.dart b/lib/compiler/implementation/compiler.dart
index af7c95d9a22ff6ddaac7734c6014c5778adc077d..dcdd273d0532a0265e9b9cde9a284d2779798a00 100644
--- a/lib/compiler/implementation/compiler.dart
+++ b/lib/compiler/implementation/compiler.dart
@@ -53,8 +53,11 @@ class WorkItem {
class Backend {
final Compiler compiler;
+ final ConstantSystem constantSystem;
- Backend(this.compiler);
+ Backend(this.compiler,
+ [ConstantSystem constantSystem = DART_CONSTANT_SYSTEM])
+ : this.constantSystem = constantSystem;
void enqueueAllTopLevelFunctions(LibraryElement lib, Enqueuer world) {
lib.forEachExport((Element e) {
@@ -182,7 +185,7 @@ class Compiler implements DiagnosticListener {
this.enableTypeAssertions = false,
this.enableUserAssertions = false,
this.enableMinification = false,
- bool emitJavascript = true,
+ bool emitJavaScript = true,
bool generateSourceMap = true,
bool cutDeclarationTypes = false])
: libraries = new Map<String, LibraryElement>(),
@@ -190,7 +193,6 @@ class Compiler implements DiagnosticListener {
progress = new Stopwatch() {
progress.start();
namer = new Namer(this);
- constantHandler = new ConstantHandler(this);
scanner = new ScannerTask(this);
dietParser = new DietParserTask(this);
parser = new ParserTask(this);
@@ -200,9 +202,10 @@ class Compiler implements DiagnosticListener {
closureToClassMapper = new closureMapping.ClosureTask(this);
checker = new TypeCheckerTask(this);
typesTask = new ti.TypesTask(this);
- backend = emitJavascript ?
+ backend = emitJavaScript ?
new js_backend.JavaScriptBackend(this, generateSourceMap) :
new dart_backend.DartBackend(this, cutDeclarationTypes);
+ constantHandler = new ConstantHandler(this, backend.constantSystem);
enqueuer = new EnqueueTask(this);
tasks = [scanner, dietParser, parser, resolver, closureToClassMapper,
checker, typesTask, constantHandler, enqueuer];
« no previous file with comments | « lib/compiler/implementation/compile_time_constants.dart ('k') | lib/compiler/implementation/constant_system.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698