v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
v8::internal::JsonParser< Char > Class Template Referencefinal

#include <json-parser.h>

Collaboration diagram for v8::internal::JsonParser< Char >:

Classes

struct  JsonContinuation
 
class  NamedPropertyIterator
 

Public Types

using SeqString = typename CharTraits<Char>::String
 
using SeqExternalString = typename CharTraits<Char>::ExternalString
 

Static Public Member Functions

static V8_WARN_UNUSED_RESULT bool CheckRawJson (Isolate *isolate, Handle< String > source)
 
static V8_WARN_UNUSED_RESULT MaybeHandle< ObjectParse (Isolate *isolate, Handle< String > source, Handle< Object > reviver)
 

Static Public Attributes

static constexpr base::uc32 kEndOfString = static_cast<base::uc32>(-1)
 
static constexpr base::uc32 kInvalidUnicodeCharacter
 

Private Types

template<typename T >
using SmallVector = base::SmallVector<T, 16>
 

Private Member Functions

 JsonParser (Isolate *isolate, Handle< String > source)
 
 ~JsonParser ()
 
MaybeHandle< ObjectParseJson (DirectHandle< Object > reviver)
 
bool ParseRawJson ()
 
void advance ()
 
base::uc32 CurrentCharacter ()
 
base::uc32 NextCharacter ()
 
void AdvanceToNonDecimal ()
 
V8_INLINE JsonToken peek () const
 
void Consume (JsonToken token)
 
void Expect (JsonToken token, std::optional< MessageTemplate > errorMessage=std::nullopt)
 
void ExpectNext (JsonToken token, std::optional< MessageTemplate > errorMessage=std::nullopt)
 
bool Check (JsonToken token)
 
template<size_t N>
void ScanLiteral (const char(&s)[N])
 
void SkipWhitespace ()
 
JsonString ScanJsonString (bool needs_internalization)
 
JsonString ScanJsonPropertyKey (JsonContinuation *cont)
 
base::uc32 ScanUnicodeCharacter ()
 
base::Vector< const Char > GetKeyChars (JsonString key)
 
Handle< StringMakeString (const JsonString &string, Handle< String > hint=Handle< String >())
 
template<typename SinkChar >
void DecodeString (SinkChar *sink, uint32_t start, uint32_t length)
 
template<typename SinkSeqString >
Handle< StringDecodeString (const JsonString &string, Handle< SinkSeqString > intermediate, Handle< String > hint)
 
Handle< ObjectParseJsonNumber ()
 
bool ParseJsonNumberAsDoubleOrSmi (double *result_double, int *result_smi)
 
template<bool should_track_json_source>
MaybeHandle< ObjectParseJsonValue ()
 
V8_INLINE MaybeHandle< ObjectParseJsonValueRecursive (Handle< Map > feedback={})
 
MaybeHandle< ObjectParseJsonArray ()
 
MaybeHandle< ObjectParseJsonObject (Handle< Map > feedback)
 
template<bool should_track_json_source>
Handle< JSObjectBuildJsonObject (const JsonContinuation &cont, DirectHandle< Map > feedback)
 
Handle< ObjectBuildJsonArray (size_t start)
 
void ReportUnexpectedCharacter (base::uc32 c)
 
bool IsSpecialString ()
 
MessageTemplate GetErrorMessageWithEllipses (DirectHandle< Object > &arg, DirectHandle< Object > &arg2, int pos)
 
MessageTemplate LookUpErrorMessageForJsonToken (JsonToken token, DirectHandle< Object > &arg, DirectHandle< Object > &arg2, int pos)
 
void CalculateFileLocation (DirectHandle< Object > &line, DirectHandle< Object > &column)
 
void ReportUnexpectedToken (JsonToken token, std::optional< MessageTemplate > errorMessage=std::nullopt)
 
Isolateisolate ()
 
Factoryfactory ()
 
ReadOnlyRoots roots ()
 
DirectHandle< JSFunctionobject_constructor ()
 
void UpdatePointers ()
 
bool is_at_end () const
 
uint32_t position () const
 

Static Private Member Functions

static void UpdatePointersCallback (void *parser)
 

Private Attributes

Isolateisolate_
 
const uint64_t hash_seed_
 
JsonToken next_
 
bool chars_may_relocate_
 
Handle< JSFunctionobject_constructor_
 
const Handle< Stringoriginal_source_
 
Handle< Stringsource_
 
MaybeHandle< Objectparsed_val_node_
 
SmallVector< Handle< Object > > element_stack_
 
SmallVector< JsonPropertyproperty_stack_
 
SmallVector< double > double_elements_
 
SmallVector< int > smi_elements_
 
const Char * cursor_
 
const Char * end_
 
const Char * chars_
 

Static Private Attributes

static const int kMaxContextCharacters = 10
 
static const int kMinOriginalSourceLengthForContext
 
static const int kInitialSpecialStringLength = 32
 
static const bool kIsOneByte = sizeof(Char) == 1
 

Detailed Description

template<typename Char>
class v8::internal::JsonParser< Char >

Definition at line 155 of file json-parser.h.

Member Typedef Documentation

◆ SeqExternalString

template<typename Char >
using v8::internal::JsonParser< Char >::SeqExternalString = typename CharTraits<Char>::ExternalString

Definition at line 158 of file json-parser.h.

◆ SeqString

template<typename Char >
using v8::internal::JsonParser< Char >::SeqString = typename CharTraits<Char>::String

Definition at line 157 of file json-parser.h.

◆ SmallVector

template<typename Char >
template<typename T >
using v8::internal::JsonParser< Char >::SmallVector = base::SmallVector<T, 16>
private

Definition at line 191 of file json-parser.h.

Constructor & Destructor Documentation

◆ JsonParser()

template<typename Char >
v8::internal::JsonParser< Char >::JsonParser ( Isolate * isolate,
Handle< String > source )
private

Definition at line 303 of file json-parser.cc.

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

◆ ~JsonParser()

template<typename Char >
v8::internal::JsonParser< Char >::~JsonParser ( )
private

Definition at line 517 of file json-parser.cc.

Here is the call graph for this function:

Member Function Documentation

◆ advance()

template<typename Char >
void v8::internal::JsonParser< Char >::advance ( )
inlineprivate

Definition at line 220 of file json-parser.h.

Here is the caller graph for this function:

◆ AdvanceToNonDecimal()

template<typename Char >
void v8::internal::JsonParser< Char >::AdvanceToNonDecimal ( )
private

Definition at line 1960 of file json-parser.cc.

Here is the call graph for this function:

◆ BuildJsonArray()

template<typename Char >
Handle< Object > v8::internal::JsonParser< Char >::BuildJsonArray ( size_t start)
private

Definition at line 1357 of file json-parser.cc.

Here is the call graph for this function:

◆ BuildJsonObject()

template<typename Char >
template<bool should_track_json_source>
Handle< JSObject > v8::internal::JsonParser< Char >::BuildJsonObject ( const JsonContinuation & cont,
DirectHandle< Map > feedback )
private

Definition at line 1289 of file json-parser.cc.

Here is the call graph for this function:

◆ CalculateFileLocation()

template<typename Char >
void v8::internal::JsonParser< Char >::CalculateFileLocation ( DirectHandle< Object > & line,
DirectHandle< Object > & column )
private

Definition at line 432 of file json-parser.cc.

Here is the call graph for this function:

◆ Check()

template<typename Char >
bool v8::internal::JsonParser< Char >::Check ( JsonToken token)
inlineprivate

Definition at line 257 of file json-parser.h.

Here is the call graph for this function:

◆ CheckRawJson()

template<typename Char >
static V8_WARN_UNUSED_RESULT bool v8::internal::JsonParser< Char >::CheckRawJson ( Isolate * isolate,
Handle< String > source )
inlinestatic

Definition at line 160 of file json-parser.h.

Here is the call graph for this function:

◆ Consume()

template<typename Char >
void v8::internal::JsonParser< Char >::Consume ( JsonToken token)
inlineprivate

Definition at line 236 of file json-parser.h.

Here is the call graph for this function:

◆ CurrentCharacter()

template<typename Char >
base::uc32 v8::internal::JsonParser< Char >::CurrentCharacter ( )
inlineprivate

Definition at line 222 of file json-parser.h.

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

◆ DecodeString() [1/2]

