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

Side by Side Diff: runtime/vm/unibrow.h

Issue 678193004: Copy irregexp related code from V8. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 6 years, 1 month 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
« no previous file with comments | « runtime/vm/regexp_parser.cc ('k') | runtime/vm/unibrow.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014, 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 #ifndef VM_UNIBROW_H_
6 #define VM_UNIBROW_H_
7
8 #include <sys/types.h>
9
10 // SNIP
11
12 /**
13 * \file
14 * Definitions and convenience functions for working with unicode.
15 */
16
17 namespace unibrow {
18
19 // SNIP
20
21 // A cache used in case conversion. It caches the value for characters
22 // that either have no mapping or map to a single character independent
23 // of context. Characters that map to more than one character or that
24 // map differently depending on context are always looked up.
25 template <class T, int size = 256>
26 class Mapping {
27 public:
28 inline Mapping() { }
29 inline int get(uchar c, uchar n, uchar* result);
30 private:
31 friend class Test;
32 int CalculateValue(uchar c, uchar n, uchar* result);
33 struct CacheEntry {
34 inline CacheEntry() : code_point_(kNoChar), offset_(0) { }
35 inline CacheEntry(uchar code_point, signed offset)
36 : code_point_(code_point),
37 offset_(offset) { }
38 uchar code_point_;
39 signed offset_;
40 static const int kNoChar = (1 << 21) - 1;
41 };
42 static const int kSize = size;
43 static const int kMask = kSize - 1;
44 CacheEntry entries_[kSize];
45 };
46
47 // SNIP
48
49 struct Letter {
50 static bool Is(uchar c);
51 };
52 struct Ecma262Canonicalize {
53 static const int kMaxWidth = 1;
54 static int Convert(uchar c,
55 uchar n,
56 uchar* result,
57 bool* allow_caching_ptr);
58 };
59 struct Ecma262UnCanonicalize {
60 static const int kMaxWidth = 4;
61 static int Convert(uchar c,
62 uchar n,
63 uchar* result,
64 bool* allow_caching_ptr);
65 };
66 struct CanonicalizationRange {
67 static const int kMaxWidth = 1;
68 static int Convert(uchar c,
69 uchar n,
70 uchar* result,
71 bool* allow_caching_ptr);
72 };
73
74 } // namespace unibrow
75
76 #endif // VM_UNIBROW_H_
OLDNEW
« no previous file with comments | « runtime/vm/regexp_parser.cc ('k') | runtime/vm/unibrow.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698