Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: dart/lib/compiler/implementation/scanner/node_scanner_bench.dart

Issue 10164004: Remove frogsh. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 #library('node_scanner_bench');
6 #import('../util/characters.dart');
7 #import('../../../../frog/lib/node/node.dart');
8 #import('scannerlib.dart');
9 #import('scanner_implementation.dart');
10 #import('scanner_bench.dart');
11 #import('../../../utf/utf.dart');
12 #source('byte_strings.dart');
13 #source('byte_array_scanner.dart');
14
15 class NodeScannerBench extends ScannerBench {
16 int getBytes(String filename, void callback(bytes)) {
17 // This actually returns a buffer, not a String.
18 var s = fs.readFileSync(filename, null);
19 callback(s);
20 return s.length;
21 }
22
23 Scanner makeScanner(bytes) => new InflexibleByteArrayScanner(bytes);
24
25 void checkExistence(String filename) {
26 if (!path.existsSync(filename)) {
27 throw "no such file: ${filename}";
28 }
29 }
30 }
31
32 class InflexibleByteArrayScanner extends ByteArrayScanner {
33 InflexibleByteArrayScanner(List<int> bytes) : super(bytes);
34
35 int byteAt(int index) => (bytes.length > index) ? bytes[index] : $EOF;
36
37 int advance() {
38 // This method should be equivalent to the one in super. However,
39 // this is a *HOT* method and V8 performs better if it is easy to
40 // inline.
41 int index = ++byteOffset;
42 int next = (bytes.length > index) ? bytes[index] : $EOF;
43 return next;
44 }
45 }
46
47 main() {
48 new NodeScannerBench().main(argv);
49 }
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/scanner/motile_node.dart ('k') | dart/samples/swarm/htmlconverter.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698