template<typename Char >
template<typename SinkSeqString >
Handle< String > v8::internal::JsonParser< Char >::DecodeString ( const JsonString & string,
Handle< SinkSeqString > intermediate,
Handle< String > hint )
private

Definition at line 2090 of file json-parser.cc.

Here is the call graph for this function:

◆ DecodeString() [2/2]

template<typename Char >
template<typename SinkChar >
void v8::internal::JsonParser< Char >::DecodeString ( SinkChar * sink,
uint32_t start,
uint32_t length )
private

Definition at line 2156 of file json-parser.cc.

Here is the call graph for this function:

◆ Expect()

template<typename Char >
void v8::internal::JsonParser< Char >::Expect ( JsonToken token,
std::optional< MessageTemplate > errorMessage = std::nullopt )
inlineprivate

Definition at line 241 of file json-parser.h.

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

◆ ExpectNext()

template<typename Char >
void v8::internal::JsonParser< Char >::ExpectNext ( JsonToken token,
std::optional< MessageTemplate > errorMessage = std::nullopt )
inlineprivate

Definition at line 251 of file json-parser.h.

Here is the call graph for this function:

◆ factory()

template<typename Char >
Factory * v8::internal::JsonParser< Char >::factory ( )
inlineprivate

Definition at line 370 of file json-parser.h.

Here is the call graph for this function:

◆ GetErrorMessageWithEllipses()

template<typename Char >
MessageTemplate v8::internal::JsonParser< Char >::GetErrorMessageWithEllipses ( DirectHandle< Object > & arg,
DirectHandle< Object > & arg2,
int pos )
private

Definition at line 363 of file json-parser.cc.

Here is the call graph for this function:

◆ GetKeyChars()

template<typename Char >
base::Vector< const Char > v8::internal::JsonParser< Char >::GetKeyChars ( JsonString key)
inlineprivate

Definition at line 303 of file json-parser.h.

◆ is_at_end()

template<typename Char >
bool v8::internal::JsonParser< Char >::is_at_end ( ) const
inlineprivate

Definition at line 397 of file json-parser.h.

Here is the caller graph for this function:

◆ isolate()

template<typename Char >
Isolate * v8::internal::JsonParser< Char >::isolate ( )
inlineprivate

Definition at line 369 of file json-parser.h.

◆ IsSpecialString()

template<typename Char >
bool v8::internal::JsonParser< Char >::IsSpecialString ( )
private

Definition at line 338 of file json-parser.cc.

Here is the call graph for this function:

◆ LookUpErrorMessageForJsonToken()

template<typename Char >
MessageTemplate v8::internal::JsonParser< Char >::LookUpErrorMessageForJsonToken ( JsonToken token,
DirectHandle< Object > & arg,
DirectHandle< Object > & arg2,
int pos )
private

Definition at line 404 of file json-parser.cc.

◆ MakeString()

template<typename Char >
Handle< String > v8::internal::JsonParser< Char >::MakeString ( const JsonString & string,
Handle< String > hint = Handle<String>() )
private

Definition at line 2115 of file json-parser.cc.

Here is the call graph for this function:

◆ NextCharacter()

template<typename Char >
base::uc32 v8::internal::JsonParser< Char >::NextCharacter ( )
inlineprivate

Definition at line 227 of file json-parser.h.

Here is the call graph for this function:

◆ object_constructor()

template<typename Char >
DirectHandle< JSFunction > v8::internal::JsonParser< Char >::object_constructor ( )
inlineprivate

Definition at line 372 of file json-parser.h.

◆ Parse()

template<typename Char >
static V8_WARN_UNUSED_RESULT MaybeHandle< Object > v8::internal::JsonParser< Char >::Parse ( Isolate * isolate,
Handle< String > source,
Handle< Object > reviver )
inlinestatic

Definition at line 165 of file json-parser.h.

Here is the call graph for this function:

◆ ParseJson()

template<typename Char >
MaybeHandle< Object > v8::internal::JsonParser< Char >::ParseJson ( DirectHandle< Object > reviver)
private

Definition at line 532 of file json-parser.cc.

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

◆ ParseJsonArray()

template<typename Char >
MaybeHandle< Object > v8::internal::JsonParser< Char >::ParseJsonArray ( )
private

