V8 Project
v8::String::Value Class Reference

Converts an object to a two-byte string. More...

#include <v8.h>

+ Collaboration diagram for v8::String::Value:

Public Member Functions

 Value (Handle< v8::Value > obj)
 
 ~Value ()
 
uint16_t * operator* ()
 
const uint16_t * operator* () const
 
int length () const
 

Private Member Functions

 Value (const Value &)
 
void operator= (const Value &)
 

Private Attributes

uint16_t * str_
 
int length_
 

Detailed Description

Converts an object to a two-byte string.

If conversion to a string fails (eg. due to an exception in the toString() method of the object) then the length() method returns 0 and the * operator returns NULL.

Definition at line 2070 of file v8.h.

Constructor & Destructor Documentation

◆ Value() [1/2]

v8::String::Value::Value ( Handle< v8::Value obj)
explicit

Definition at line 6862 of file api.cc.

6863  : str_(NULL), length_(0) {
6864  i::Isolate* isolate = i::Isolate::Current();
6865  if (obj.IsEmpty()) return;
6866  ENTER_V8(isolate);
6867  i::HandleScope scope(isolate);
6868  TryCatch try_catch;
6869  Handle<String> str = obj->ToString();
6870  if (str.IsEmpty()) return;
6871  length_ = str->Length();
6872  str_ = i::NewArray<uint16_t>(length_ + 1);
6873  str->Write(str_);
6874 }
#define ENTER_V8(isolate)
Definition: api.cc:54
bool IsEmpty() const
Returns true if the handle is empty.
Definition: v8.h:228
uint16_t * str_
Definition: v8.h:2078
Local< String > ToString() const
Definition: api.cc:2584
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 ENTER_V8, v8::Handle< T >::IsEmpty(), length_, str_, and v8::Value::ToString().

+ Here is the call graph for this function:

◆ ~Value()

v8::String::Value::~Value ( )

Definition at line 6877 of file api.cc.

6877  {
6879 }
void DeleteArray(T *array)
Definition: allocation.h:68

References v8::internal::DeleteArray().

+ Here is the call graph for this function:

◆ Value() [2/2]

v8::String::Value::Value ( const Value )
private

Member Function Documentation

◆ length()

int v8::String::Value::length ( ) const
inline

Definition at line 2076 of file v8.h.

2076 { return length_; }

◆ operator*() [1/2]

uint16_t* v8::String::Value::operator* ( )
inline

Definition at line 2074 of file v8.h.

2074 { return str_; }

◆ operator*() [2/2]

const uint16_t* v8::String::Value::operator* ( ) const
inline

Definition at line 2075 of file v8.h.

2075 { return str_; }

◆ operator=()

void v8::String::Value::operator= ( const Value )
private

Member Data Documentation

◆ length_

int v8::String::Value::length_
private

Definition at line 2079 of file v8.h.

Referenced by Value().

◆ str_

uint16_t* v8::String::Value::str_
private

Definition at line 2078 of file v8.h.

Referenced by Value().


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