V8 Project
v8::internal::FlatStringReader Class Reference

#include <objects.h>

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

Public Member Functions

 FlatStringReader (Isolate *isolate, Handle< String > str)
 
 FlatStringReader (Isolate *isolate, Vector< const char > input)
 
void PostGarbageCollection ()
 
uc32 Get (int index)
 
int length ()
 

Private Attributes

String ** str_
 
bool is_one_byte_
 
int length_
 
const void * start_
 

Detailed Description

Definition at line 9256 of file objects.h.

Constructor & Destructor Documentation

◆ FlatStringReader() [1/2]

v8::internal::FlatStringReader::FlatStringReader ( Isolate isolate,
Handle< String str 
)

Definition at line 8162 of file objects.cc.

8163  : Relocatable(isolate),
8164  str_(str.location()),
8165  length_(str->length()) {
8167 }

References PostGarbageCollection().

+ Here is the call graph for this function:

◆ FlatStringReader() [2/2]

v8::internal::FlatStringReader::FlatStringReader ( Isolate isolate,
Vector< const char >  input 
)

Definition at line 8170 of file objects.cc.

8171  : Relocatable(isolate),
8172  str_(0),
8173  is_one_byte_(true),
8174  length_(input.length()),
8175  start_(input.start()) {}
T * start() const
Definition: vector.h:47
int length() const
Definition: vector.h:41

Member Function Documentation

◆ Get()

uc32 v8::internal::FlatStringReader::Get ( int  index)
inline

Definition at line 467 of file objects-inl.h.

467  {
468  DCHECK(0 <= index && index <= length_);
469  if (is_one_byte_) {
470  return static_cast<const byte*>(start_)[index];
471  } else {
472  return static_cast<const uc16*>(start_)[index];
473  }
474 }
#define DCHECK(condition)
Definition: logging.h:205
uint16_t uc16
Definition: globals.h:184

References DCHECK, is_one_byte_, length_, and start_.

◆ length()

int v8::internal::FlatStringReader::length ( )
inline

Definition at line 9262 of file objects.h.

9262 { return length_; }

◆ PostGarbageCollection()

void v8::internal::FlatStringReader::PostGarbageCollection ( )

Definition at line 8178 of file objects.cc.

8178  {
8179  if (str_ == NULL) return;
8180  Handle<String> str(str_);
8181  DCHECK(str->IsFlat());
8182  DisallowHeapAllocation no_gc;
8183  // This does not actually prevent the vector from being relocated later.
8184  String::FlatContent content = str->GetFlatContent();
8185  DCHECK(content.IsFlat());
8186  is_one_byte_ = content.IsOneByte();
8187  if (is_one_byte_) {
8188  start_ = content.ToOneByteVector().start();
8189  } else {
8190  start_ = content.ToUC16Vector().start();
8191  }
8192 }
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
PerThreadAssertScopeDebugOnly< HEAP_ALLOCATION_ASSERT, false > DisallowHeapAllocation
Definition: assert-scope.h:110

References DCHECK, is_one_byte_, v8::internal::String::FlatContent::IsFlat(), v8::internal::String::FlatContent::IsOneByte(), NULL, v8::internal::Vector< T >::start(), start_, str_, v8::internal::String::FlatContent::ToOneByteVector(), and v8::internal::String::FlatContent::ToUC16Vector().

Referenced by FlatStringReader().

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

Member Data Documentation

◆ is_one_byte_

bool v8::internal::FlatStringReader::is_one_byte_
private

Definition at line 9265 of file objects.h.

Referenced by Get(), and PostGarbageCollection().

◆ length_

int v8::internal::FlatStringReader::length_
private

Definition at line 9266 of file objects.h.

Referenced by Get().

◆ start_

const void* v8::internal::FlatStringReader::start_
private

Definition at line 9267 of file objects.h.

Referenced by Get(), and PostGarbageCollection().

◆ str_

String** v8::internal::FlatStringReader::str_
private

Definition at line 9264 of file objects.h.

Referenced by PostGarbageCollection().


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