Definition at line 1517 of file json-parser.cc.

Here is the call graph for this function:

◆ ParseJsonNumber()

template<typename Char >
Handle< Object > v8::internal::JsonParser< Char >::ParseJsonNumber ( )
private

Definition at line 1966 of file json-parser.cc.

Here is the call graph for this function:

◆ ParseJsonNumberAsDoubleOrSmi()

template<typename Char >
bool v8::internal::JsonParser< Char >::ParseJsonNumberAsDoubleOrSmi ( double * result_double,
int * result_smi )
private

Definition at line 1976 of file json-parser.cc.

Here is the call graph for this function:

◆ ParseJsonObject()

template<typename Char >
MaybeHandle< Object > v8::internal::JsonParser< Char >::ParseJsonObject ( Handle< Map > feedback)
private

Definition at line 1480 of file json-parser.cc.

Here is the call graph for this function:

◆ ParseJsonValue()

template<typename Char >
template<bool should_track_json_source>
MaybeHandle< Object > v8::internal::JsonParser< Char >::ParseJsonValue ( )
private

Definition at line 1634 of file json-parser.cc.

Here is the call graph for this function:

◆ ParseJsonValueRecursive()

template<typename Char >
V8_INLINE MaybeHandle< Object > v8::internal::JsonParser< Char >::ParseJsonValueRecursive ( Handle< Map > feedback = {})
private

Definition at line 1439 of file json-parser.cc.

Here is the call graph for this function:

◆ ParseRawJson()

template<typename Char >
bool v8::internal::JsonParser< Char >::ParseRawJson ( )
private

Definition at line 1396 of file json-parser.cc.

Here is the call graph for this function:

◆ peek()

template<typename Char >
V8_INLINE JsonToken v8::internal::JsonParser< Char >::peek ( ) const
inlineprivate

Definition at line 234 of file json-parser.h.

Here is the caller graph for this function:

◆ position()

template<typename Char >
uint32_t v8::internal::JsonParser< Char >::position ( ) const
inlineprivate

Definition at line 402 of file json-parser.h.

Here is the caller graph for this function:

◆ ReportUnexpectedCharacter()

template<typename Char >
void v8::internal::JsonParser< Char >::ReportUnexpectedCharacter ( base::uc32 c)
private

Definition at line 506 of file json-parser.cc.

Here is the caller graph for this function:

◆ ReportUnexpectedToken()

template<typename Char >
void v8::internal::JsonParser< Char >::ReportUnexpectedToken ( JsonToken token,
std::optional< MessageTemplate > errorMessage = std::nullopt )
private

Definition at line 462 of file json-parser.cc.

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

◆ roots()

template<typename Char >
ReadOnlyRoots v8::internal::JsonParser< Char >::roots ( )
inlineprivate

Definition at line 371 of file json-parser.h.

◆ ScanJsonPropertyKey()

template<typename Char >
JsonString v8::internal::JsonParser< Char >::ScanJsonPropertyKey ( JsonContinuation * cont)
private

Definition at line 592 of file json-parser.cc.

Here is the call graph for this function:

◆ ScanJsonString()

template<typename Char >
JsonString v8::internal::JsonParser< Char >::ScanJsonString ( bool needs_internalization)
private

Definition at line 2220 of file json-parser.cc.

Here is the call graph for this function:

◆ ScanLiteral()

template<typename Char >
template<size_t N>
void v8::internal::JsonParser< Char >::ScanLiteral ( const char(&) s[N])
inlineprivate

Definition at line 265 of file json-parser.h.

Here is the call graph for this function:

◆ ScanUnicodeCharacter()

template<typename Char >
base::uc32 v8::internal::JsonParser< Char >::ScanUnicodeCharacter ( )
private

Definition at line 580 of file json-parser.cc.

Here is the call graph for this function:

◆ SkipWhitespace()

template<typename Char >
void v8::internal::JsonParser< Char >::SkipWhitespace ( )
private

Definition at line 566 of file json-parser.cc.

Here is the caller graph for this function:

◆ UpdatePointers()

template<typename Char >
void v8::internal::JsonParser< Char >::UpdatePointers ( )
inlineprivate

