5#ifndef V8_PARSING_PREPARSE_DATA_H_
6#define V8_PARSING_PREPARSE_DATA_H_
73 static constexpr int kMagicValue = 0xC0DE0DE;
78 static constexpr size_t kVarint32EndMarker = 0xF1;
80 static constexpr size_t kQuarterMarker = 0xF2;
102 std::vector<void*>* children_buffer);
115 : preparser_(preparser),
builder_(nullptr) {}
121 int function_length,
int num_inner_functions);
138 : byte_data_(nullptr),
index_(0), free_quarters_in_last_byte_(0) {}
140 void Start(std::vector<uint8_t>* buffer);
141 void Finalize(
Zone* zone);
145 int children_length);
148 void Reserve(
size_t bytes);
149 void Add(uint8_t
byte);
152 void WriteVarint32(uint32_t data);
153 void WriteUint8(uint8_t data);
154 void WriteQuarter(uint8_t data);
157 void WriteUint32(uint32_t data);
159 void SaveCurrentSizeAtFirstUint32();
176 bool is_finalized_ =
false;
197 bool ThisOrParentBailedOut()
const {
198 if (bailed_out_)
return true;
199 if (
parent_ ==
nullptr)
return false;
200 return parent_->ThisOrParentBailedOut();
204 bool HasInnerFunctions()
const;
205 bool HasData()
const;
206 bool HasDataForParent()
const;
208 static bool ScopeNeedsData(Scope* scope);
217 void FinalizeChildren(
Zone* zone);
220 void SaveDataForScope(
Scope* scope);
221 void SaveDataForVariable(
Variable* var);
222 void SaveDataForInnerScopes(
Scope* scope);
244 bool finalized_children_ =
false;
289 static std::unique_ptr<ConsumedPreparseData>
For(
Zone* zone,
298 Zone* zone,
int start_position,
int* end_position,
int* num_parameters,
299 int* function_length,
int* num_inner_functions,
bool* uses_super_property,
ConsumedPreparseData()=default
ConsumedPreparseData & operator=(const ConsumedPreparseData &)=delete
virtual ~ConsumedPreparseData()=default
ConsumedPreparseData(const ConsumedPreparseData &)=delete
virtual void RestoreScopeAllocationData(DeclarationScope *scope, AstValueFactory *ast_value_factory, Zone *zone)=0
static V8_EXPORT_PRIVATE std::unique_ptr< ConsumedPreparseData > For(Isolate *isolate, Handle< PreparseData > data)
virtual ProducedPreparseData * GetDataForSkippableFunction(Zone *zone, int start_position, int *end_position, int *num_parameters, int *function_length, int *num_inner_functions, bool *uses_super_property, LanguageMode *language_mode)=0
base::Vector< uint8_t > zone_byte_data_
uint8_t free_quarters_in_last_byte_
std::vector< uint8_t > * byte_data_
DataGatheringScope(const DataGatheringScope &)=delete
DataGatheringScope & operator=(const DataGatheringScope &)=delete
DataGatheringScope(PreParser *preparser)
PreparseDataBuilder * builder_
base::Vector< PreparseDataBuilder * > children_
void CopyByteData(Zone *zone)
DeclarationScope * function_scope_
PreparseDataBuilder * parent_
ScopedPtrList< PreparseDataBuilder > children_buffer_
PreparseDataBuilder & operator=(const PreparseDataBuilder &)=delete
PreparseDataBuilder * parent() const
PreparseDataBuilder(const PreparseDataBuilder &)=delete
virtual ZonePreparseData * Serialize(Zone *zone)=0
virtual Handle< PreparseData > Serialize(LocalIsolate *isolate)=0
static ProducedPreparseData * For(PreparseDataBuilder *builder, Zone *zone)
virtual Handle< PreparseData > Serialize(Isolate *isolate)=0
BytecodeSequenceNode * parent_
#define V8_EXPORT_PRIVATE
static constexpr size_t kVarint32MaxSize
static constexpr size_t kUint32Size
static const size_t kSkippableFunctionMinDataSize
static constexpr size_t kPlaceholderSize
static const size_t kSkippableFunctionMaxDataSize
static constexpr size_t kUint8Size
static constexpr size_t kVarint32MinSize