OLD | NEW |
---|---|
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 part of dart2js.js_emitter; | 5 part of dart2js.js_emitter; |
6 | 6 |
7 const USE_NEW_EMITTER = const bool.fromEnvironment("dart2js.use.new.emitter"); | 7 const USE_NEW_EMITTER = const bool.fromEnvironment("dart2js.use.new.emitter"); |
8 | 8 |
9 /** | 9 /** |
10 * Generates the code for all used classes in the program. Static fields (even | 10 * Generates the code for all used classes in the program. Static fields (even |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
340 void computeNeededLibraries() { | 340 void computeNeededLibraries() { |
341 void addSurroundingLibraryToSet(Element element) { | 341 void addSurroundingLibraryToSet(Element element) { |
342 OutputUnit unit = compiler.deferredLoadTask.outputUnitForElement(element); | 342 OutputUnit unit = compiler.deferredLoadTask.outputUnitForElement(element); |
343 LibraryElement library = element.library; | 343 LibraryElement library = element.library; |
344 outputLibraryLists.putIfAbsent(unit, () => new Set<LibraryElement>()) | 344 outputLibraryLists.putIfAbsent(unit, () => new Set<LibraryElement>()) |
345 .add(library); | 345 .add(library); |
346 } | 346 } |
347 | 347 |
348 backend.generatedCode.keys.forEach(addSurroundingLibraryToSet); | 348 backend.generatedCode.keys.forEach(addSurroundingLibraryToSet); |
349 neededClasses.forEach(addSurroundingLibraryToSet); | 349 neededClasses.forEach(addSurroundingLibraryToSet); |
350 } | 350 } |
351 | |
352 void computeAllNeededEntities() { | |
353 // Compute the required type checks to know which classes need a | |
354 // 'is$' method. | |
355 typeTestRegistry.computeRequiredTypeChecks(); | |
ahe
2014/12/11 09:40:15
Conflict resolution: typeTestRegistry was renamed.
| |
356 | |
357 computeNeededDeclarations(); | |
358 computeNeededConstants(); | |
359 computeNeededStatics(); | |
360 computeNeededLibraries(); | |
361 } | |
351 | 362 |
352 void assembleProgram() { | 363 void assembleProgram() { |
353 measure(() { | 364 measure(() { |
354 emitter.invalidateCaches(); | 365 emitter.invalidateCaches(); |
355 | 366 |
356 // Compute the required type checks to know which classes need a | 367 computeAllNeededEntities(); |
357 // 'is$' method. | |
358 typeTestRegistry.computeRequiredTypeChecks(); | |
359 | |
360 computeNeededDeclarations(); | |
361 computeNeededConstants(); | |
362 computeNeededStatics(); | |
363 computeNeededLibraries(); | |
364 | |
365 | 368 |
366 Program program; | 369 Program program; |
367 if (USE_NEW_EMITTER) { | 370 if (USE_NEW_EMITTER) { |
368 program = new ProgramBuilder(compiler, namer, this).buildProgram(); | 371 program = new ProgramBuilder(compiler, namer, this).buildProgram(); |
369 } | 372 } |
370 emitter.emitProgram(program); | 373 emitter.emitProgram(program); |
371 }); | 374 }); |
372 } | 375 } |
373 } | 376 } |
374 | 377 |
(...skipping 12 matching lines...) Expand all Loading... | |
387 jsAst.PropertyAccess classAccess(Element element); | 390 jsAst.PropertyAccess classAccess(Element element); |
388 jsAst.PropertyAccess typedefAccess(Element element); | 391 jsAst.PropertyAccess typedefAccess(Element element); |
389 jsAst.PropertyAccess staticFieldAccess(Element element); | 392 jsAst.PropertyAccess staticFieldAccess(Element element); |
390 | 393 |
391 | 394 |
392 int compareConstants(ConstantValue a, ConstantValue b); | 395 int compareConstants(ConstantValue a, ConstantValue b); |
393 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant); | 396 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant); |
394 | 397 |
395 void invalidateCaches(); | 398 void invalidateCaches(); |
396 } | 399 } |
OLD | NEW |