Definition at line 382 of file json-parser.h.

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

◆ UpdatePointersCallback()

template<typename Char >
static void v8::internal::JsonParser< Char >::UpdatePointersCallback ( void * parser)
inlinestaticprivate

Definition at line 378 of file json-parser.h.

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

Member Data Documentation

◆ chars_

template<typename Char >
const Char* v8::internal::JsonParser< Char >::chars_
private

Definition at line 428 of file json-parser.h.

◆ chars_may_relocate_

template<typename Char >
bool v8::internal::JsonParser< Char >::chars_may_relocate_
private

Definition at line 408 of file json-parser.h.

◆ cursor_

template<typename Char >
const Char* v8::internal::JsonParser< Char >::cursor_
private

Definition at line 426 of file json-parser.h.

◆ double_elements_

template<typename Char >
SmallVector<double> v8::internal::JsonParser< Char >::double_elements_
private

Definition at line 418 of file json-parser.h.

◆ element_stack_

template<typename Char >
SmallVector<Handle<Object> > v8::internal::JsonParser< Char >::element_stack_
private

Definition at line 416 of file json-parser.h.

◆ end_

template<typename Char >
const Char* v8::internal::JsonParser< Char >::end_
private

Definition at line 427 of file json-parser.h.

◆ hash_seed_

template<typename Char >
const uint64_t v8::internal::JsonParser< Char >::hash_seed_
private

Definition at line 405 of file json-parser.h.

◆ isolate_

template<typename Char >
Isolate* v8::internal::JsonParser< Char >::isolate_
private

Definition at line 404 of file json-parser.h.

◆ kEndOfString

template<typename Char >
base::uc32 v8::internal::JsonParser< Char >::kEndOfString = static_cast<base::uc32>(-1)
staticconstexpr

Definition at line 183 of file json-parser.h.

◆ kInitialSpecialStringLength

template<typename Char >
const int v8::internal::JsonParser< Char >::kInitialSpecialStringLength = 32
staticprivate

Definition at line 376 of file json-parser.h.

◆ kInvalidUnicodeCharacter

template<typename Char >
base::uc32 v8::internal::JsonParser< Char >::kInvalidUnicodeCharacter
staticconstexpr
Initial value:
=
static_cast<base::uc32>(-1)
uint32_t uc32
Definition strings.h:19

Definition at line 184 of file json-parser.h.

◆ kIsOneByte

template<typename Char >
const bool v8::internal::JsonParser< Char >::kIsOneByte = sizeof(Char) == 1
staticprivate

Definition at line 395 of file json-parser.h.

◆ kMaxContextCharacters

template<typename Char >
const int v8::internal::JsonParser< Char >::kMaxContextCharacters = 10
staticprivate

Definition at line 345 of file json-parser.h.

◆ kMinOriginalSourceLengthForContext

template<typename Char >
const int v8::internal::JsonParser< Char >::kMinOriginalSourceLengthForContext
staticprivate
Initial value:
=
static const int kMaxContextCharacters

Definition at line 346 of file json-parser.h.

◆ next_

template<typename Char >
JsonToken v8::internal::JsonParser< Char >::next_
private

Definition at line 406 of file json-parser.h.

◆ object_constructor_

template<typename Char >
Handle<JSFunction> v8::internal::JsonParser< Char >::object_constructor_
private

Definition at line 409 of file json-parser.h.

◆ original_source_

template<typename Char >
const Handle<String> v8::internal::JsonParser< Char >::original_source_
private

Definition at line 410 of file json-parser.h.

◆ parsed_val_node_

template<typename Char >
MaybeHandle<Object> v8::internal::JsonParser< Char >::parsed_val_node_
private

Definition at line 414 of file json-parser.h.

◆ property_stack_

template<typename Char >
SmallVector<JsonProperty> v8::internal::JsonParser< Char >::property_stack_
private

Definition at line 417 of file json-parser.h.

◆ smi_elements_

template<typename Char >
SmallVector<int> v8::internal::JsonParser< Char >::smi_elements_
private

Definition at line 419 of file json-parser.h.

◆ source_

template<typename Char >
Handle<String> v8::internal::JsonParser< Char >::source_
private

Definition at line 411 of file json-parser.h.


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