Chromium Code Reviews| Index: lib/compiler/implementation/compiler.dart |
| diff --git a/lib/compiler/implementation/compiler.dart b/lib/compiler/implementation/compiler.dart |
| index 9853fa87d9eb8e195969797c190b654d2c844ff9..d013b4d1365be4fac5b9f8e9f330ac53ea63a3fd 100644 |
| --- a/lib/compiler/implementation/compiler.dart |
| +++ b/lib/compiler/implementation/compiler.dart |
| @@ -14,13 +14,21 @@ final bool REPORT_EXCESS_RESOLUTION = false; |
| */ |
| final bool REPORT_PASS2_OPTIMIZATIONS = false; |
| +/** |
| + * Contains backend-specific data that is used throughout the compilation of |
| + * one work item. |
| + */ |
| +class ItemCompilationContext { |
| +} |
| + |
| class WorkItem { |
| + final ItemCompilationContext compilationContext; |
| final Element element; |
| TreeElements resolutionTree; |
| bool allowSpeculativeOptimization = true; |
| List<HTypeGuard> guards = const <HTypeGuard>[]; |
| - WorkItem(this.element, this.resolutionTree); |
| + WorkItem(this.element, this.resolutionTree, this.compilationContext); |
| bool isAnalyzed() => resolutionTree !== null; |
| @@ -49,6 +57,17 @@ class Backend { |
| Collection<LibraryElement> libraries); |
| abstract void assembleProgram(); |
| abstract List<CompilerTask> get tasks(); |
| + |
| + ItemCompilationContext createItemCompilationContext() { |
| + return new ItemCompilationContext(); |
| + } |
| +} |
| + |
| +class JavaScriptItemCompilationContext extends ItemCompilationContext { |
| + final HTypeMap types; |
| + |
| + JavaScriptItemCompilationContext() |
| + : types = new HTypeMap(); |
|
ngeoffray
2012/08/16 13:07:00
fits in one line
floitsch
2012/08/16 14:10:04
Done.
|
| } |
| class JavaScriptBackend extends Backend { |
| @@ -204,6 +223,10 @@ class JavaScriptBackend extends Backend { |
| if (!fields.containsKey(field)) return HType.CONFLICTING; |
| return fields[field]; |
| } |
| + |
| + JavaScriptItemCompilationContext createItemCompilationContext() { |
| + return new JavaScriptItemCompilationContext(); |
| + } |
| } |
| class Compiler implements DiagnosticListener { |
| @@ -1078,7 +1101,7 @@ class Tracer { |
| const Tracer(); |
| - void traceCompilation(String methodName) { |
| + void traceCompilation(String methodName, ItemCompilationContext context) { |
| } |
| void traceGraph(String name, var graph) { |