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;
110 return (code & 0xfc00) == 0xd800;
114 return (code & 0xfc00) == 0xdc00;
118 return 0x10000 + ((lead & 0x3ff) << 10) + (trail & 0x3ff);
132 return 0xd800 + (((char_code - 0x10000) >> 10) & 0x3ff);
135 return 0xdc00 + (char_code & 0x3ff);
152 static inline unsigned Encode(
char* out,
155 bool replace_invalid =
false);
187 unsigned buffer_length,
188 const uint8_t* stream,
189 unsigned stream_length);
195 unsigned buffer_length,
196 const uint8_t* stream,
197 unsigned stream_length);
208 template <
unsigned kBufferSize>
212 inline Utf8Decoder(
const char* stream,
unsigned length);
213 inline void Reset(
const char* stream,
unsigned length);
250 bool* allow_caching_ptr);
258 bool* allow_caching_ptr);
265 bool* allow_caching_ptr);
272 bool* allow_caching_ptr);
279 bool* allow_caching_ptr);
284 #endif // V8_UNICODE_H_
static int CombineSurrogatePair(uchar lead, uchar trail)
static const unsigned kSizeOfUnmatchedSurrogate
static const unsigned kMaxChar
static int Convert(uchar c, uchar n, uchar *result, bool *allow_caching_ptr)
static const unsigned kMaxTwoByteChar
static uint16_t TrailSurrogate(uint32_t char_code)
bool last_byte_of_buffer_unused_
const int kMaxMappingSize
static const unsigned kMax16BitCodeUnitSize
static uint16_t ConvertNonLatin1ToLatin1(uint16_t)
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)
void Reset(const char *stream, unsigned length)
static int Convert(uchar c, uchar n, uchar *result, bool *allow_caching_ptr)
static const unsigned kMaxEncodedSize
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object size
static const bool kIsToLower
static uchar Length(uchar chr, int previous)
static int Convert(uchar c, uchar n, uchar *result, bool *allow_caching_ptr)
static const uchar kMaxNonSurrogateCharCode
static const int kMaxWidth
static uint16_t LeadSurrogate(uint32_t char_code)
static const bool kIsToLower
static unsigned EncodeOneByte(char *out, uint8_t c)
static const int kUtf8BytesToCodeASurrogate
static unsigned Encode(char *out, uchar c, int previous, bool replace_invalid=false)
static uchar ValueOf(const byte *str, unsigned length, unsigned *cursor)
static const int kMaxWidth
static const unsigned kMaxFourByteChar
static int Convert(uchar c, uchar n, uchar *result, bool *allow_caching_ptr)
static void WriteUtf16Slow(const uint8_t *stream, uint16_t *data, unsigned length)
static const int kMaxWidth
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra code(assertions) for debugging") DEFINE_bool(code_comments
static const unsigned kBytesSavedByCombiningSurrogates
static const uchar kBadChar
static bool IsSurrogatePair(int lead, int trail)
static const unsigned kMaxThreeByteChar
static const unsigned kMaxOneByteChar
const uint8_t * unbuffered_start_
void Reset(uint16_t *buffer, unsigned buffer_length, const uint8_t *stream, unsigned stream_length)
static bool IsLeadSurrogate(int code)
static bool IsTrailSurrogate(int code)
static const int kMaxWidth
unsigned Utf16Length() const
unsigned WriteUtf16(uint16_t *data, unsigned length) const
static const int kNoPreviousCharacter