28 #ifndef V8_UNICODE_INL_H_ 
   29 #define V8_UNICODE_INL_H_ 
   37   CacheEntry entry = entries_[code_point & kMask];
 
   38   if (entry.code_point_ == code_point) 
return entry.value_;
 
   39   return CalculateValue(code_point);
 
   44   bool result = T::Is(code_point);
 
   45   entries_[code_point & kMask] = CacheEntry(code_point, result);
 
   51   CacheEntry entry = entries_[c & kMask];
 
   52   if (entry.code_point_ == c) {
 
   53     if (entry.offset_ == 0) {
 
   56       result[0] = c + entry.offset_;
 
   60     return CalculateValue(c, n, result);
 
   66   bool allow_caching = 
true;
 
   67   int length = T::Convert(c, n, result, &allow_caching);
 
   70       entries_[c & kMask] = CacheEntry(c, result[0] - c);
 
   73       entries_[c & kMask] = CacheEntry(c, 0);
 
   83   static const int kMask = ~(1 << 6);
 
   88     str[0] = 0xC0 | (c >> 6);
 
   89     str[1] = 0x80 | (c & kMask);
 
   95       return Encode(str - kUnmatchedSize,
 
   99     str[0] = 0xE0 | (c >> 12);
 
  100     str[1] = 0x80 | ((c >> 6) & kMask);
 
  101     str[2] = 0x80 | (c & kMask);
 
  104     str[0] = 0xF0 | (c >> 18);
 
  105     str[1] = 0x80 | ((c >> 12) & kMask);
 
  106     str[2] = 0x80 | ((c >> 6) & kMask);
 
  107     str[3] = 0x80 | (c & kMask);
 
  113 uchar Utf8::ValueOf(
const byte* bytes, 
unsigned length, 
unsigned* cursor) {
 
  115   byte first = bytes[0];
 
  152 #if __BYTE_ORDER == __LITTLE_ENDIAN 
  153 #define IF_LITTLE(expr) expr 
  154 #define IF_BIG(expr)    ((void) 0) 
  155 #elif __BYTE_ORDER == __BIG_ENDIAN 
  156 #define IF_LITTLE(expr) ((void) 0) 
  157 #define IF_BIG(expr)    expr 
  159 #warning Unknown byte ordering 
  163     unsigned capacity, 
unsigned& offset) {
 
  164   if (offset >= capacity) 
return false;
 
  171     unsigned capacity, 
unsigned& offset) {
 
  172   unsigned aligned = (offset + 0x3) & ~0x3;
 
  173   if ((aligned + 
sizeof(
uchar)) > capacity)
 
  175   if (offset == aligned) {
 
  176     IF_LITTLE(*reinterpret_cast<uchar*>(buffer + aligned) = (c << 8) | 0x80);
 
  177     IF_BIG(*reinterpret_cast<uchar*>(buffer + aligned) = c | (1 << 31));
 
  179     buffer[offset] = 0x80;
 
  180     IF_LITTLE(*reinterpret_cast<uchar*>(buffer + aligned) = c << 8);
 
  181     IF_BIG(*reinterpret_cast<uchar*>(buffer + aligned) = c);
 
  183   offset = aligned + 
sizeof(
uchar);
 
  197   byte b = buffer[*offset];
 
  202     unsigned aligned = (*offset + 0x3) & ~0x3;
 
  203     *offset = aligned + 
sizeof(
uchar);
 
  204     IF_LITTLE(
return *reinterpret_cast<const uchar*>(buffer + aligned) >> 8);
 
  205     IF_BIG(
return *reinterpret_cast<const uchar*>(buffer + aligned) &
 
  213 template <
class R, 
class I, 
unsigned s>
 
  215   buffer_ = R::ReadBlock(input_, util_buffer_, s, &remaining_, &offset_);
 
  218 template <
class R, 
class I, 
unsigned s>
 
  223 template <
class R, 
class I, 
unsigned s>
 
  229   buffer_ = R::ReadBlock(input_, util_buffer_, s, &remaining_, &offset_);
 
  232 template <
class R, 
class I, 
unsigned s>
 
  237 template <
class R, 
class I, 
unsigned s>
 
  240   buffer_ = R::ReadBlock(input_, util_buffer_, s, &remaining_, &offset_);
 
  243 template <
unsigned s>
 
  251 #endif  // V8_UNICODE_INL_H_ 
static int CombineSurrogatePair(uchar lead, uchar trail)
 
static const unsigned kSizeOfUnmatchedSurrogate
 
#define I(name, number_of_args, result_size)
 
static const unsigned kMaxTwoByteChar
 
static bool EncodeNonAsciiCharacter(uchar c, byte *buffer, unsigned capacity, unsigned &offset)
 
static uchar DecodeCharacter(const byte *buffer, unsigned *offset)
 
virtual bool BoundsCheck(unsigned offset)=0
 
#define ASSERT(condition)
 
static uchar CalculateValue(const byte *str, unsigned length, unsigned *cursor)
 
StringInputBuffer *const buffer_
 
int get(uchar c, uchar n, uchar *result)
 
static uchar Length(uchar chr, int previous)
 
static unsigned Encode(char *out, uchar c, int previous)
 
virtual void FillBuffer()=0
 
static const unsigned kBytesSavedByCombiningSurrogates
 
static const uchar kBadChar
 
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 bool EncodeCharacter(uchar c, byte *buffer, unsigned capacity, unsigned &offset)
 
static const int kNoPreviousCharacter