| 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 Function run; | 8 Function run; |
| 9 Map<int, BailoutInfo> bailouts = null; | 9 Map<int, BailoutInfo> bailouts = null; |
| 10 bool allowSpeculativeOptimization = true; | 10 bool allowSpeculativeOptimization = true; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 static final SourceString MAIN = const SourceString('main'); | 84 static final SourceString MAIN = const SourceString('main'); |
| 85 static final SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod'); | 85 static final SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod'); |
| 86 static final SourceString NO_SUCH_METHOD_EXCEPTION = | 86 static final SourceString NO_SUCH_METHOD_EXCEPTION = |
| 87 const SourceString('NoSuchMethodException'); | 87 const SourceString('NoSuchMethodException'); |
| 88 static final SourceString OBJECT = const SourceString('Object'); | 88 static final SourceString OBJECT = const SourceString('Object'); |
| 89 static final SourceString START_ROOT_ISOLATE = | 89 static final SourceString START_ROOT_ISOLATE = |
| 90 const SourceString('startRootIsolate'); | 90 const SourceString('startRootIsolate'); |
| 91 static final SourceString CLOSURE = const SourceString('Closure'); | 91 static final SourceString CLOSURE = const SourceString('Closure'); |
| 92 bool enabledNoSuchMethod = false; | 92 bool enabledNoSuchMethod = false; |
| 93 | 93 |
| 94 static final String GREEN_COLOR = '\u001b[32m'; | |
| 95 static final String RED_COLOR = '\u001b[31m'; | |
| 96 static final String MAGENTA_COLOR = '\u001b[35m'; | |
| 97 static final String NO_COLOR = '\u001b[0m'; | |
| 98 | |
| 99 Compiler.withCurrentDirectory(String this.currentDirectory, | 94 Compiler.withCurrentDirectory(String this.currentDirectory, |
| 100 [this.tracer = const Tracer()]) | 95 [this.tracer = const Tracer()]) |
| 101 : types = new Types(), | 96 : types = new Types(), |
| 102 universe = new Universe(), | 97 universe = new Universe(), |
| 103 worklist = new Queue<WorkItem>() { | 98 worklist = new Queue<WorkItem>() { |
| 104 namer = new Namer(this); | 99 namer = new Namer(this); |
| 105 constantHandler = new ConstantHandler(this); | 100 constantHandler = new ConstantHandler(this); |
| 106 scanner = new ScannerTask(this); | 101 scanner = new ScannerTask(this); |
| 107 dietParser = new DietParserTask(this); | 102 dietParser = new DietParserTask(this); |
| 108 parser = new ParserTask(this); | 103 parser = new ParserTask(this); |
| 109 validator = new TreeValidatorTask(this); | 104 validator = new TreeValidatorTask(this); |
| 110 resolver = new ResolverTask(this); | 105 resolver = new ResolverTask(this); |
| 111 checker = new TypeCheckerTask(this); | 106 checker = new TypeCheckerTask(this); |
| 112 builder = new SsaBuilderTask(this); | 107 builder = new SsaBuilderTask(this); |
| 113 optimizer = new SsaOptimizerTask(this); | 108 optimizer = new SsaOptimizerTask(this); |
| 114 generator = new SsaCodeGeneratorTask(this); | 109 generator = new SsaCodeGeneratorTask(this); |
| 115 emitter = new CodeEmitterTask(this); | 110 emitter = new CodeEmitterTask(this); |
| 116 enqueuer = new EnqueueTask(this); | 111 enqueuer = new EnqueueTask(this); |
| 117 tasks = [scanner, dietParser, parser, resolver, checker, | 112 tasks = [scanner, dietParser, parser, resolver, checker, |
| 118 builder, optimizer, generator, | 113 builder, optimizer, generator, |
| 119 emitter, constantHandler, enqueuer]; | 114 emitter, constantHandler, enqueuer]; |
| 120 } | 115 } |
| 121 | 116 |
| 122 green(String string) => "${GREEN_COLOR}$string${NO_COLOR}"; | |
| 123 red(String string) => "${RED_COLOR}$string${NO_COLOR}"; | |
| 124 magenta(String string) => "${MAGENTA_COLOR}$string${NO_COLOR}"; | |
| 125 | |
| 126 void ensure(bool condition) { | 117 void ensure(bool condition) { |
| 127 if (!condition) cancel('failed assertion in leg'); | 118 if (!condition) cancel('failed assertion in leg'); |
| 128 } | 119 } |
| 129 | 120 |
| 130 void unimplemented(String methodName, | 121 void unimplemented(String methodName, |
| 131 [Node node, Token token, HInstruction instruction, | 122 [Node node, Token token, HInstruction instruction, |
| 132 Element element]) { | 123 Element element]) { |
| 133 internalError("$methodName not implemented", | 124 internalError("$methodName not implemented", |
| 134 node, token, instruction, element); | 125 node, token, instruction, element); |
| 135 } | 126 } |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 } | 467 } |
| 477 } | 468 } |
| 478 | 469 |
| 479 class SourceSpan { | 470 class SourceSpan { |
| 480 final Uri uri; | 471 final Uri uri; |
| 481 final int begin; | 472 final int begin; |
| 482 final int end; | 473 final int end; |
| 483 | 474 |
| 484 const SourceSpan(this.uri, this.begin, this.end); | 475 const SourceSpan(this.uri, this.begin, this.end); |
| 485 } | 476 } |
| OLD | NEW |