| 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 class WorkItem { | 5 class WorkItem { |
| 6 final Element element; | 6 final Element element; |
| 7 TreeElements resolutionTree; | 7 TreeElements resolutionTree; |
| 8 bool allowSpeculativeOptimization = true; | 8 bool allowSpeculativeOptimization = true; |
| 9 List<HTypeGuard> guards = const <HTypeGuard>[]; | 9 List<HTypeGuard> guards = const <HTypeGuard>[]; |
| 10 | 10 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 return generator.generateMethod(work, graph); | 66 return generator.generateMethod(work, graph); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void processNativeClasses(libraries) { | 69 void processNativeClasses(libraries) { |
| 70 native.processNativeClasses(emitter, libraries); | 70 native.processNativeClasses(emitter, libraries); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void assembleProgram() => emitter.assembleProgram(); | 73 void assembleProgram() => emitter.assembleProgram(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 class DartBackend extends Backend { |
| 77 DartBackend(Compiler compiler) : super(compiler); |
| 78 } |
| 79 |
| 76 class Compiler implements DiagnosticListener { | 80 class Compiler implements DiagnosticListener { |
| 77 final Map<String, LibraryElement> libraries; | 81 final Map<String, LibraryElement> libraries; |
| 78 int nextFreeClassId = 0; | 82 int nextFreeClassId = 0; |
| 79 World world; | 83 World world; |
| 80 String assembledCode; | 84 String assembledCode; |
| 81 Namer namer; | 85 Namer namer; |
| 82 Types types; | 86 Types types; |
| 83 bool enableTypeAssertions = false; | 87 final bool enableTypeAssertions; |
| 84 | 88 |
| 85 final Tracer tracer; | 89 final Tracer tracer; |
| 86 | 90 |
| 87 CompilerTask measuredTask; | 91 CompilerTask measuredTask; |
| 88 Element _currentElement; | 92 Element _currentElement; |
| 89 LibraryElement coreLibrary; | 93 LibraryElement coreLibrary; |
| 90 LibraryElement coreImplLibrary; | 94 LibraryElement coreImplLibrary; |
| 91 LibraryElement isolateLibrary; | 95 LibraryElement isolateLibrary; |
| 92 LibraryElement jsHelperLibrary; | 96 LibraryElement jsHelperLibrary; |
| 93 LibraryElement interceptorsLibrary; | 97 LibraryElement interceptorsLibrary; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 static final SourceString MAIN = const SourceString('main'); | 134 static final SourceString MAIN = const SourceString('main'); |
| 131 static final SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod'); | 135 static final SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod'); |
| 132 static final SourceString NO_SUCH_METHOD_EXCEPTION = | 136 static final SourceString NO_SUCH_METHOD_EXCEPTION = |
| 133 const SourceString('NoSuchMethodException'); | 137 const SourceString('NoSuchMethodException'); |
| 134 static final SourceString START_ROOT_ISOLATE = | 138 static final SourceString START_ROOT_ISOLATE = |
| 135 const SourceString('startRootIsolate'); | 139 const SourceString('startRootIsolate'); |
| 136 bool enabledNoSuchMethod = false; | 140 bool enabledNoSuchMethod = false; |
| 137 | 141 |
| 138 Stopwatch codegenProgress; | 142 Stopwatch codegenProgress; |
| 139 | 143 |
| 140 Compiler([this.tracer = const Tracer()]) | 144 Compiler([this.tracer = const Tracer(), |
| 145 this.enableTypeAssertions = false, |
| 146 bool emitJavascript = true]) |
| 141 : libraries = new Map<String, LibraryElement>(), | 147 : libraries = new Map<String, LibraryElement>(), |
| 142 world = new World(), | 148 world = new World(), |
| 143 codegenProgress = new Stopwatch.start() { | 149 codegenProgress = new Stopwatch.start() { |
| 144 namer = new Namer(this); | 150 namer = new Namer(this); |
| 145 constantHandler = new ConstantHandler(this); | 151 constantHandler = new ConstantHandler(this); |
| 146 scanner = new ScannerTask(this); | 152 scanner = new ScannerTask(this); |
| 147 dietParser = new DietParserTask(this); | 153 dietParser = new DietParserTask(this); |
| 148 parser = new ParserTask(this); | 154 parser = new ParserTask(this); |
| 149 validator = new TreeValidatorTask(this); | 155 validator = new TreeValidatorTask(this); |
| 150 resolver = new ResolverTask(this); | 156 resolver = new ResolverTask(this); |
| 151 checker = new TypeCheckerTask(this); | 157 checker = new TypeCheckerTask(this); |
| 152 backend = new JavaScriptBackend(this); | 158 backend = emitJavascript ? |
| 159 new JavaScriptBackend(this) : new DartBackend(this); |
| 153 enqueuer = new EnqueueTask(this); | 160 enqueuer = new EnqueueTask(this); |
| 154 tasks = [scanner, dietParser, parser, resolver, checker, | 161 tasks = [scanner, dietParser, parser, resolver, checker, |
| 155 constantHandler, enqueuer]; | 162 constantHandler, enqueuer]; |
| 156 } | 163 } |
| 157 | 164 |
| 158 Universe get codegenWorld() => enqueuer.codegen.universe; | 165 Universe get codegenWorld() => enqueuer.codegen.universe; |
| 159 | 166 |
| 160 int getNextFreeClassId() => nextFreeClassId++; | 167 int getNextFreeClassId() => nextFreeClassId++; |
| 161 | 168 |
| 162 void ensure(bool condition) { | 169 void ensure(bool condition) { |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 When compiling the above method, the compiler crashed. It is not | 599 When compiling the above method, the compiler crashed. It is not |
| 593 possible to tell if this is caused by a problem in your program or | 600 possible to tell if this is caused by a problem in your program or |
| 594 not. Regardless, the compiler should not crash. | 601 not. Regardless, the compiler should not crash. |
| 595 | 602 |
| 596 The Dart team would greatly appreciate if you would take a moment to | 603 The Dart team would greatly appreciate if you would take a moment to |
| 597 report this problem at http://dartbug.com/new. | 604 report this problem at http://dartbug.com/new. |
| 598 | 605 |
| 599 Please copy and paste the error and stack trace that you see here into | 606 Please copy and paste the error and stack trace that you see here into |
| 600 the bug report, include your OS and the Dart SDK build number. | 607 the bug report, include your OS and the Dart SDK build number. |
| 601 '''; | 608 '''; |
| OLD | NEW |