V8 Project
v8::internal::CompleteParserRecorder Class Reference

#include <preparse-data.h>

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

Classes

struct  Key
 

Public Member Functions

 CompleteParserRecorder ()
 
virtual ~CompleteParserRecorder ()
 
virtual void LogFunction (int start, int end, int literals, int properties, StrictMode strict_mode)
 
virtual void LogMessage (int start, int end, const char *message, const char *argument_opt, bool is_reference_error_)
 
ScriptDataGetScriptData ()
 
bool HasError ()
 
Vector< unsigned > ErrorMessageData ()
 
- Public Member Functions inherited from v8::internal::ParserRecorder
 ParserRecorder ()
 
virtual ~ParserRecorder ()
 

Private Member Functions

void WriteString (Vector< const char > str)
 
void WriteNumber (int number)
 

Private Attributes

Collector< unsigned > function_store_
 
unsigned preamble_ [PreparseDataConstants::kHeaderSize]
 

Detailed Description

Definition at line 124 of file preparse-data.h.

Constructor & Destructor Documentation

◆ CompleteParserRecorder()

v8::internal::CompleteParserRecorder::CompleteParserRecorder ( )

Definition at line 17 of file preparse-data.cc.

18  : function_store_(0) {
27 #ifdef DEBUG
28  prev_start_ = -1;
29 #endif
30 }
unsigned preamble_[PreparseDataConstants::kHeaderSize]
Collector< unsigned > function_store_
#define DCHECK_EQ(v1, v2)
Definition: logging.h:206

References DCHECK_EQ, v8::internal::PreparseDataConstants::kCurrentVersion, v8::internal::PreparseDataConstants::kFunctionsSizeOffset, v8::internal::PreparseDataConstants::kHasErrorOffset, v8::internal::PreparseDataConstants::kHeaderSize, v8::internal::PreparseDataConstants::kMagicNumber, v8::internal::PreparseDataConstants::kMagicOffset, v8::internal::PreparseDataConstants::kSizeOffset, v8::internal::PreparseDataConstants::kVersionOffset, and preamble_.

◆ ~CompleteParserRecorder()

virtual v8::internal::CompleteParserRecorder::~CompleteParserRecorder ( )
inlinevirtual

Definition at line 132 of file preparse-data.h.

132 {}

Member Function Documentation

◆ ErrorMessageData()

Vector<unsigned> v8::internal::CompleteParserRecorder::ErrorMessageData ( )
inline

Definition at line 159 of file preparse-data.h.

159  {
160  DCHECK(HasError());
161  return function_store_.ToVector();
162  }
Vector< T > ToVector()
Definition: utils.h:551
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK, function_store_, HasError(), and v8::internal::Collector< T, growth_factor, max_growth >::ToVector().

+ Here is the call graph for this function:

◆ GetScriptData()

ScriptData * v8::internal::CompleteParserRecorder::GetScriptData ( )

Definition at line 63 of file preparse-data.cc.

63  {
64  int function_size = function_store_.size();
65  int total_size = PreparseDataConstants::kHeaderSize + function_size;
66  unsigned* data = NewArray<unsigned>(total_size);
68  MemCopy(data, preamble_, sizeof(preamble_));
69  if (function_size > 0) {
70  function_store_.WriteTo(Vector<unsigned>(
71  data + PreparseDataConstants::kHeaderSize, function_size));
72  }
73  DCHECK(IsAligned(reinterpret_cast<intptr_t>(data), kPointerAlignment));
74  ScriptData* result = new ScriptData(reinterpret_cast<byte*>(data),
75  total_size * sizeof(unsigned));
76  result->AcquireDataOwnership();
77  return result;
78 }
void WriteTo(Vector< T > destination)
Definition: utils.h:531
bool IsAligned(T value, U alignment)
Definition: utils.h:123
void MemCopy(void *dest, const void *src, size_t size)
Definition: utils.h:350
const intptr_t kPointerAlignment
Definition: globals.h:230

References v8::internal::ScriptData::AcquireDataOwnership(), DCHECK, function_store_, v8::internal::IsAligned(), v8::internal::PreparseDataConstants::kFunctionsSizeOffset, v8::internal::PreparseDataConstants::kHeaderSize, v8::internal::kPointerAlignment, v8::internal::MemCopy(), preamble_, v8::internal::Collector< T, growth_factor, max_growth >::size(), and v8::internal::Collector< T, growth_factor, max_growth >::WriteTo().

