| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 library rasta.rastak; | 5 library rasta.rastak; |
| 6 | 6 |
| 7 import 'dart:async' show | 7 import 'dart:async' show |
| 8 Future; | 8 Future; |
| 9 | 9 |
| 10 import 'dart:isolate' show | 10 import 'dart:isolate' show |
| 11 ReceivePort; | 11 ReceivePort; |
| 12 | 12 |
| 13 import 'package:kernel/ast.dart' as ir; | 13 import 'package:kernel/ast.dart' as ir; |
| 14 | 14 |
| 15 import 'rastask.dart' show | 15 import 'rastask.dart' show |
| 16 Rastask; | 16 Rastask; |
| 17 | 17 |
| 18 Future<ir.TreeNode> main(List<String> arguments, isolateArgument) async { | 18 Future<ir.TreeNode> main(List<String> arguments, isolateArgument) async { |
| 19 final ReceivePort port = new ReceivePort(); | 19 final ReceivePort port = new ReceivePort(); |
| 20 try { | 20 try { |
| 21 Stopwatch wallClock = new Stopwatch()..start(); | 21 Stopwatch wallClock = new Stopwatch()..start(); |
| 22 Rastask task = await Rastask.setup(wallClock, arguments); | 22 Rastask task = await Rastask.create(wallClock, arguments); |
| 23 | 23 |
| 24 // Due to an implementation detail (an optimization that may be wrong) in | 24 // Due to an implementation detail (an optimization that may be wrong) in |
| 25 // zones, a `then` handler on a future may be run recursively inside a | 25 // zones, a `then` handler on a future may be run recursively inside a |
| 26 // measuring zone. If the handler belongs to a non-measuring zone, its run | 26 // measuring zone. If the handler belongs to a non-measuring zone, its run |
| 27 // time will be incorrectly counted in the measuring zone. In practice, the | 27 // time will be incorrectly counted in the measuring zone. In practice, the |
| 28 // library loader was blamed for the execution time of rastak. By adding a | 28 // library loader was blamed for the execution time of rastak. By adding a |
| 29 // Rasta task, we avoid counting rastak towards the library loader, and we | 29 // Rasta task, we avoid counting rastak towards the library loader, and we |
| 30 // get a counter for rastak. | 30 // get a counter for rastak. |
| 31 return await task.measure(task.run); | 31 return await task.measure(task.run); |
| 32 } finally { | 32 } finally { |
| 33 port.close(); | 33 port.close(); |
| 34 } | 34 } |
| 35 } | 35 } |
| OLD | NEW |