V8 Project
v8::internal::BufferedUtf16CharacterStream Class Referenceabstract

#include <scanner-character-streams.h>

+ Inheritance diagram for v8::internal::BufferedUtf16CharacterStream:
+ Collaboration diagram for v8::internal::BufferedUtf16CharacterStream:

Public Member Functions

 BufferedUtf16CharacterStream ()
 
virtual ~BufferedUtf16CharacterStream ()
 
virtual void PushBack (uc32 character)
 
- Public Member Functions inherited from v8::internal::Utf16CharacterStream
 Utf16CharacterStream ()
 
virtual ~Utf16CharacterStream ()
 
uc32 Advance ()
 
unsigned pos () const
 
unsigned SeekForward (unsigned code_unit_count)
 

Protected Member Functions

virtual unsigned SlowSeekForward (unsigned delta)
 
virtual bool ReadBlock ()
 
virtual void SlowPushBack (uc16 character)
 
virtual unsigned BufferSeekForward (unsigned delta)=0
 
virtual unsigned FillBuffer (unsigned position)=0
 

Protected Attributes

const uc16pushback_limit_
 
uc16 buffer_ [kBufferSize]
 
- Protected Attributes inherited from v8::internal::Utf16CharacterStream
const uint16_t * buffer_cursor_
 
const uint16_t * buffer_end_
 
unsigned pos_
 

Static Protected Attributes

static const unsigned kBufferSize = 512
 
static const unsigned kPushBackStepSize = 16
 
- Static Protected Attributes inherited from v8::internal::Utf16CharacterStream
static const uc32 kEndOfInput = -1
 

Detailed Description

Definition at line 16 of file scanner-character-streams.h.

Constructor & Destructor Documentation

◆ BufferedUtf16CharacterStream()

v8::internal::BufferedUtf16CharacterStream::BufferedUtf16CharacterStream ( )

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

49  // Initialize buffer as being empty. First read will fill the buffer.
52 }
const uint16_t * buffer_end_
Definition: scanner.h:103
const uint16_t * buffer_cursor_
Definition: scanner.h:102
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

References buffer_, v8::internal::Utf16CharacterStream::buffer_cursor_, and v8::internal::Utf16CharacterStream::buffer_end_.

◆ ~BufferedUtf16CharacterStream()

v8::internal::BufferedUtf16CharacterStream::~BufferedUtf16CharacterStream ( )
virtual

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

55 { }

Member Function Documentation

◆ BufferSeekForward()

virtual unsigned v8::internal::BufferedUtf16CharacterStream::BufferSeekForward ( unsigned  delta)
protectedpure virtual

Implemented in v8::internal::ExternalStreamingStream, v8::internal::Utf8ToUtf16CharacterStream, and v8::internal::GenericStringUtf16CharacterStream.

Referenced by SlowSeekForward().

+ Here is the caller graph for this function:

◆ FillBuffer()

virtual unsigned v8::internal::BufferedUtf16CharacterStream::FillBuffer ( unsigned  position)
protectedpure virtual

Implemented in v8::internal::ExternalStreamingStream, v8::internal::GenericStringUtf16CharacterStream, and v8::internal::Utf8ToUtf16CharacterStream.

Referenced by ReadBlock().

+ Here is the caller graph for this function:

◆ PushBack()

void v8::internal::BufferedUtf16CharacterStream::PushBack ( uc32  character)
virtual

Implements v8::internal::Utf16CharacterStream.

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

57  {
58  if (character == kEndOfInput) {
59  pos_--;
60  return;
61  }
63  // buffer_ is writable, buffer_cursor_ is const pointer.
64  buffer_[--buffer_cursor_ - buffer_] = static_cast<uc16>(character);
65  pos_--;
66  return;
67  }
68  SlowPushBack(static_cast<uc16>(character));
69 }
static const uc32 kEndOfInput
Definition: scanner.h:93
uint16_t uc16
Definition: globals.h:184

