Commit 512175a3 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[ast] Introduce ZonePtrList<T> typedef for ZoneList<T*>.

This is a preliminary step before changing the way we store zone pointers in the zones.

Bug: v8:7903, v8:7754
Change-Id: I1e1af1823766c888ee0f8fe190f205f5b7e21973
Reviewed-on: https://chromium-review.googlesource.com/1118887Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54193}
parent b1cf1e1e
...@@ -41,7 +41,7 @@ class AstTraversalVisitor : public AstVisitor<Subclass> { ...@@ -41,7 +41,7 @@ class AstTraversalVisitor : public AstVisitor<Subclass> {
// Iteration left-to-right. // Iteration left-to-right.
void VisitDeclarations(Declaration::List* declarations); void VisitDeclarations(Declaration::List* declarations);
void VisitStatements(ZoneList<Statement*>* statements); void VisitStatements(ZonePtrList<Statement>* statements);
// Individual nodes // Individual nodes
#define DECLARE_VISIT(type) void Visit##type(type* node); #define DECLARE_VISIT(type) void Visit##type(type* node);
...@@ -112,7 +112,7 @@ void AstTraversalVisitor<Subclass>::VisitDeclarations( ...@@ -112,7 +112,7 @@ void AstTraversalVisitor<Subclass>::VisitDeclarations(
template <class Subclass> template <class Subclass>
void AstTraversalVisitor<Subclass>::VisitStatements( void AstTraversalVisitor<Subclass>::VisitStatements(
ZoneList<Statement*>* stmts) { ZonePtrList<Statement>* stmts) {
for (int i = 0; i < stmts->length(); ++i) { for (int i = 0; i < stmts->length(); ++i) {
Statement* stmt = stmts->at(i); Statement* stmt = stmts->at(i);
RECURSE(Visit(stmt)); RECURSE(Visit(stmt));
...@@ -198,14 +198,14 @@ void AstTraversalVisitor<Subclass>::VisitSwitchStatement( ...@@ -198,14 +198,14 @@ void AstTraversalVisitor<Subclass>::VisitSwitchStatement(
PROCESS_NODE(stmt); PROCESS_NODE(stmt);
RECURSE(Visit(stmt->tag())); RECURSE(Visit(stmt->tag()));
ZoneList<CaseClause*>* clauses = stmt->cases(); ZonePtrList<CaseClause>* clauses = stmt->cases();
for (int i = 0; i < clauses->length(); ++i) { for (int i = 0; i < clauses->length(); ++i) {
CaseClause* clause = clauses->at(i); CaseClause* clause = clauses->at(i);
if (!clause->is_default()) { if (!clause->is_default()) {
Expression* label = clause->label(); Expression* label = clause->label();
RECURSE(Visit(label)); RECURSE(Visit(label));
} }
ZoneList<Statement*>* stmts = clause->statements(); ZonePtrList<Statement>* stmts = clause->statements();
RECURSE(VisitStatements(stmts)); RECURSE(VisitStatements(stmts));
} }
} }
...@@ -330,7 +330,7 @@ void AstTraversalVisitor<Subclass>::VisitRegExpLiteral(RegExpLiteral* expr) { ...@@ -330,7 +330,7 @@ void AstTraversalVisitor<Subclass>::VisitRegExpLiteral(RegExpLiteral* expr) {
template <class Subclass> template <class Subclass>
void AstTraversalVisitor<Subclass>::VisitObjectLiteral(ObjectLiteral* expr) { void AstTraversalVisitor<Subclass>::VisitObjectLiteral(ObjectLiteral* expr) {
PROCESS_EXPRESSION(expr); PROCESS_EXPRESSION(expr);
ZoneList<ObjectLiteralProperty*>* props = expr->properties(); ZonePtrList<ObjectLiteralProperty>* props = expr->properties();
for (int i = 0; i < props->length(); ++i) { for (int i = 0; i < props->length(); ++i) {
ObjectLiteralProperty* prop = props->at(i); ObjectLiteralProperty* prop = props->at(i);
RECURSE_EXPRESSION(Visit(prop->key())); RECURSE_EXPRESSION(Visit(prop->key()));
...@@ -341,7 +341,7 @@ void AstTraversalVisitor<Subclass>::VisitObjectLiteral(ObjectLiteral* expr) { ...@@ -341,7 +341,7 @@ void AstTraversalVisitor<Subclass>::VisitObjectLiteral(ObjectLiteral* expr) {
template <class Subclass> template <class Subclass>
void AstTraversalVisitor<Subclass>::VisitArrayLiteral(ArrayLiteral* expr) { void AstTraversalVisitor<Subclass>::VisitArrayLiteral(ArrayLiteral* expr) {
PROCESS_EXPRESSION(expr); PROCESS_EXPRESSION(expr);
ZoneList<Expression*>* values = expr->values(); ZonePtrList<Expression>* values = expr->values();
for (int i = 0; i < values->length(); ++i) { for (int i = 0; i < values->length(); ++i) {
Expression* value = values->at(i); Expression* value = values->at(i);
RECURSE_EXPRESSION(Visit(value)); RECURSE_EXPRESSION(Visit(value));
...@@ -404,7 +404,7 @@ template <class Subclass> ...@@ -404,7 +404,7 @@ template <class Subclass>
void AstTraversalVisitor<Subclass>::VisitCall(Call* expr) { void AstTraversalVisitor<Subclass>::VisitCall(Call* expr) {
PROCESS_EXPRESSION(expr); PROCESS_EXPRESSION(expr);
RECURSE_EXPRESSION(Visit(expr->expression())); RECURSE_EXPRESSION(Visit(expr->expression()));
ZoneList<Expression*>* args = expr->arguments(); ZonePtrList<Expression>* args = expr->arguments();
for (int i = 0; i < args->length(); ++i) { for (int i = 0; i < args->length(); ++i) {
Expression* arg = args->at(i); Expression* arg = args->at(i);
RECURSE_EXPRESSION(Visit(arg)); RECURSE_EXPRESSION(Visit(arg));
...@@ -415,7 +415,7 @@ template <class Subclass> ...@@ -415,7 +415,7 @@ template <class Subclass>
void AstTraversalVisitor<Subclass>::VisitCallNew(CallNew* expr) { void AstTraversalVisitor<Subclass>::VisitCallNew(CallNew* expr) {
PROCESS_EXPRESSION(expr); PROCESS_EXPRESSION(expr);
RECURSE_EXPRESSION(Visit(expr->expression())); RECURSE_EXPRESSION(Visit(expr->expression()));
ZoneList<Expression*>* args = expr->arguments(); ZonePtrList<Expression>* args = expr->arguments();
for (int i = 0; i < args->length(); ++i) { for (int i = 0; i < args->length(); ++i) {
Expression* arg = args->at(i); Expression* arg = args->at(i);
RECURSE_EXPRESSION(Visit(arg)); RECURSE_EXPRESSION(Visit(arg));
...@@ -425,7 +425,7 @@ void AstTraversalVisitor<Subclass>::VisitCallNew(CallNew* expr) { ...@@ -425,7 +425,7 @@ void AstTraversalVisitor<Subclass>::VisitCallNew(CallNew* expr) {
template <class Subclass> template <class Subclass>
void AstTraversalVisitor<Subclass>::VisitCallRuntime(CallRuntime* expr) { void AstTraversalVisitor<Subclass>::VisitCallRuntime(CallRuntime* expr) {
PROCESS_EXPRESSION(expr); PROCESS_EXPRESSION(expr);
ZoneList<Expression*>* args = expr->arguments(); ZonePtrList<Expression>* args = expr->arguments();
for (int i = 0; i < args->length(); ++i) { for (int i = 0; i < args->length(); ++i) {
Expression* arg = args->at(i); Expression* arg = args->at(i);
RECURSE_EXPRESSION(Visit(arg)); RECURSE_EXPRESSION(Visit(arg));
...@@ -487,7 +487,7 @@ void AstTraversalVisitor<Subclass>::VisitClassLiteral(ClassLiteral* expr) { ...@@ -487,7 +487,7 @@ void AstTraversalVisitor<Subclass>::VisitClassLiteral(ClassLiteral* expr) {
if (expr->instance_fields_initializer_function() != nullptr) { if (expr->instance_fields_initializer_function() != nullptr) {
RECURSE_EXPRESSION(Visit(expr->instance_fields_initializer_function())); RECURSE_EXPRESSION(Visit(expr->instance_fields_initializer_function()));
} }
ZoneList<ClassLiteralProperty*>* props = expr->properties(); ZonePtrList<ClassLiteral::Property>* props = expr->properties();
for (int i = 0; i < props->length(); ++i) { for (int i = 0; i < props->length(); ++i) {
ClassLiteralProperty* prop = props->at(i); ClassLiteralProperty* prop = props->at(i);
if (!prop->key()->IsLiteral()) { if (!prop->key()->IsLiteral()) {
...@@ -501,7 +501,7 @@ template <class Subclass> ...@@ -501,7 +501,7 @@ template <class Subclass>
void AstTraversalVisitor<Subclass>::VisitInitializeClassFieldsStatement( void AstTraversalVisitor<Subclass>::VisitInitializeClassFieldsStatement(
InitializeClassFieldsStatement* stmt) { InitializeClassFieldsStatement* stmt) {
PROCESS_NODE(stmt); PROCESS_NODE(stmt);
ZoneList<ClassLiteralProperty*>* props = stmt->fields(); ZonePtrList<ClassLiteral::Property>* props = stmt->fields();
for (int i = 0; i < props->length(); ++i) { for (int i = 0; i < props->length(); ++i) {
ClassLiteralProperty* prop = props->at(i); ClassLiteralProperty* prop = props->at(i);
if (!prop->key()->IsLiteral()) { if (!prop->key()->IsLiteral()) {
......
...@@ -856,7 +856,7 @@ Call::CallType Call::GetCallType() const { ...@@ -856,7 +856,7 @@ Call::CallType Call::GetCallType() const {
return OTHER_CALL; return OTHER_CALL;
} }
CaseClause::CaseClause(Expression* label, ZoneList<Statement*>* statements) CaseClause::CaseClause(Expression* label, ZonePtrList<Statement>* statements)
: label_(label), statements_(statements) {} : label_(label), statements_(statements) {}
bool Literal::IsPropertyName() const { bool Literal::IsPropertyName() const {
...@@ -979,7 +979,7 @@ const char* CallRuntime::debug_name() { ...@@ -979,7 +979,7 @@ const char* CallRuntime::debug_name() {
case k##NodeType: \ case k##NodeType: \
return static_cast<const NodeType*>(this)->labels(); return static_cast<const NodeType*>(this)->labels();
ZoneList<const AstRawString*>* BreakableStatement::labels() const { ZonePtrList<const AstRawString>* BreakableStatement::labels() const {
switch (node_type()) { switch (node_type()) {
BREAKABLE_NODE_LIST(RETURN_LABELS) BREAKABLE_NODE_LIST(RETURN_LABELS)
ITERATION_NODE_LIST(RETURN_LABELS) ITERATION_NODE_LIST(RETURN_LABELS)
......
This diff is collapsed.
...@@ -498,16 +498,14 @@ void CallPrinter::VisitRewritableExpression(RewritableExpression* node) { ...@@ -498,16 +498,14 @@ void CallPrinter::VisitRewritableExpression(RewritableExpression* node) {
Find(node->expression()); Find(node->expression());
} }
void CallPrinter::FindStatements(ZonePtrList<Statement>* statements) {
void CallPrinter::FindStatements(ZoneList<Statement*>* statements) {
if (statements == nullptr) return; if (statements == nullptr) return;
for (int i = 0; i < statements->length(); i++) { for (int i = 0; i < statements->length(); i++) {
Find(statements->at(i)); Find(statements->at(i));
} }
} }
void CallPrinter::FindArguments(ZonePtrList<Expression>* arguments) {
void CallPrinter::FindArguments(ZoneList<Expression*>* arguments) {
if (found_) return; if (found_) return;
for (int i = 0; i < arguments->length(); i++) { for (int i = 0; i < arguments->length(); i++) {
Find(arguments->at(i)); Find(arguments->at(i));
...@@ -589,7 +587,7 @@ void AstPrinter::Print(const char* format, ...) { ...@@ -589,7 +587,7 @@ void AstPrinter::Print(const char* format, ...) {
} }
} }
void AstPrinter::PrintLabels(ZoneList<const AstRawString*>* labels) { void AstPrinter::PrintLabels(ZonePtrList<const AstRawString>* labels) {
if (labels != nullptr) { if (labels != nullptr) {
for (int i = 0; i < labels->length(); i++) { for (int i = 0; i < labels->length(); i++) {
PrintLiteral(labels->at(i), false); PrintLiteral(labels->at(i), false);
...@@ -748,8 +746,7 @@ void AstPrinter::PrintLiteralWithModeIndented(const char* info, Variable* var, ...@@ -748,8 +746,7 @@ void AstPrinter::PrintLiteralWithModeIndented(const char* info, Variable* var,
} }
} }
void AstPrinter::PrintLabelsIndented(ZonePtrList<const AstRawString>* labels) {
void AstPrinter::PrintLabelsIndented(ZoneList<const AstRawString*>* labels) {
if (labels == nullptr || labels->length() == 0) return; if (labels == nullptr || labels->length() == 0) return;
PrintIndented("LABELS "); PrintIndented("LABELS ");
PrintLabels(labels); PrintLabels(labels);
...@@ -809,15 +806,13 @@ void AstPrinter::PrintParameters(DeclarationScope* scope) { ...@@ -809,15 +806,13 @@ void AstPrinter::PrintParameters(DeclarationScope* scope) {
} }
} }
void AstPrinter::PrintStatements(ZonePtrList<Statement>* statements) {
void AstPrinter::PrintStatements(ZoneList<Statement*>* statements) {
for (int i = 0; i < statements->length(); i++) { for (int i = 0; i < statements->length(); i++) {
Visit(statements->at(i)); Visit(statements->at(i));
} }
} }
void AstPrinter::PrintArguments(ZonePtrList<Expression>* arguments) {
void AstPrinter::PrintArguments(ZoneList<Expression*>* arguments) {
for (int i = 0; i < arguments->length(); i++) { for (int i = 0; i < arguments->length(); i++) {
Visit(arguments->at(i)); Visit(arguments->at(i));
} }
...@@ -1040,7 +1035,7 @@ void AstPrinter::VisitInitializeClassFieldsStatement( ...@@ -1040,7 +1035,7 @@ void AstPrinter::VisitInitializeClassFieldsStatement(
} }
void AstPrinter::PrintClassProperties( void AstPrinter::PrintClassProperties(
ZoneList<ClassLiteral::Property*>* properties) { ZonePtrList<ClassLiteral::Property>* properties) {
for (int i = 0; i < properties->length(); i++) { for (int i = 0; i < properties->length(); i++) {
ClassLiteral::Property* property = properties->at(i); ClassLiteral::Property* property = properties->at(i);
const char* prop_kind = nullptr; const char* prop_kind = nullptr;
...@@ -1119,7 +1114,7 @@ void AstPrinter::VisitObjectLiteral(ObjectLiteral* node) { ...@@ -1119,7 +1114,7 @@ void AstPrinter::VisitObjectLiteral(ObjectLiteral* node) {
} }
void AstPrinter::PrintObjectProperties( void AstPrinter::PrintObjectProperties(
ZoneList<ObjectLiteral::Property*>* properties) { ZonePtrList<ObjectLiteral::Property>* properties) {
for (int i = 0; i < properties->length(); i++) { for (int i = 0; i < properties->length(); i++) {
ObjectLiteral::Property* property = properties->at(i); ObjectLiteral::Property* property = properties->at(i);
const char* prop_kind = nullptr; const char* prop_kind = nullptr;
......
...@@ -56,8 +56,8 @@ class CallPrinter final : public AstVisitor<CallPrinter> { ...@@ -56,8 +56,8 @@ class CallPrinter final : public AstVisitor<CallPrinter> {
protected: protected:
void PrintLiteral(Handle<Object> value, bool quote); void PrintLiteral(Handle<Object> value, bool quote);
void PrintLiteral(const AstRawString* value, bool quote); void PrintLiteral(const AstRawString* value, bool quote);
void FindStatements(ZoneList<Statement*>* statements); void FindStatements(ZonePtrList<Statement>* statements);
void FindArguments(ZoneList<Expression*>* arguments); void FindArguments(ZonePtrList<Expression>* arguments);
}; };
...@@ -88,17 +88,17 @@ class AstPrinter final : public AstVisitor<AstPrinter> { ...@@ -88,17 +88,17 @@ class AstPrinter final : public AstVisitor<AstPrinter> {
void Init(); void Init();
void PrintLabels(ZoneList<const AstRawString*>* labels); void PrintLabels(ZonePtrList<const AstRawString>* labels);
void PrintLiteral(const AstRawString* value, bool quote); void PrintLiteral(const AstRawString* value, bool quote);
void PrintLiteral(const AstConsString* value, bool quote); void PrintLiteral(const AstConsString* value, bool quote);
void PrintLiteral(Literal* literal, bool quote); void PrintLiteral(Literal* literal, bool quote);
void PrintIndented(const char* txt); void PrintIndented(const char* txt);
void PrintIndentedVisit(const char* s, AstNode* node); void PrintIndentedVisit(const char* s, AstNode* node);
void PrintStatements(ZoneList<Statement*>* statements); void PrintStatements(ZonePtrList<Statement>* statements);
void PrintDeclarations(Declaration::List* declarations); void PrintDeclarations(Declaration::List* declarations);
void PrintParameters(DeclarationScope* scope); void PrintParameters(DeclarationScope* scope);
void PrintArguments(ZoneList<Expression*>* arguments); void PrintArguments(ZonePtrList<Expression>* arguments);
void PrintCaseClause(CaseClause* clause); void PrintCaseClause(CaseClause* clause);
void PrintLiteralIndented(const char* info, Literal* literal, bool quote); void PrintLiteralIndented(const char* info, Literal* literal, bool quote);
void PrintLiteralIndented(const char* info, const AstRawString* value, void PrintLiteralIndented(const char* info, const AstRawString* value,
...@@ -107,9 +107,9 @@ class AstPrinter final : public AstVisitor<AstPrinter> { ...@@ -107,9 +107,9 @@ class AstPrinter final : public AstVisitor<AstPrinter> {
bool quote); bool quote);
void PrintLiteralWithModeIndented(const char* info, Variable* var, void PrintLiteralWithModeIndented(const char* info, Variable* var,
const AstRawString* value); const AstRawString* value);
void PrintLabelsIndented(ZoneList<const AstRawString*>* labels); void PrintLabelsIndented(ZonePtrList<const AstRawString>* labels);
void PrintObjectProperties(ZoneList<ObjectLiteral::Property*>* properties); void PrintObjectProperties(ZonePtrList<ObjectLiteral::Property>* properties);
void PrintClassProperties(ZoneList<ClassLiteral::Property*>* properties); void PrintClassProperties(ZonePtrList<ClassLiteral::Property>* properties);
void inc_indent() { indent_++; } void inc_indent() { indent_++; }
void dec_indent() { indent_--; } void dec_indent() { indent_--; }
......
...@@ -1334,7 +1334,7 @@ Declaration* Scope::CheckConflictingVarDeclarations() { ...@@ -1334,7 +1334,7 @@ Declaration* Scope::CheckConflictingVarDeclarations() {
} }
Declaration* Scope::CheckLexDeclarationsConflictingWith( Declaration* Scope::CheckLexDeclarationsConflictingWith(
const ZoneList<const AstRawString*>& names) { const ZonePtrList<const AstRawString>& names) {
DCHECK(is_block_scope()); DCHECK(is_block_scope());
for (int i = 0; i < names.length(); ++i) { for (int i = 0; i < names.length(); ++i) {
Variable* var = LookupLocal(names.at(i)); Variable* var = LookupLocal(names.at(i));
......
...@@ -255,7 +255,7 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) { ...@@ -255,7 +255,7 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
// which is an error even though the two 'e's are declared in different // which is an error even though the two 'e's are declared in different
// scopes. // scopes.
Declaration* CheckLexDeclarationsConflictingWith( Declaration* CheckLexDeclarationsConflictingWith(
const ZoneList<const AstRawString*>& names); const ZonePtrList<const AstRawString>& names);
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Scope-specific info. // Scope-specific info.
...@@ -963,7 +963,7 @@ class V8_EXPORT_PRIVATE DeclarationScope : public Scope { ...@@ -963,7 +963,7 @@ class V8_EXPORT_PRIVATE DeclarationScope : public Scope {
bool has_inferred_function_name_ : 1; bool has_inferred_function_name_ : 1;
// Parameter list in source order. // Parameter list in source order.
ZoneList<Variable*> params_; ZonePtrList<Variable> params_;
// Map of function names to lists of functions defined in sloppy blocks // Map of function names to lists of functions defined in sloppy blocks
SloppyBlockFunctionMap* sloppy_block_function_map_; SloppyBlockFunctionMap* sloppy_block_function_map_;
// Convenience variable. // Convenience variable.
......
...@@ -1327,7 +1327,7 @@ void BytecodeGenerator::VisitDeclarations(Declaration::List* declarations) { ...@@ -1327,7 +1327,7 @@ void BytecodeGenerator::VisitDeclarations(Declaration::List* declarations) {
globals_builder_ = new (zone()) GlobalDeclarationsBuilder(zone()); globals_builder_ = new (zone()) GlobalDeclarationsBuilder(zone());
} }
void BytecodeGenerator::VisitStatements(ZoneList<Statement*>* statements) { void BytecodeGenerator::VisitStatements(ZonePtrList<Statement>* statements) {
for (int i = 0; i < statements->length(); i++) { for (int i = 0; i < statements->length(); i++) {
// Allocate an outer register allocations scope for the statement. // Allocate an outer register allocations scope for the statement.
RegisterAllocationScope allocation_scope(this); RegisterAllocationScope allocation_scope(this);
...@@ -1416,7 +1416,7 @@ void BytecodeGenerator::VisitWithStatement(WithStatement* stmt) { ...@@ -1416,7 +1416,7 @@ void BytecodeGenerator::VisitWithStatement(WithStatement* stmt) {
void BytecodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { void BytecodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) {
// We need this scope because we visit for register values. We have to // We need this scope because we visit for register values. We have to
// maintain a execution result scope where registers can be allocated. // maintain a execution result scope where registers can be allocated.
ZoneList<CaseClause*>* clauses = stmt->cases(); ZonePtrList<CaseClause>* clauses = stmt->cases();
SwitchBuilder switch_builder(builder(), block_coverage_builder_, stmt, SwitchBuilder switch_builder(builder(), block_coverage_builder_, stmt,
clauses->length()); clauses->length());
ControlScopeForBreakable scope(this, stmt, &switch_builder); ControlScopeForBreakable scope(this, stmt, &switch_builder);
...@@ -2315,15 +2315,15 @@ void BytecodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { ...@@ -2315,15 +2315,15 @@ void BytecodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
} }
void BytecodeGenerator::BuildArrayLiteralElementsInsertion( void BytecodeGenerator::BuildArrayLiteralElementsInsertion(
Register array, int first_spread_index, ZoneList<Expression*>* elements, Register array, int first_spread_index, ZonePtrList<Expression>* elements,
bool skip_constants) { bool skip_constants) {
DCHECK_LT(first_spread_index, elements->length()); DCHECK_LT(first_spread_index, elements->length());
Register index = register_allocator()->NewRegister(); Register index = register_allocator()->NewRegister();
int array_index = 0; int array_index = 0;
ZoneList<Expression*>::iterator iter = elements->begin(); ZonePtrList<Expression>::iterator iter = elements->begin();
ZoneList<Expression*>::iterator first_spread_or_end = ZonePtrList<Expression>::iterator first_spread_or_end =
first_spread_index >= 0 ? elements->begin() + first_spread_index first_spread_index >= 0 ? elements->begin() + first_spread_index
: elements->end(); : elements->end();
...@@ -3424,7 +3424,7 @@ void BytecodeGenerator::VisitResolvedProperty(ResolvedProperty* expr) { ...@@ -3424,7 +3424,7 @@ void BytecodeGenerator::VisitResolvedProperty(ResolvedProperty* expr) {
UNREACHABLE(); UNREACHABLE();
} }
void BytecodeGenerator::VisitArguments(ZoneList<Expression*>* args, void BytecodeGenerator::VisitArguments(ZonePtrList<Expression>* args,
RegisterList* arg_regs) { RegisterList* arg_regs) {
// Visit arguments. // Visit arguments.
for (int i = 0; i < static_cast<int>(args->length()); i++) { for (int i = 0; i < static_cast<int>(args->length()); i++) {
...@@ -3595,7 +3595,7 @@ void BytecodeGenerator::VisitCall(Call* expr) { ...@@ -3595,7 +3595,7 @@ void BytecodeGenerator::VisitCall(Call* expr) {
void BytecodeGenerator::VisitCallSuper(Call* expr) { void BytecodeGenerator::VisitCallSuper(Call* expr) {
RegisterAllocationScope register_scope(this); RegisterAllocationScope register_scope(this);
SuperCallReference* super = expr->expression()->AsSuperCallReference(); SuperCallReference* super = expr->expression()->AsSuperCallReference();
ZoneList<Expression*>* args = expr->arguments(); ZonePtrList<Expression>* args = expr->arguments();
int first_spread_index = 0; int first_spread_index = 0;
for (; first_spread_index < args->length(); first_spread_index++) { for (; first_spread_index < args->length(); first_spread_index++) {
...@@ -4309,8 +4309,8 @@ void BytecodeGenerator::VisitGetTemplateObject(GetTemplateObject* expr) { ...@@ -4309,8 +4309,8 @@ void BytecodeGenerator::VisitGetTemplateObject(GetTemplateObject* expr) {
} }
void BytecodeGenerator::VisitTemplateLiteral(TemplateLiteral* expr) { void BytecodeGenerator::VisitTemplateLiteral(TemplateLiteral* expr) {
const TemplateLiteral::StringList& parts = *expr->string_parts(); const ZonePtrList<const AstRawString>& parts = *expr->string_parts();
const TemplateLiteral::ExpressionList& substitutions = *expr->substitutions(); const ZonePtrList<Expression>& substitutions = *expr->substitutions();
// Template strings with no substitutions are turned into StringLiterals. // Template strings with no substitutions are turned into StringLiterals.
DCHECK_GT(substitutions.length(), 0); DCHECK_GT(substitutions.length(), 0);
DCHECK_EQ(parts.length(), substitutions.length() + 1); DCHECK_EQ(parts.length(), substitutions.length() + 1);
......
...@@ -43,7 +43,7 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> { ...@@ -43,7 +43,7 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
// Visiting function for declarations list and statements are overridden. // Visiting function for declarations list and statements are overridden.
void VisitDeclarations(Declaration::List* declarations); void VisitDeclarations(Declaration::List* declarations);
void VisitStatements(ZoneList<Statement*>* statments); void VisitStatements(ZonePtrList<Statement>* statments);
private: private:
class ContextScope; class ContextScope;
...@@ -100,7 +100,7 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> { ...@@ -100,7 +100,7 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
// Visit the arguments expressions in |args| and store them in |args_regs|, // Visit the arguments expressions in |args| and store them in |args_regs|,
// growing |args_regs| for each argument visited. // growing |args_regs| for each argument visited.
void VisitArguments(ZoneList<Expression*>* args, RegisterList* arg_regs); void VisitArguments(ZonePtrList<Expression>* args, RegisterList* arg_regs);
// Visit a keyed super property load. The optional // Visit a keyed super property load. The optional
// |opt_receiver_out| register will have the receiver stored to it // |opt_receiver_out| register will have the receiver stored to it
...@@ -179,7 +179,7 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> { ...@@ -179,7 +179,7 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
FeedbackSlot element_slot); FeedbackSlot element_slot);
void BuildArrayLiteralElementsInsertion(Register array, void BuildArrayLiteralElementsInsertion(Register array,
int first_spread_index, int first_spread_index,
ZoneList<Expression*>* elements, ZonePtrList<Expression>* elements,
bool skip_constants); bool skip_constants);
void AllocateTopLevelRegisters(); void AllocateTopLevelRegisters();
......
...@@ -55,7 +55,7 @@ void Reparenter::VisitClassLiteral(ClassLiteral* class_literal) { ...@@ -55,7 +55,7 @@ void Reparenter::VisitClassLiteral(ClassLiteral* class_literal) {
#if DEBUG #if DEBUG
// The same goes for the rest of the class, but we do some // The same goes for the rest of the class, but we do some
// sanity checking in debug mode. // sanity checking in debug mode.
ZoneList<ClassLiteralProperty*>* props = class_literal->properties(); ZonePtrList<ClassLiteralProperty>* props = class_literal->properties();
for (int i = 0; i < props->length(); ++i) { for (int i = 0; i < props->length(); ++i) {
ClassLiteralProperty* prop = props->at(i); ClassLiteralProperty* prop = props->at(i);
// No need to visit the values, since all values are functions with // No need to visit the values, since all values are functions with
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -29,7 +29,7 @@ class PatternRewriter final : public AstVisitor<PatternRewriter> { ...@@ -29,7 +29,7 @@ class PatternRewriter final : public AstVisitor<PatternRewriter> {
Parser* parser, Block* block, Parser* parser, Block* block,
const DeclarationDescriptor* declaration_descriptor, const DeclarationDescriptor* declaration_descriptor,
const Parser::DeclarationParsingResult::Declaration* declaration, const Parser::DeclarationParsingResult::Declaration* declaration,
ZoneList<const AstRawString*>* names, bool* ok); ZonePtrList<const AstRawString>* names, bool* ok);
static void RewriteDestructuringAssignment(Parser* parser, static void RewriteDestructuringAssignment(Parser* parser,
RewritableExpression* to_rewrite, RewritableExpression* to_rewrite,
...@@ -108,7 +108,7 @@ class PatternRewriter final : public AstVisitor<PatternRewriter> { ...@@ -108,7 +108,7 @@ class PatternRewriter final : public AstVisitor<PatternRewriter> {
int value_beg_position_; int value_beg_position_;
Block* block_; Block* block_;
const DeclarationDescriptor* descriptor_; const DeclarationDescriptor* descriptor_;
ZoneList<const AstRawString*>* names_; ZonePtrList<const AstRawString>* names_;
Expression* current_value_; Expression* current_value_;
int recursion_level_; int recursion_level_;
bool* ok_; bool* ok_;
...@@ -119,7 +119,7 @@ class PatternRewriter final : public AstVisitor<PatternRewriter> { ...@@ -119,7 +119,7 @@ class PatternRewriter final : public AstVisitor<PatternRewriter> {
void Parser::DeclareAndInitializeVariables( void Parser::DeclareAndInitializeVariables(
Block* block, const DeclarationDescriptor* declaration_descriptor, Block* block, const DeclarationDescriptor* declaration_descriptor,
const DeclarationParsingResult::Declaration* declaration, const DeclarationParsingResult::Declaration* declaration,
ZoneList<const AstRawString*>* names, bool* ok) { ZonePtrList<const AstRawString>* names, bool* ok) {
PatternRewriter::DeclareAndInitializeVariables( PatternRewriter::DeclareAndInitializeVariables(
this, block, declaration_descriptor, declaration, names, ok); this, block, declaration_descriptor, declaration, names, ok);
} }
...@@ -140,7 +140,7 @@ void PatternRewriter::DeclareAndInitializeVariables( ...@@ -140,7 +140,7 @@ void PatternRewriter::DeclareAndInitializeVariables(
Parser* parser, Block* block, Parser* parser, Block* block,
const DeclarationDescriptor* declaration_descriptor, const DeclarationDescriptor* declaration_descriptor,
const Parser::DeclarationParsingResult::Declaration* declaration, const Parser::DeclarationParsingResult::Declaration* declaration,
ZoneList<const AstRawString*>* names, bool* ok) { ZonePtrList<const AstRawString>* names, bool* ok) {
DCHECK(block->ignore_completion_value()); DCHECK(block->ignore_completion_value());
PatternRewriter rewriter(declaration_descriptor->scope, parser, BINDING); PatternRewriter rewriter(declaration_descriptor->scope, parser, BINDING);
...@@ -368,14 +368,14 @@ void PatternRewriter::VisitObjectLiteral(ObjectLiteral* pattern, ...@@ -368,14 +368,14 @@ void PatternRewriter::VisitObjectLiteral(ObjectLiteral* pattern,
Variable** temp_var) { Variable** temp_var) {
auto temp = *temp_var = CreateTempVar(current_value_); auto temp = *temp_var = CreateTempVar(current_value_);
ZoneList<Expression*>* rest_runtime_callargs = nullptr; ZonePtrList<Expression>* rest_runtime_callargs = nullptr;
if (pattern->has_rest_property()) { if (pattern->has_rest_property()) {
// non_rest_properties_count = pattern->properties()->length - 1; // non_rest_properties_count = pattern->properties()->length - 1;
// args_length = 1 + non_rest_properties_count because we need to // args_length = 1 + non_rest_properties_count because we need to
// pass temp as well to the runtime function. // pass temp as well to the runtime function.
int args_length = pattern->properties()->length(); int args_length = pattern->properties()->length();
rest_runtime_callargs = rest_runtime_callargs =
new (zone()) ZoneList<Expression*>(args_length, zone()); new (zone()) ZonePtrList<Expression>(args_length, zone());
rest_runtime_callargs->Add(factory()->NewVariableProxy(temp), zone()); rest_runtime_callargs->Add(factory()->NewVariableProxy(temp), zone());
} }
...@@ -410,7 +410,7 @@ void PatternRewriter::VisitObjectLiteral(ObjectLiteral* pattern, ...@@ -410,7 +410,7 @@ void PatternRewriter::VisitObjectLiteral(ObjectLiteral* pattern,
if (property->is_computed_name()) { if (property->is_computed_name()) {
DCHECK(!key->IsPropertyName() || !key->IsNumberLiteral()); DCHECK(!key->IsPropertyName() || !key->IsNumberLiteral());
auto args = new (zone()) ZoneList<Expression*>(1, zone()); auto args = new (zone()) ZonePtrList<Expression>(1, zone());
args->Add(key, zone()); args->Add(key, zone());
auto to_name_key = CreateTempVar(factory()->NewCallRuntime( auto to_name_key = CreateTempVar(factory()->NewCallRuntime(
Runtime::kToName, args, kNoSourcePosition)); Runtime::kToName, args, kNoSourcePosition));
...@@ -593,7 +593,7 @@ void PatternRewriter::VisitArrayLiteral(ArrayLiteral* node, ...@@ -593,7 +593,7 @@ void PatternRewriter::VisitArrayLiteral(ArrayLiteral* node,
// let array = []; // let array = [];
Variable* array; Variable* array;
{ {
auto empty_exprs = new (zone()) ZoneList<Expression*>(0, zone()); auto empty_exprs = new (zone()) ZonePtrList<Expression>(0, zone());
array = CreateTempVar( array = CreateTempVar(
factory()->NewArrayLiteral(empty_exprs, kNoSourcePosition)); factory()->NewArrayLiteral(empty_exprs, kNoSourcePosition));
} }
......
...@@ -268,7 +268,7 @@ PreParser::Expression PreParser::ParseFunctionLiteral( ...@@ -268,7 +268,7 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
FunctionNameValidity function_name_validity, FunctionKind kind, FunctionNameValidity function_name_validity, FunctionKind kind,
int function_token_pos, FunctionLiteral::FunctionType function_type, int function_token_pos, FunctionLiteral::FunctionType function_type,
LanguageMode language_mode, LanguageMode language_mode,
ZoneList<const AstRawString*>* arguments_for_wrapped_function, bool* ok) { ZonePtrList<const AstRawString>* arguments_for_wrapped_function, bool* ok) {
// Wrapped functions are not parsed in the preparser. // Wrapped functions are not parsed in the preparser.
DCHECK_NULL(arguments_for_wrapped_function); DCHECK_NULL(arguments_for_wrapped_function);
DCHECK_NE(FunctionLiteral::kWrapped, function_type); DCHECK_NE(FunctionLiteral::kWrapped, function_type);
...@@ -429,7 +429,7 @@ void PreParser::DeclareAndInitializeVariables( ...@@ -429,7 +429,7 @@ void PreParser::DeclareAndInitializeVariables(
PreParserStatement block, PreParserStatement block,
const DeclarationDescriptor* declaration_descriptor, const DeclarationDescriptor* declaration_descriptor,
const DeclarationParsingResult::Declaration* declaration, const DeclarationParsingResult::Declaration* declaration,
ZoneList<const AstRawString*>* names, bool* ok) { ZonePtrList<const AstRawString>* names, bool* ok) {
if (declaration->pattern.variables_ != nullptr) { if (declaration->pattern.variables_ != nullptr) {
DCHECK(FLAG_lazy_inner_functions); DCHECK(FLAG_lazy_inner_functions);
DCHECK(track_unresolved_variables_); DCHECK(track_unresolved_variables_);
......
This diff is collapsed.
...@@ -43,7 +43,7 @@ class Processor final : public AstVisitor<Processor> { ...@@ -43,7 +43,7 @@ class Processor final : public AstVisitor<Processor> {
InitializeAstVisitor(parser->stack_limit()); InitializeAstVisitor(parser->stack_limit());
} }
void Process(ZoneList<Statement*>* statements); void Process(ZonePtrList<Statement>* statements);
bool result_assigned() const { return result_assigned_; } bool result_assigned() const { return result_assigned_; }
Zone* zone() { return zone_; } Zone* zone() { return zone_; }
...@@ -121,8 +121,7 @@ Statement* Processor::AssignUndefinedBefore(Statement* s) { ...@@ -121,8 +121,7 @@ Statement* Processor::AssignUndefinedBefore(Statement* s) {
return b; return b;
} }
void Processor::Process(ZonePtrList<Statement>* statements) {
void Processor::Process(ZoneList<Statement*>* statements) {
// If we're in a breakable scope (named block, iteration, or switch), we walk // If we're in a breakable scope (named block, iteration, or switch), we walk
// all statements. The last value producing statement before the break needs // all statements. The last value producing statement before the break needs
// to assign to .result. If we're not in a breakable scope, only the last // to assign to .result. If we're not in a breakable scope, only the last
...@@ -283,7 +282,7 @@ void Processor::VisitSwitchStatement(SwitchStatement* node) { ...@@ -283,7 +282,7 @@ void Processor::VisitSwitchStatement(SwitchStatement* node) {
DCHECK(breakable_ || !is_set_); DCHECK(breakable_ || !is_set_);
BreakableScope scope(this); BreakableScope scope(this);
// Rewrite statements in all case clauses. // Rewrite statements in all case clauses.
ZoneList<CaseClause*>* clauses = node->cases(); ZonePtrList<CaseClause>* clauses = node->cases();
for (int i = clauses->length() - 1; i >= 0; --i) { for (int i = clauses->length() - 1; i >= 0; --i) {
CaseClause* clause = clauses->at(i); CaseClause* clause = clauses->at(i);
Process(clause->statements()); Process(clause->statements());
...@@ -381,7 +380,7 @@ bool Rewriter::Rewrite(ParseInfo* info) { ...@@ -381,7 +380,7 @@ bool Rewriter::Rewrite(ParseInfo* info) {
return true; return true;
} }
ZoneList<Statement*>* body = function->body(); ZonePtrList<Statement>* body = function->body();
DCHECK_IMPLIES(scope->is_module_scope(), !body->is_empty()); DCHECK_IMPLIES(scope->is_module_scope(), !body->is_empty());
if (!body->is_empty()) { if (!body->is_empty()) {
Variable* result = scope->AsDeclarationScope()->NewTemporary( Variable* result = scope->AsDeclarationScope()->NewTemporary(
...@@ -416,7 +415,7 @@ bool Rewriter::Rewrite(Parser* parser, DeclarationScope* closure_scope, ...@@ -416,7 +415,7 @@ bool Rewriter::Rewrite(Parser* parser, DeclarationScope* closure_scope,
DCHECK_EQ(closure_scope, closure_scope->GetClosureScope()); DCHECK_EQ(closure_scope, closure_scope->GetClosureScope());
DCHECK(block->scope() == nullptr || DCHECK(block->scope() == nullptr ||
block->scope()->GetClosureScope() == closure_scope); block->scope()->GetClosureScope() == closure_scope);
ZoneList<Statement*>* body = block->statements(); ZonePtrList<Statement>* body = block->statements();
VariableProxy* result = expr->result(); VariableProxy* result = expr->result();
Variable* result_var = result->var(); Variable* result_var = result->var();
......
...@@ -290,6 +290,11 @@ class ZoneList final { ...@@ -290,6 +290,11 @@ class ZoneList final {
DISALLOW_COPY_AND_ASSIGN(ZoneList); DISALLOW_COPY_AND_ASSIGN(ZoneList);
}; };
// ZonePtrList is a ZoneList of pointers to ZoneObjects allocated in the same
// zone as the list object.
template <typename T>
using ZonePtrList = ZoneList<T*>;
// A zone splay tree. The config type parameter encapsulates the // A zone splay tree. The config type parameter encapsulates the
// different configurations of a concrete splay tree (see splay-tree.h). // different configurations of a concrete splay tree (see splay-tree.h).
// The tree itself and all its elements are allocated in the Zone. // The tree itself and all its elements are allocated in the Zone.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment