Flutter Engine
The Flutter Engine
unibrow.h
Go to the documentation of this file.
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 RUNTIME_VM_UNIBROW_H_
6#define RUNTIME_VM_UNIBROW_H_
7
8#include <sys/types.h>
9
10#include "vm/globals.h"
11
12/**
13 * \file
14 * Definitions and convenience functions for working with unicode.
15 */
16
17namespace unibrow {
18
19// A cache used in case conversion. It caches the value for characters
20// that either have no mapping or map to a single character independent
21// of context. Characters that map to more than one character or that
22// map differently depending on context are always looked up.
23template <class T, intptr_t size = 256>
24class Mapping {
25 public:
26 inline Mapping() {}
27 inline intptr_t get(int32_t c, int32_t n, int32_t* result);
28
29 private:
30 friend class Test;
31 intptr_t CalculateValue(int32_t c, int32_t n, int32_t* result);
32 struct CacheEntry {
33 inline CacheEntry() : code_point_(kNoChar), offset_(0) {}
34 inline CacheEntry(int32_t code_point, signed offset)
35 : code_point_(code_point), offset_(offset) {}
36 int32_t code_point_;
37 signed offset_;
38 static constexpr intptr_t kNoChar = (1 << 21) - 1;
39 };
40 static constexpr intptr_t kSize = size;
41 static constexpr intptr_t kMask = kSize - 1;
42 CacheEntry entries_[kSize];
43};
44
45struct Letter {
46 static bool Is(int32_t c);
47};
49 static constexpr intptr_t kMaxWidth = 1;
50 static intptr_t Convert(int32_t c,
51 int32_t n,
52 int32_t* result,
53 bool* allow_caching_ptr);
54};
56 static constexpr intptr_t kMaxWidth = 4;
57 static intptr_t Convert(int32_t c,
58 int32_t n,
59 int32_t* result,
60 bool* allow_caching_ptr);
61};
63 static constexpr intptr_t kMaxWidth = 1;
64 static intptr_t Convert(int32_t c,
65 int32_t n,
66 int32_t* result,
67 bool* allow_caching_ptr);
68};
69
70} // namespace unibrow
71
72#endif // RUNTIME_VM_UNIBROW_H_
friend class Test
Definition: unibrow.h:30
intptr_t get(int32_t c, int32_t n, int32_t *result)
Definition: unibrow-inl.h:15
GAsyncResult * result
constexpr SkISize kSize
Definition: mock_canvas.cc:17
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
SeparatedVector2 offset
static intptr_t Convert(int32_t c, int32_t n, int32_t *result, bool *allow_caching_ptr)
Definition: unibrow.cc:1824
static constexpr intptr_t kMaxWidth
Definition: unibrow.h:63
static intptr_t Convert(int32_t c, int32_t n, int32_t *result, bool *allow_caching_ptr)
Definition: unibrow.cc:627
static constexpr intptr_t kMaxWidth
Definition: unibrow.h:49
static intptr_t Convert(int32_t c, int32_t n, int32_t *result, bool *allow_caching_ptr)
Definition: unibrow.cc:1759
static constexpr intptr_t kMaxWidth
Definition: unibrow.h:56
static bool Is(int32_t c)
Definition: unibrow.cc:357