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 #library('d8_scanner_bench'); | 5 #library('d8_scanner_bench'); |
6 #import('../../lib/node/node.dart'); | 6 #import('../../node/node.dart'); |
7 #import('scannerlib.dart'); | 7 #import('scannerlib.dart'); |
8 #import('scanner_implementation.dart'); | 8 #import('scanner_implementation.dart'); |
9 #import('scanner_bench.dart'); | 9 #import('scanner_bench.dart'); |
10 | 10 |
11 d8_read(String filename) native 'return read(filename)'; | 11 d8_read(String filename) native 'return read(filename)'; |
12 | 12 |
13 class D8ScannerBench extends ScannerBench { | 13 class D8ScannerBench extends ScannerBench { |
14 int getBytes(String filename, void callback(bytes)) { | 14 int getBytes(String filename, void callback(bytes)) { |
15 // This actually returns a buffer, not a String. | 15 // This actually returns a buffer, not a String. |
16 var s = d8_read(filename); | 16 var s = d8_read(filename); |
17 callback(s); | 17 callback(s); |
18 return s.length; | 18 return s.length; |
19 } | 19 } |
20 | 20 |
21 Scanner makeScanner(bytes) => new StringScanner(bytes); | 21 Scanner makeScanner(bytes) => new StringScanner(bytes); |
22 | 22 |
23 void checkExistence(String filename) { | 23 void checkExistence(String filename) { |
24 } | 24 } |
25 } | 25 } |
26 | 26 |
27 main() { | 27 main() { |
28 new D8ScannerBench().main(argv); | 28 new D8ScannerBench().main(argv); |
29 } | 29 } |
OLD | NEW |