V8 Project
unibrow::Mapping< T, size > Class Template Reference

#include <unicode.h>

+ Inheritance diagram for unibrow::Mapping< T, size >:
+ Collaboration diagram for unibrow::Mapping< T, size >:

Classes

struct  CacheEntry
 

Public Member Functions

 Mapping ()
 
int get (uchar c, uchar n, uchar *result)
 

Private Member Functions

int CalculateValue (uchar c, uchar n, uchar *result)
 

Private Attributes

CacheEntry entries_ [kSize]
 

Static Private Attributes

static const int kSize = size
 
static const int kMask = kSize - 1
 

Friends

class Test
 

Detailed Description

template<class T, int size = 256>
class unibrow::Mapping< T, size >

Definition at line 52 of file unicode.h.

Constructor & Destructor Documentation

◆ Mapping()

template<class T , int size = 256>
unibrow::Mapping< T, size >::Mapping ( )
inline

Definition at line 54 of file unicode.h.

54 { }

Member Function Documentation

◆ CalculateValue()

template<class T , int s>
int unibrow::Mapping< T, s >::CalculateValue ( uchar  c,
uchar  n,
uchar result 
)
private

Definition at line 42 of file unicode-inl.h.

43  {
44  bool allow_caching = true;
45  int length = T::Convert(c, n, result, &allow_caching);
46  if (allow_caching) {
47  if (length == 1) {
48  entries_[c & kMask] = CacheEntry(c, result[0] - c);
49  return 1;
50  } else {
51  entries_[c & kMask] = CacheEntry(c, 0);
52  return 0;
53  }
54  } else {
55  return length;
56  }
57 }
static const int kMask
Definition: unicode.h:69
CacheEntry entries_[kSize]
Definition: unicode.h:70

◆ get()

template<class T , int s>
int unibrow::Mapping< T, s >::get ( uchar  c,
uchar  n,
uchar result 
)
inline

Definition at line 27 of file unicode-inl.h.

28  {
29  CacheEntry entry = entries_[c & kMask];
30  if (entry.code_point_ == c) {
31  if (entry.offset_ == 0) {
32  return 0;
33  } else {
34  result[0] = c + entry.offset_;
35  return 1;
36  }
37  } else {
38  return CalculateValue(c, n, result);
39  }
40 }
int CalculateValue(uchar c, uchar n, uchar *result)
Definition: unicode-inl.h:42

Referenced by v8::internal::CharacterRange::AddCaseEquivalents(), v8::internal::BackRefMatchesNoCase(), v8::internal::NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16(), v8::internal::ConvertCaseHelper(), and v8::internal::GetCaseIndependentLetters().

+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ Test

template<class T , int size = 256>
friend class Test
friend

Definition at line 57 of file unicode.h.

Member Data Documentation

◆ entries_

template<class T , int size = 256>
CacheEntry unibrow::Mapping< T, size >::entries_[kSize]
private

Definition at line 70 of file unicode.h.

◆ kMask

template<class T , int size = 256>
const int unibrow::Mapping< T, size >::kMask = kSize - 1
staticprivate

Definition at line 69 of file unicode.h.

◆ kSize

template<class T , int size = 256>
const int unibrow::Mapping< T, size >::kSize = size
staticprivate

Definition at line 68 of file unicode.h.


The documentation for this class was generated from the following files: