28 #ifndef V8_UNICODE_INL_H_
29 #define V8_UNICODE_INL_H_
38 CacheEntry entry = entries_[code_point & kMask];
39 if (entry.code_point_ == code_point)
return entry.value_;
40 return CalculateValue(code_point);
45 bool result =
T::Is(code_point);
46 entries_[code_point & kMask] = CacheEntry(code_point, result);
52 CacheEntry entry = entries_[c & kMask];
53 if (entry.code_point_ == c) {
54 if (entry.offset_ == 0) {
57 result[0] = c + entry.offset_;
61 return CalculateValue(c, n, result);
67 bool allow_caching =
true;
68 int length = T::Convert(c, n, result, &allow_caching);
71 entries_[c & kMask] = CacheEntry(c, result[0] - c);
74 entries_[c & kMask] = CacheEntry(c, 0);
100 static const int kMask = ~(1 << 6);
105 str[0] = 0xC0 | (c >> 6);
106 str[1] = 0x80 | (c & kMask);
117 bool replace_invalid) {
118 static const int kMask = ~(1 << 6);
123 str[0] = 0xC0 | (c >> 6);
124 str[1] = 0x80 | (c & kMask);
129 return Encode(str - kUnmatchedSize,
132 replace_invalid) - kUnmatchedSize;
133 }
else if (replace_invalid &&
138 str[0] = 0xE0 | (c >> 12);
139 str[1] = 0x80 | ((c >> 6) & kMask);
140 str[2] = 0x80 | (c & kMask);
143 str[0] = 0xF0 | (c >> 18);
144 str[1] = 0x80 | ((c >> 12) & kMask);
145 str[2] = 0x80 | ((c >> 6) & kMask);
146 str[3] = 0x80 | (c & kMask);
154 byte first = bytes[0];
180 : unbuffered_start_(
NULL),
182 last_byte_of_buffer_unused_(
false) {}
185 unsigned buffer_length,
186 const uint8_t* stream,
187 unsigned stream_length) {
188 Reset(buffer, buffer_length, stream, stream_length);
191 template<
unsigned kBufferSize>
195 reinterpret_cast<const uint8_t*>(stream),
199 template<
unsigned kBufferSize>
203 reinterpret_cast<const uint8_t*>(stream),
207 template <
unsigned kBufferSize>
209 unsigned length)
const {
211 if (length > utf16_length_) length = utf16_length_;
213 unsigned buffer_length =
214 last_byte_of_buffer_unused_ ? kBufferSize - 1 : kBufferSize;
215 unsigned memcpy_length = length <= buffer_length ? length : buffer_length;
217 if (length <= buffer_length)
return length;
220 WriteUtf16Slow(unbuffered_start_,
221 data + buffer_length,
222 length - buffer_length);
228 #endif // V8_UNICODE_INL_H_
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 NULL
static int CombineSurrogatePair(uchar lead, uchar trail)
static const unsigned kSizeOfUnmatchedSurrogate
static const unsigned kMaxChar
static const unsigned kMaxTwoByteChar
static uint16_t ConvertNonLatin1ToLatin1(uint16_t)
#define ASSERT(condition)
static uchar CalculateValue(const byte *str, unsigned length, unsigned *cursor)
void Reset(const char *stream, unsigned length)
int get(uchar c, uchar n, uchar *result)
static uchar Length(uchar chr, int previous)
static void MemCopy(void *dest, const void *src, size_t size)
static unsigned EncodeOneByte(char *out, uint8_t c)
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 unsigned kBytesSavedByCombiningSurrogates
static const uchar kBadChar
static bool IsSurrogatePair(int lead, int trail)
static const unsigned kMaxThreeByteChar
static const unsigned kMaxOneByteChar
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)
unsigned WriteUtf16(uint16_t *data, unsigned length) const
static const int kNoPreviousCharacter