| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 } finally { | 118 } finally { |
| 119 _currentElement = old; | 119 _currentElement = old; |
| 120 } | 120 } |
| 121 } | 121 } |
| 122 | 122 |
| 123 List<CompilerTask> tasks; | 123 List<CompilerTask> tasks; |
| 124 ScannerTask scanner; | 124 ScannerTask scanner; |
| 125 DietParserTask dietParser; | 125 DietParserTask dietParser; |
| 126 ParserTask parser; | 126 ParserTask parser; |
| 127 TreeValidatorTask validator; | 127 TreeValidatorTask validator; |
| 128 UnparseValidator unparseValidator; |
| 128 ResolverTask resolver; | 129 ResolverTask resolver; |
| 129 TypeCheckerTask checker; | 130 TypeCheckerTask checker; |
| 130 Backend backend; | 131 Backend backend; |
| 131 ConstantHandler constantHandler; | 132 ConstantHandler constantHandler; |
| 132 EnqueueTask enqueuer; | 133 EnqueueTask enqueuer; |
| 133 | 134 |
| 134 static final SourceString MAIN = const SourceString('main'); | 135 static final SourceString MAIN = const SourceString('main'); |
| 135 static final SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod'); | 136 static final SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod'); |
| 136 static final SourceString NO_SUCH_METHOD_EXCEPTION = | 137 static final SourceString NO_SUCH_METHOD_EXCEPTION = |
| 137 const SourceString('NoSuchMethodException'); | 138 const SourceString('NoSuchMethodException'); |
| 138 static final SourceString START_ROOT_ISOLATE = | 139 static final SourceString START_ROOT_ISOLATE = |
| 139 const SourceString('startRootIsolate'); | 140 const SourceString('startRootIsolate'); |
| 140 bool enabledNoSuchMethod = false; | 141 bool enabledNoSuchMethod = false; |
| 141 | 142 |
| 142 Stopwatch codegenProgress; | 143 Stopwatch codegenProgress; |
| 143 | 144 |
| 144 Compiler([this.tracer = const Tracer(), | 145 Compiler([this.tracer = const Tracer(), |
| 145 this.enableTypeAssertions = false, | 146 this.enableTypeAssertions = false, |
| 146 bool emitJavascript = true]) | 147 bool emitJavascript = true, |
| 148 validateUnparse = false]) |
| 147 : libraries = new Map<String, LibraryElement>(), | 149 : libraries = new Map<String, LibraryElement>(), |
| 148 world = new World(), | 150 world = new World(), |
| 149 codegenProgress = new Stopwatch.start() { | 151 codegenProgress = new Stopwatch.start() { |
| 150 namer = new Namer(this); | 152 namer = new Namer(this); |
| 151 constantHandler = new ConstantHandler(this); | 153 constantHandler = new ConstantHandler(this); |
| 152 scanner = new ScannerTask(this); | 154 scanner = new ScannerTask(this); |
| 153 dietParser = new DietParserTask(this); | 155 dietParser = new DietParserTask(this); |
| 154 parser = new ParserTask(this); | 156 parser = new ParserTask(this); |
| 155 validator = new TreeValidatorTask(this); | 157 validator = new TreeValidatorTask(this); |
| 158 unparseValidator = new UnparseValidator(this, validateUnparse); |
| 156 resolver = new ResolverTask(this); | 159 resolver = new ResolverTask(this); |
| 157 checker = new TypeCheckerTask(this); | 160 checker = new TypeCheckerTask(this); |
| 158 backend = emitJavascript ? | 161 backend = emitJavascript ? |
| 159 new JavaScriptBackend(this) : new DartBackend(this); | 162 new JavaScriptBackend(this) : new DartBackend(this); |
| 160 enqueuer = new EnqueueTask(this); | 163 enqueuer = new EnqueueTask(this); |
| 161 tasks = [scanner, dietParser, parser, resolver, checker, | 164 tasks = [scanner, dietParser, parser, resolver, checker, |
| 162 constantHandler, enqueuer]; | 165 unparseValidator, constantHandler, enqueuer]; |
| 163 } | 166 } |
| 164 | 167 |
| 165 Universe get codegenWorld() => enqueuer.codegen.universe; | 168 Universe get codegenWorld() => enqueuer.codegen.universe; |
| 166 | 169 |
| 167 int getNextFreeClassId() => nextFreeClassId++; | 170 int getNextFreeClassId() => nextFreeClassId++; |
| 168 | 171 |
| 169 void ensure(bool condition) { | 172 void ensure(bool condition) { |
| 170 if (!condition) cancel('failed assertion in leg'); | 173 if (!condition) cancel('failed assertion in leg'); |
| 171 } | 174 } |
| 172 | 175 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 if (!enqueuer.codegen.queue.isEmpty()) { | 369 if (!enqueuer.codegen.queue.isEmpty()) { |
| 367 internalErrorOnElement(enqueuer.codegen.queue.first().element, | 370 internalErrorOnElement(enqueuer.codegen.queue.first().element, |
| 368 "work list is not empty"); | 371 "work list is not empty"); |
| 369 } | 372 } |
| 370 } | 373 } |
| 371 | 374 |
| 372 TreeElements analyzeElement(Element element) { | 375 TreeElements analyzeElement(Element element) { |
| 373 assert(parser !== null); | 376 assert(parser !== null); |
| 374 Node tree = parser.parse(element); | 377 Node tree = parser.parse(element); |
| 375 validator.validate(tree); | 378 validator.validate(tree); |
| 379 unparseValidator.check(element); |
| 376 TreeElements elements = resolver.resolve(element); | 380 TreeElements elements = resolver.resolve(element); |
| 377 checker.check(tree, elements); | 381 checker.check(tree, elements); |
| 378 return elements; | 382 return elements; |
| 379 } | 383 } |
| 380 | 384 |
| 381 TreeElements analyze(WorkItem work) { | 385 TreeElements analyze(WorkItem work) { |
| 382 work.resolutionTree = analyzeElement(work.element); | 386 work.resolutionTree = analyzeElement(work.element); |
| 383 return work.resolutionTree; | 387 return work.resolutionTree; |
| 384 } | 388 } |
| 385 | 389 |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 When compiling the above method, the compiler crashed. It is not | 603 When compiling the above method, the compiler crashed. It is not |
| 600 possible to tell if this is caused by a problem in your program or | 604 possible to tell if this is caused by a problem in your program or |
| 601 not. Regardless, the compiler should not crash. | 605 not. Regardless, the compiler should not crash. |
| 602 | 606 |
| 603 The Dart team would greatly appreciate if you would take a moment to | 607 The Dart team would greatly appreciate if you would take a moment to |
| 604 report this problem at http://dartbug.com/new. | 608 report this problem at http://dartbug.com/new. |
| 605 | 609 |
| 606 Please copy and paste the error and stack trace that you see here into | 610 Please copy and paste the error and stack trace that you see here into |
| 607 the bug report, include your OS and the Dart SDK build number. | 611 the bug report, include your OS and the Dart SDK build number. |
| 608 '''; | 612 '''; |
| OLD | NEW |