Referenced by v8::internal::Parser::ParseOnBackground(), and v8::internal::Parser::ParseProgram().

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

◆ HasError()

bool v8::internal::CompleteParserRecorder::HasError ( )
inline

Definition at line 156 of file preparse-data.h.

156  {
157  return static_cast<bool>(preamble_[PreparseDataConstants::kHasErrorOffset]);
158  }

References v8::internal::PreparseDataConstants::kHasErrorOffset, and preamble_.

Referenced by ErrorMessageData(), and LogMessage().

+ Here is the caller graph for this function:

◆ LogFunction()

virtual void v8::internal::CompleteParserRecorder::LogFunction ( int  start,
int  end,
int  literals,
int  properties,
StrictMode  strict_mode 
)
inlinevirtual

Implements v8::internal::ParserRecorder.

Definition at line 134 of file preparse-data.h.

138  {
139  function_store_.Add(start);
140  function_store_.Add(end);
142  function_store_.Add(properties);
143  function_store_.Add(strict_mode);
144  }
void Add(T value)
Definition: utils.h:484
enable harmony numeric literals(0o77, 0b11)") DEFINE_BOOL(harmony_object_literals

References v8::internal::Collector< T, growth_factor, max_growth >::Add(), function_store_, and literals().

+ Here is the call graph for this function:

◆ LogMessage()

void v8::internal::CompleteParserRecorder::LogMessage ( int  start,
int  end,
const char *  message,
const char *  argument_opt,
bool  is_reference_error_ 
)
virtual

Implements v8::internal::ParserRecorder.

Definition at line 33 of file preparse-data.cc.

37  {
38  if (HasError()) return;
42  function_store_.Add(start_pos);
44  function_store_.Add(end_pos);
46  function_store_.Add((arg_opt == NULL) ? 0 : 1);
48  function_store_.Add(is_reference_error ? 1 : 0);
50  WriteString(CStrVector(message));
51  if (arg_opt != NULL) WriteString(CStrVector(arg_opt));
52 }
virtual void Reset()
Definition: utils-inl.h:14
void WriteString(Vector< const char > str)
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
Vector< const char > CStrVector(const char *data)
Definition: vector.h:158
STATIC_ASSERT(sizeof(CPURegister)==sizeof(Register))

References v8::internal::Collector< T, growth_factor, max_growth >::Add(), v8::internal::CStrVector(), function_store_, HasError(), v8::internal::PreparseDataConstants::kHasErrorOffset, v8::internal::PreparseDataConstants::kIsReferenceErrorPos, v8::internal::PreparseDataConstants::kMessageArgCountPos, v8::internal::PreparseDataConstants::kMessageEndPos, v8::internal::PreparseDataConstants::kMessageStartPos, v8::internal::PreparseDataConstants::kMessageTextPos, NULL, preamble_, v8::internal::Collector< T, growth_factor, max_growth >::Reset(), v8::internal::STATIC_ASSERT(), and WriteString().

+ Here is the call graph for this function:

◆ WriteNumber()

void v8::internal::CompleteParserRecorder::WriteNumber ( int  number)
private

◆ WriteString()

void v8::internal::CompleteParserRecorder::WriteString ( Vector< const char >  str)
private

Definition at line 55 of file preparse-data.cc.

55  {
56  function_store_.Add(str.length());
57  for (int i = 0; i < str.length(); i++) {
58  function_store_.Add(str[i]);
59  }
60 }
int length() const
Definition: vector.h:41

References v8::internal::Collector< T, growth_factor, max_growth >::Add(), function_store_, and v8::internal::Vector< T >::length().

Referenced by LogMessage().

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

Member Data Documentation

◆ function_store_

Collector<unsigned> v8::internal::CompleteParserRecorder::function_store_
private

◆ preamble_

unsigned v8::internal::CompleteParserRecorder::preamble_[PreparseDataConstants::kHeaderSize]
private

Definition at line 171 of file preparse-data.h.

Referenced by CompleteParserRecorder(), GetScriptData(), HasError(), and LogMessage().


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