31 #include <sys/types.h>
41 typedef unsigned char byte;
49 template <
class T,
int size = 256>
53 inline bool get(
uchar c);
56 bool CalculateValue(
uchar c);
58 inline CacheEntry() : code_point_(0), value_(0) { }
59 inline CacheEntry(
uchar code_point,
bool value)
60 : code_point_(code_point),
62 uchar code_point_ : 21;
65 static const int kSize = size;
66 static const int kMask = kSize - 1;
67 CacheEntry entries_[kSize];
74 template <
class T,
int size = 256>
83 inline CacheEntry() : code_point_(kNoChar), offset_(0) { }
84 inline CacheEntry(
uchar code_point,
signed offset)
85 : code_point_(code_point),
89 static const int kNoChar = (1 << 21) - 1;
91 static const int kSize = size;
92 static const int kMask = kSize - 1;
93 CacheEntry entries_[kSize];
99 static int GetByteCount();
100 static const uchar kMaxCodePoint;
105 template <
typename Data>
109 inline Buffer() : data_(0), length_(0) { }
122 return (code & 0xfc00) == 0xd800;
126 return (code & 0xfc00) == 0xdc00;
130 return 0x10000 + ((lead & 0x3ff) << 10) + (trail & 0x3ff);
144 return 0xd800 + (((char_code - 0x10000) >> 10) & 0x3ff);
147 return 0xdc00 + (char_code & 0x3ff);
155 static inline unsigned Encode(
156 char* out,
uchar c,
int previous);
158 unsigned capacity,
unsigned* chars_read,
unsigned* offset);
177 static inline uchar ValueOf(
const byte* str,
189 virtual void Seek(
unsigned);
196 unsigned capacity,
unsigned& offset);
198 unsigned capacity,
unsigned& offset);
200 virtual void Rewind() = 0;
221 template <
class Reader,
class Input = Reader*,
unsigned kSize = 256>
225 inline void Reset(Input input);
226 void Seek(
unsigned position);
227 inline void Reset(
unsigned position, Input input);
250 template <
unsigned s = 256>
255 inline void Reset(
const char* data,
unsigned length) {
294 bool* allow_caching_ptr);
301 bool* allow_caching_ptr);
308 bool* allow_caching_ptr);
315 bool* allow_caching_ptr);
322 bool* allow_caching_ptr);
327 #endif // V8_UNICODE_H_
static uchar TrailSurrogate(int char_code)
static int CombineSurrogatePair(uchar lead, uchar trail)
static const unsigned kSizeOfUnmatchedSurrogate
static uchar LeadSurrogate(int char_code)
static int Convert(uchar c, uchar n, uchar *result, bool *allow_caching_ptr)
static const unsigned kMaxTwoByteChar
static bool EncodeNonAsciiCharacter(uchar c, byte *buffer, unsigned capacity, unsigned &offset)
static uchar DecodeCharacter(const byte *buffer, unsigned *offset)
const int kMaxMappingSize
virtual bool BoundsCheck(unsigned offset)=0
static const int kMaxWidth
static int Convert(uchar c, uchar n, uchar *result, bool *allow_caching_ptr)
static const int kMaxExtraUtf8BytesForOneUtf16CodeUnit
static uchar CalculateValue(const byte *str, unsigned length, unsigned *cursor)
static int Convert(uchar c, uchar n, uchar *result, bool *allow_caching_ptr)
static const unsigned kMaxEncodedSize
static uchar Length(uchar chr, int previous)
static int Convert(uchar c, uchar n, uchar *result, bool *allow_caching_ptr)
virtual void Seek(unsigned)
static const uchar kMaxNonSurrogateCharCode
static const int kMaxWidth
Buffer(Data data, unsigned length)
static const int kUtf8BytesToCodeASurrogate
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra code(assertions) for debugging") DEFINE_bool(code_comments
static unsigned Encode(char *out, uchar c, int previous)
static const int kMaxWidth
static const unsigned kMaxFourByteChar
virtual void FillBuffer()=0
static int Convert(uchar c, uchar n, uchar *result, bool *allow_caching_ptr)
static const int kMaxWidth
static const unsigned kBytesSavedByCombiningSurrogates
static const uchar kBadChar
static const byte * ReadBlock(Buffer< const char * > str, byte *buffer, unsigned capacity, unsigned *chars_read, unsigned *offset)
static const unsigned kMaxThreeByteChar
static const unsigned kMaxOneByteChar
static bool IsLeadSurrogate(int code)
static bool IsTrailSurrogate(int code)
static bool EncodeAsciiCharacter(uchar c, byte *buffer, unsigned capacity, unsigned &offset)
static const int kMaxWidth
virtual ~CharacterStream()
static bool EncodeCharacter(uchar c, byte *buffer, unsigned capacity, unsigned &offset)
static const int kNoPreviousCharacter