References buffer_, v8::internal::Utf16CharacterStream::buffer_cursor_, v8::internal::Utf16CharacterStream::kEndOfInput, NULL, v8::internal::Utf16CharacterStream::pos_, pushback_limit_, and SlowPushBack().

+ Here is the call graph for this function:

◆ ReadBlock()

bool v8::internal::BufferedUtf16CharacterStream::ReadBlock ( )
protectedvirtual

Implements v8::internal::Utf16CharacterStream.

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

98  {
100  if (pushback_limit_ != NULL) {
101  // Leave pushback mode.
104  // If there were any valid characters left at the
105  // start of the buffer, use those.
106  if (buffer_cursor_ < buffer_end_) return true;
107  // Otherwise read a new block.
108  }
109  unsigned length = FillBuffer(pos_);
110  buffer_end_ = buffer_ + length;
111  return length > 0;
112 }
virtual unsigned FillBuffer(unsigned position)=0

References buffer_, v8::internal::Utf16CharacterStream::buffer_cursor_, v8::internal::Utf16CharacterStream::buffer_end_, FillBuffer(), NULL, v8::internal::Utf16CharacterStream::pos_, and pushback_limit_.

Referenced by v8::internal::GenericStringUtf16CharacterStream::BufferSeekForward(), v8::internal::Utf8ToUtf16CharacterStream::BufferSeekForward(), and v8::internal::Utf8ToUtf16CharacterStream::Utf8ToUtf16CharacterStream().

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

◆ SlowPushBack()

void v8::internal::BufferedUtf16CharacterStream::SlowPushBack ( uc16  character)
protectedvirtual

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

72  {
73  // In pushback mode, the end of the buffer contains pushback,
74  // and the start of the buffer (from buffer start to pushback_limit_)
75  // contains valid data that comes just after the pushback.
76  // We NULL the pushback_limit_ if pushing all the way back to the
77  // start of the buffer.
78 
79  if (pushback_limit_ == NULL) {
80  // Enter pushback mode.
84  }
85  // Ensure that there is room for at least one pushback.
87  DCHECK(pos_ > 0);
88  buffer_[--buffer_cursor_ - buffer_] = character;
89  if (buffer_cursor_ == buffer_) {
91  } else if (buffer_cursor_ < pushback_limit_) {
93  }
94  pos_--;
95 }
#define DCHECK(condition)
Definition: logging.h:205

References buffer_, v8::internal::Utf16CharacterStream::buffer_cursor_, v8::internal::Utf16CharacterStream::buffer_end_, DCHECK, kBufferSize, NULL, v8::internal::Utf16CharacterStream::pos_, and pushback_limit_.

Referenced by PushBack().

+ Here is the caller graph for this function:

◆ SlowSeekForward()

unsigned v8::internal::BufferedUtf16CharacterStream::SlowSeekForward ( unsigned  delta)
protectedvirtual

Implements v8::internal::Utf16CharacterStream.

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

115  {
116  // Leave pushback mode (i.e., ignore that there might be valid data
117  // in the buffer before the pushback_limit_ point).
119  return BufferSeekForward(delta);
120 }
virtual unsigned BufferSeekForward(unsigned delta)=0

References BufferSeekForward(), NULL, and pushback_limit_.

+ Here is the call graph for this function:

Member Data Documentation

◆ buffer_

◆ kBufferSize

◆ kPushBackStepSize

const unsigned v8::internal::BufferedUtf16CharacterStream::kPushBackStepSize = 16
staticprotected

Definition at line 25 of file scanner-character-streams.h.

◆ pushback_limit_

const uc16* v8::internal::BufferedUtf16CharacterStream::pushback_limit_
protected

Definition at line 34 of file scanner-character-streams.h.

Referenced by PushBack(), ReadBlock(), SlowPushBack(), and SlowSeekForward().


The documentation for this class was generated from the following files: