Index: sdk/lib/_internal/compiler/implementation/compiler.dart |
diff --git a/sdk/lib/_internal/compiler/implementation/compiler.dart b/sdk/lib/_internal/compiler/implementation/compiler.dart |
index f97d3d9c8729085597dead1feeeafbfc71254cb1..e97097c7f6a316ee9ed8da137b37eac2fc5a574c 100644 |
--- a/sdk/lib/_internal/compiler/implementation/compiler.dart |
+++ b/sdk/lib/_internal/compiler/implementation/compiler.dart |
@@ -74,8 +74,14 @@ abstract class Backend { |
void enqueueHelpers(Enqueuer world); |
void codegen(WorkItem work); |
- void processNativeClasses(Enqueuer world, |
- Collection<LibraryElement> libraries); |
+ |
+ // The backend determines the native resolution enqueuer so tools like |
+ // dart2dart can ignore the native classes. |
+ native.NativeEnqueuer nativeResolutionEnqueuer(world, bool liveTypeAnalysis) => |
ahe
2012/11/14 13:51:30
Long line. As a matter of style, I prefer to avoi
ahe
2012/11/14 13:51:30
I don't think the option liveTypeAnalysis is neces
ahe
2012/11/14 13:51:30
An undocumented property of the library native_han
ngeoffray
2012/11/14 21:17:39
Line too long, and the style we used is not to use
sra1
2012/11/15 00:09:10
Almost all the functionality in here will be neede
sra1
2012/11/15 00:09:10
Done.
sra1
2012/11/15 00:09:10
Done.
sra1
2012/11/15 00:09:10
I see plenty of examples.
|
+ new native.NativeEnqueuer(); |
+ native.NativeEnqueuer nativeCodegenEnqueuer(world, bool liveTypeAnalysis) => |
+ new native.NativeEnqueuer(); |
+ |
void assembleProgram(); |
List<CompilerTask> get tasks; |
@@ -103,6 +109,7 @@ abstract class Compiler implements DiagnosticListener { |
final bool enableTypeAssertions; |
final bool enableUserAssertions; |
final bool enableConcreteTypeInference; |
+ final bool enableNativeLiveTypeAnalysis; |
bool disableInlining = false; |
@@ -210,6 +217,7 @@ abstract class Compiler implements DiagnosticListener { |
this.enableUserAssertions: false, |
this.enableConcreteTypeInference: false, |
this.enableMinification: false, |
+ this.enableNativeLiveTypeAnalysis: false, |
bool emitJavaScript: true, |
bool generateSourceMap: true, |
bool disallowUnsafeEval: false, |
@@ -515,11 +523,19 @@ abstract class Compiler implements DiagnosticListener { |
}); |
} |
+ enqueuer.resolution.nativeEnqueuer = |
+ backend.nativeResolutionEnqueuer(enqueuer.resolution, |
+ enableNativeLiveTypeAnalysis); |
+ enqueuer.codegen.nativeEnqueuer = |
+ backend.nativeCodegenEnqueuer(enqueuer.codegen, |
+ enableNativeLiveTypeAnalysis); |
+ |
log('Resolving...'); |
phase = PHASE_RESOLVING; |
backend.enqueueHelpers(enqueuer.resolution); |
processQueue(enqueuer.resolution, main); |
log('Resolved ${enqueuer.resolution.resolvedElements.length} elements.'); |
+ enqueuer.resolution.nativeEnqueuer.logSummary(log); |
ahe
2012/11/14 13:51:30
I like this approach. How about merging these two
sra1
2012/11/15 00:09:10
Done.
|
if (compilationFailed) return; |
@@ -534,6 +550,7 @@ abstract class Compiler implements DiagnosticListener { |
phase = PHASE_COMPILING; |
processQueue(enqueuer.codegen, main); |
log('Compiled ${codegenWorld.generatedCode.length} methods.'); |
+ enqueuer.codegen.nativeEnqueuer.logSummary(log); |
ahe
2012/11/14 13:51:30
Ditto.
sra1
2012/11/15 00:09:10
Done.
|
if (compilationFailed) return; |
@@ -543,7 +560,7 @@ abstract class Compiler implements DiagnosticListener { |
} |
void processQueue(Enqueuer world, Element main) { |
- backend.processNativeClasses(world, libraries.values); |
+ world.nativeEnqueuer.processNativeClasses(libraries.values); |
world.addToWorkList(main); |
progress.reset(); |
world.forEach((WorkItem work) { |
@@ -646,6 +663,7 @@ abstract class Compiler implements DiagnosticListener { |
TreeElements result = world.getCachedElements(element); |
if (result != null) return result; |
if (!identical(world, enqueuer.resolution)) { |
+ throw 'Internal error: unresolved element: $element.'; |
ahe
2012/11/14 13:51:30
Remove this. FYI: you can often use --throw-on-er
ngeoffray
2012/11/14 21:17:39
Remove debugging code.
sra1
2012/11/15 00:09:10
Done.
|
internalErrorOnElement(element, |
'Internal error: unresolved element: $element.'); |
} |