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

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: Fix the tests. 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
« no previous file with comments | « no previous file | lib/compiler/implementation/dart2js.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 SsaOptimizerTask optimizer; 56 SsaOptimizerTask optimizer;
57 SsaCodeGeneratorTask generator; 57 SsaCodeGeneratorTask generator;
58 CodeEmitterTask emitter; 58 CodeEmitterTask emitter;
59 final Map<Element, Map<Element, HType>> fieldInitializers; 59 final Map<Element, Map<Element, HType>> fieldInitializers;
60 final Map<Element, Map<Element, bool>> fieldIntegerSetters; 60 final Map<Element, Map<Element, bool>> fieldIntegerSetters;
61 61
62 List<CompilerTask> get tasks() { 62 List<CompilerTask> get tasks() {
63 return <CompilerTask>[builder, optimizer, generator, emitter]; 63 return <CompilerTask>[builder, optimizer, generator, emitter];
64 } 64 }
65 65
66 JavaScriptBackend(Compiler compiler) 66 JavaScriptBackend(Compiler compiler, bool generateSourceMap)
67 : emitter = new CodeEmitterTask(compiler), 67 : emitter = new CodeEmitterTask(compiler, generateSourceMap),
68 fieldInitializers = new Map<Element, Map<Element, HType>>(), 68 fieldInitializers = new Map<Element, Map<Element, HType>>(),
69 fieldIntegerSetters = new Map<Element, Map<Element, bool>>(), 69 fieldIntegerSetters = new Map<Element, Map<Element, bool>>(),
70 super(compiler) { 70 super(compiler) {
71 builder = new SsaBuilderTask(this); 71 builder = new SsaBuilderTask(this);
72 optimizer = new SsaOptimizerTask(this); 72 optimizer = new SsaOptimizerTask(this);
73 generator = new SsaCodeGeneratorTask(this); 73 generator = new SsaCodeGeneratorTask(this);
74 } 74 }
75 75
76 void enqueueHelpers(Enqueuer world) { 76 void enqueueHelpers(Enqueuer world) {
77 enqueueAllTopLevelFunctions(compiler.jsHelperLibrary, world); 77 enqueueAllTopLevelFunctions(compiler.jsHelperLibrary, world);
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 static final int PHASE_SCANNING = 0; 253 static final int PHASE_SCANNING = 0;
254 static final int PHASE_RESOLVING = 1; 254 static final int PHASE_RESOLVING = 1;
255 static final int PHASE_COMPILING = 2; 255 static final int PHASE_COMPILING = 2;
256 static final int PHASE_RECOMPILING = 3; 256 static final int PHASE_RECOMPILING = 3;
257 int phase; 257 int phase;
258 258
259 Compiler([this.tracer = const Tracer(), 259 Compiler([this.tracer = const Tracer(),
260 this.enableTypeAssertions = false, 260 this.enableTypeAssertions = false,
261 this.enableUserAssertions = false, 261 this.enableUserAssertions = false,
262 bool emitJavascript = true, 262 bool emitJavascript = true,
263 validateUnparse = false]) 263 validateUnparse = false,
264 generateSourceMap = true])
264 : libraries = new Map<String, LibraryElement>(), 265 : libraries = new Map<String, LibraryElement>(),
265 world = new World(), 266 world = new World(),
266 progress = new Stopwatch.start() { 267 progress = new Stopwatch.start() {
267 namer = new Namer(this); 268 namer = new Namer(this);
268 constantHandler = new ConstantHandler(this); 269 constantHandler = new ConstantHandler(this);
269 scanner = new ScannerTask(this); 270 scanner = new ScannerTask(this);
270 dietParser = new DietParserTask(this); 271 dietParser = new DietParserTask(this);
271 parser = new ParserTask(this); 272 parser = new ParserTask(this);
272 validator = new TreeValidatorTask(this); 273 validator = new TreeValidatorTask(this);
273 unparseValidator = new UnparseValidator(this, validateUnparse); 274 unparseValidator = new UnparseValidator(this, validateUnparse);
274 resolver = new ResolverTask(this); 275 resolver = new ResolverTask(this);
275 checker = new TypeCheckerTask(this); 276 checker = new TypeCheckerTask(this);
276 backend = emitJavascript ? 277 backend = emitJavascript ?
277 new JavaScriptBackend(this) : new dart_backend.DartBackend(this); 278 new JavaScriptBackend(this, generateSourceMap) :
279 new dart_backend.DartBackend(this);
278 enqueuer = new EnqueueTask(this); 280 enqueuer = new EnqueueTask(this);
279 tasks = [scanner, dietParser, parser, resolver, checker, 281 tasks = [scanner, dietParser, parser, resolver, checker,
280 unparseValidator, constantHandler, enqueuer]; 282 unparseValidator, constantHandler, enqueuer];
281 tasks.addAll(backend.tasks); 283 tasks.addAll(backend.tasks);
282 } 284 }
283 285
284 Universe get resolverWorld() => enqueuer.resolution.universe; 286 Universe get resolverWorld() => enqueuer.resolution.universe;
285 Universe get codegenWorld() => enqueuer.codegen.universe; 287 Universe get codegenWorld() => enqueuer.codegen.universe;
286 288
287 int getNextFreeClassId() => nextFreeClassId++; 289 int getNextFreeClassId() => nextFreeClassId++;
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 // invariant that endOffset > beginOffset, but for EOF the 834 // invariant that endOffset > beginOffset, but for EOF the
833 // charoffset of the next token may be [beginOffset]. This can 835 // charoffset of the next token may be [beginOffset]. This can
834 // also happen for synthetized tokens that are produced during 836 // also happen for synthetized tokens that are produced during
835 // error handling. 837 // error handling.
836 final endOffset = 838 final endOffset =
837 Math.max((end.next !== null) ? end.next.charOffset : 0, beginOffset + 1); 839 Math.max((end.next !== null) ? end.next.charOffset : 0, beginOffset + 1);
838 assert(endOffset > beginOffset); 840 assert(endOffset > beginOffset);
839 return f(beginOffset, endOffset); 841 return f(beginOffset, endOffset);
840 } 842 }
841 } 843 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698