5 #ifndef V8_UNICODE_INL_H_
6 #define V8_UNICODE_INL_H_
15 CacheEntry entry = entries_[code_point & kMask];
17 return CalculateValue(code_point);
22 bool result =
T::Is(code_point);
23 entries_[code_point & kMask] =
CacheEntry(code_point, result);
38 return CalculateValue(c, n, result);
44 bool allow_caching =
true;
45 int length = T::Convert(c, n, result, &allow_caching);
48 entries_[c & kMask] =
CacheEntry(c, result[0] - c);
77 static const int kMask = ~(1 << 6);
82 str[0] = 0xC0 | (c >> 6);
83 str[1] = 0x80 | (c & kMask);
94 bool replace_invalid) {
95 static const int kMask = ~(1 << 6);
100 str[0] = 0xC0 | (c >> 6);
101 str[1] = 0x80 | (c & kMask);
106 return Encode(str - kUnmatchedSize,
109 replace_invalid) - kUnmatchedSize;
110 }
else if (replace_invalid &&
115 str[0] = 0xE0 | (c >> 12);
116 str[1] = 0x80 | ((c >> 6) & kMask);
117 str[2] = 0x80 | (c & kMask);
120 str[0] = 0xF0 | (c >> 18);
121 str[1] = 0x80 | ((c >> 12) & kMask);
122 str[2] = 0x80 | ((c >> 6) & kMask);
123 str[3] = 0x80 | (c & kMask);
131 byte first = bytes[0];
157 : unbuffered_start_(
NULL),
159 last_byte_of_buffer_unused_(
false) {}
162 unsigned buffer_length,
163 const uint8_t* stream,
164 unsigned stream_length) {
165 Reset(buffer, buffer_length, stream, stream_length);
168 template<
unsigned kBufferSize>
172 reinterpret_cast<const uint8_t*>(stream),
176 template<
unsigned kBufferSize>
180 reinterpret_cast<const uint8_t*
>(stream),
184 template <
unsigned kBufferSize>
186 unsigned length)
const {
188 if (length > utf16_length_) length = utf16_length_;
190 unsigned buffer_length =
192 unsigned memcpy_length = length <= buffer_length ? length : buffer_length;
194 if (length <= buffer_length)
return length;
197 WriteUtf16Slow(unbuffered_start_,
198 data + buffer_length,
199 length - buffer_length);
static const unsigned kMaxChar
static uint16_t ConvertNonLatin1ToLatin1(uint16_t)
int CalculateValue(uchar c, uchar n, uchar *result)
int get(uchar c, uchar n, uchar *result)
bool CalculateValue(uchar c)
static const int kNoPreviousCharacter
static bool IsSurrogatePair(int lead, int trail)
static int CombineSurrogatePair(uchar lead, uchar trail)
static bool IsTrailSurrogate(int code)
static bool IsLeadSurrogate(int code)
void Reset(uint16_t *buffer, unsigned buffer_length, const uint8_t *stream, unsigned stream_length)
void Reset(const char *stream, unsigned length)
unsigned WriteUtf16(uint16_t *data, unsigned length) const
static const unsigned kMaxThreeByteChar
static const unsigned kMaxOneByteChar
static uchar ValueOf(const byte *str, unsigned length, unsigned *cursor)
static const uchar kBadChar
static uchar Length(uchar chr, int previous)
static unsigned EncodeOneByte(char *out, uint8_t c)
static const unsigned kMaxTwoByteChar
static unsigned Encode(char *out, uchar c, int previous, bool replace_invalid=false)
static const unsigned kBytesSavedByCombiningSurrogates
static const unsigned kSizeOfUnmatchedSurrogate
static uchar CalculateValue(const byte *str, unsigned length, unsigned *cursor)
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define DCHECK(condition)
static const size_t kBufferSize
void MemCopy(void *dest, const void *src, size_t size)
Definitions and convenience functions for working with unicode.