| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 Compiler implements Canceler, Logger { | 5 class Compiler implements Canceler, Logger { |
| 6 final Script script; | 6 final Script script; |
| 7 Queue<SourceString> worklist; | 7 Queue<SourceString> worklist; |
| 8 Universe universe; | 8 Universe universe; |
| 9 | 9 |
| 10 List<CompilerTask> tasks; | 10 List<CompilerTask> tasks; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 } catch (CompilerCancelledException exception) { | 43 } catch (CompilerCancelledException exception) { |
| 44 log(exception.toString()); | 44 log(exception.toString()); |
| 45 log('compilation failed'); | 45 log('compilation failed'); |
| 46 return false; | 46 return false; |
| 47 } | 47 } |
| 48 // TODO(floitsch): the following code can be removed once the HTracer | 48 // TODO(floitsch): the following code can be removed once the HTracer |
| 49 // writes directly into a file. | 49 // writes directly into a file. |
| 50 if (GENERATE_SSA_TRACE) { | 50 if (GENERATE_SSA_TRACE) { |
| 51 print("------------------"); | 51 print("------------------"); |
| 52 print(new HTracer.singleton()); | 52 print(new HTracer.singleton()); |
| 53 print("------------------"); | 53 print("------------------"); |
| 54 } | 54 } |
| 55 log('compilation succeeded'); | 55 log('compilation succeeded'); |
| 56 return true; | 56 return true; |
| 57 } | 57 } |
| 58 | 58 |
| 59 void runCompiler() { | 59 void runCompiler() { |
| 60 scanner.scan(script); | 60 scanner.scan(script); |
| 61 while (!worklist.isEmpty()) { | 61 while (!worklist.isEmpty()) { |
| 62 SourceString name = worklist.removeLast(); | 62 SourceString name = worklist.removeLast(); |
| 63 Element element = universe.find(name); | 63 Element element = universe.find(name); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 var print = (typeof console == 'object') | 120 var print = (typeof console == 'object') |
| 121 ? function(obj) { console.log(obj); } | 121 ? function(obj) { console.log(obj); } |
| 122 : function(obj) { write(obj); write('\\n'); }; | 122 : function(obj) { write(obj); write('\\n'); }; |
| 123 """; | 123 """; |
| 124 | 124 |
| 125 final String ADD_SUPPORT = """ | 125 final String ADD_SUPPORT = """ |
| 126 function \$add(a, b) { | 126 function \$add(a, b) { |
| 127 return a + b; | 127 return a + b; |
| 128 } | 128 } |
| 129 """; | 129 """; |
| OLD | NEW |