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

Side by Side Diff: lib/compiler/implementation/compiler.dart

Issue 10579019: First shot at source maps generation in dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 5
6 /** 6 /**
7 * If true, print a warning for each method that was resolved, but not 7 * If true, print a warning for each method that was resolved, but not
8 * compiled. 8 * compiled.
9 */ 9 */
10 final bool REPORT_EXCESS_RESOLUTION = false; 10 final bool REPORT_EXCESS_RESOLUTION = false;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 class JavaScriptBackend extends Backend { 54 class JavaScriptBackend extends Backend {
55 SsaBuilderTask builder; 55 SsaBuilderTask builder;
56 SsaOptimizerTask optimizer; 56 SsaOptimizerTask optimizer;
57 SsaCodeGeneratorTask generator; 57 SsaCodeGeneratorTask generator;
58 CodeEmitterTask emitter; 58 CodeEmitterTask emitter;
59 59
60 List<CompilerTask> get tasks() { 60 List<CompilerTask> get tasks() {
61 return <CompilerTask>[builder, optimizer, generator, emitter]; 61 return <CompilerTask>[builder, optimizer, generator, emitter];
62 } 62 }
63 63
64 JavaScriptBackend(Compiler compiler) 64 JavaScriptBackend(Compiler compiler, bool generateSourceMap)
65 : emitter = new CodeEmitterTask(compiler), 65 : emitter = new CodeEmitterTask(compiler, generateSourceMap),
66 super(compiler) { 66 super(compiler) {
67 builder = new SsaBuilderTask(this); 67 builder = new SsaBuilderTask(this);
68 optimizer = new SsaOptimizerTask(this); 68 optimizer = new SsaOptimizerTask(this);
69 generator = new SsaCodeGeneratorTask(this); 69 generator = new SsaCodeGeneratorTask(this);
70 } 70 }
71 71
72 void enqueueHelpers(Enqueuer world) { 72 void enqueueHelpers(Enqueuer world) {
73 enqueueAllTopLevelFunctions(compiler.jsHelperLibrary, world); 73 enqueueAllTopLevelFunctions(compiler.jsHelperLibrary, world);
74 enqueueAllTopLevelFunctions(compiler.interceptorsLibrary, world); 74 enqueueAllTopLevelFunctions(compiler.interceptorsLibrary, world);
75 for (var helper in [const SourceString('Closure'), 75 for (var helper in [const SourceString('Closure'),
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 static final int PHASE_SCANNING = 0; 185 static final int PHASE_SCANNING = 0;
186 static final int PHASE_RESOLVING = 1; 186 static final int PHASE_RESOLVING = 1;
187 static final int PHASE_COMPILING = 2; 187 static final int PHASE_COMPILING = 2;
188 static final int PHASE_RECOMPILING = 3; 188 static final int PHASE_RECOMPILING = 3;
189 int phase; 189 int phase;
190 190
191 Compiler([this.tracer = const Tracer(), 191 Compiler([this.tracer = const Tracer(),
192 this.enableTypeAssertions = false, 192 this.enableTypeAssertions = false,
193 this.enableUserAssertions = false, 193 this.enableUserAssertions = false,
194 bool emitJavascript = true, 194 bool emitJavascript = true,
195 validateUnparse = false]) 195 validateUnparse = false,
196 generateSourceMap = true])
196 : libraries = new Map<String, LibraryElement>(), 197 : libraries = new Map<String, LibraryElement>(),
197 world = new World(), 198 world = new World(),
198 progress = new Stopwatch.start() { 199 progress = new Stopwatch.start() {
199 namer = new Namer(this); 200 namer = new Namer(this);
200 constantHandler = new ConstantHandler(this); 201 constantHandler = new ConstantHandler(this);
201 scanner = new ScannerTask(this); 202 scanner = new ScannerTask(this);
202 dietParser = new DietParserTask(this); 203 dietParser = new DietParserTask(this);
203 parser = new ParserTask(this); 204 parser = new ParserTask(this);
204 validator = new TreeValidatorTask(this); 205 validator = new TreeValidatorTask(this);
205 unparseValidator = new UnparseValidator(this, validateUnparse); 206 unparseValidator = new UnparseValidator(this, validateUnparse);
206 resolver = new ResolverTask(this); 207 resolver = new ResolverTask(this);
207 checker = new TypeCheckerTask(this); 208 checker = new TypeCheckerTask(this);
208 backend = emitJavascript ? 209 backend = emitJavascript ?
209 new JavaScriptBackend(this) : new dart_backend.DartBackend(this); 210 new JavaScriptBackend(this, generateSourceMap) :
211 new dart_backend.DartBackend(this);
210 enqueuer = new EnqueueTask(this); 212 enqueuer = new EnqueueTask(this);
211 tasks = [scanner, dietParser, parser, resolver, checker, 213 tasks = [scanner, dietParser, parser, resolver, checker,
212 unparseValidator, constantHandler, enqueuer]; 214 unparseValidator, constantHandler, enqueuer];
213 tasks.addAll(backend.tasks); 215 tasks.addAll(backend.tasks);
214 } 216 }
215 217
216 Universe get resolverWorld() => enqueuer.resolution.universe; 218 Universe get resolverWorld() => enqueuer.resolution.universe;
217 Universe get codegenWorld() => enqueuer.codegen.universe; 219 Universe get codegenWorld() => enqueuer.codegen.universe;
218 220
219 int getNextFreeClassId() => nextFreeClassId++; 221 int getNextFreeClassId() => nextFreeClassId++;
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 // invariant that endOffset > beginOffset, but for EOF the 766 // invariant that endOffset > beginOffset, but for EOF the
765 // charoffset of the next token may be [beginOffset]. This can 767 // charoffset of the next token may be [beginOffset]. This can
766 // also happen for synthetized tokens that are produced during 768 // also happen for synthetized tokens that are produced during
767 // error handling. 769 // error handling.
768 final endOffset = 770 final endOffset =
769 Math.max((end.next !== null) ? end.next.charOffset : 0, beginOffset + 1); 771 Math.max((end.next !== null) ? end.next.charOffset : 0, beginOffset + 1);
770 assert(endOffset > beginOffset); 772 assert(endOffset > beginOffset);
771 return f(beginOffset, endOffset); 773 return f(beginOffset, endOffset);
772 } 774 }
773 } 775 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/dart2js.dart » ('j') | lib/compiler/implementation/source_map_builder.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698