V8 Project
v8::internal::anonymous_namespace{scanner-character-streams.cc} Namespace Reference

Functions

unsigned CopyCharsHelper (uint16_t *dest, unsigned length, const uint8_t *src, unsigned *src_pos, unsigned src_length, ScriptCompiler::StreamedSource::Encoding encoding)
 

Function Documentation

◆ CopyCharsHelper()

unsigned v8::internal::anonymous_namespace{scanner-character-streams.cc}::CopyCharsHelper ( uint16_t *  dest,
unsigned  length,
const uint8_t *  src,
unsigned *  src_pos,
unsigned  src_length,
ScriptCompiler::StreamedSource::Encoding  encoding 
)

Definition at line 18 of file scanner-character-streams.cc.

20  {
21  if (encoding == ScriptCompiler::StreamedSource::UTF8) {
23  dest, length, src, src_pos, src_length);
24  }
25 
26  unsigned to_fill = length;
27  if (to_fill > src_length - *src_pos) to_fill = src_length - *src_pos;
28 
29  if (encoding == ScriptCompiler::StreamedSource::ONE_BYTE) {
30  v8::internal::CopyChars<uint8_t, uint16_t>(dest, src + *src_pos, to_fill);
31  } else {
32  DCHECK(encoding == ScriptCompiler::StreamedSource::TWO_BYTE);
33  v8::internal::CopyChars<uint16_t, uint16_t>(
34  dest, reinterpret_cast<const uint16_t*>(src + *src_pos), to_fill);
35  }
36  *src_pos += to_fill;
37  return to_fill;
38 }
static unsigned CopyChars(uint16_t *dest, unsigned length, const byte *src, unsigned *src_pos, unsigned src_length)
#define DCHECK(condition)
Definition: logging.h:205
unsigned short uint16_t
Definition: unicode.cc:23

References v8::internal::Utf8ToUtf16CharacterStream::CopyChars(), DCHECK, v8::ScriptCompiler::StreamedSource::ONE_BYTE, v8::ScriptCompiler::StreamedSource::TWO_BYTE, and v8::ScriptCompiler::StreamedSource::UTF8.

Referenced by v8::internal::ExternalStreamingStream::FillBuffer(), and v8::internal::ExternalStreamingStream::HandleUtf8SplitCharacters().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: