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> {
// Iteration left-to-right.
void VisitDeclarations(Declaration::List* declarations);
void VisitStatements(ZoneList<Statement*>* statements);
void VisitStatements(ZonePtrList<Statement>* statements);
// Individual nodes
#define DECLARE_VISIT(type) void Visit##type(type* node);
......@@ -112,7 +112,7 @@ void AstTraversalVisitor<Subclass>::VisitDeclarations(
template <class Subclass>
void AstTraversalVisitor<Subclass>::VisitStatements(
ZoneList<Statement*>* stmts) {
ZonePtrList<Statement>* stmts) {
for (int i = 0; i < stmts->length(); ++i) {
Statement* stmt = stmts->at(i);
RECURSE(Visit(stmt));
......@@ -198,14 +198,14 @@ void AstTraversalVisitor<Subclass>::VisitSwitchStatement(
PROCESS_NODE(stmt);
RECURSE(Visit(stmt->tag()));
ZoneList<CaseClause*>* clauses = stmt->cases();
ZonePtrList<CaseClause>* clauses = stmt->cases();
for (int i = 0; i < clauses->length(); ++i) {
CaseClause* clause = clauses->at(i);
if (!clause->is_default()) {
Expression* label = clause->label();
RECURSE(Visit(label));
}
ZoneList<Statement*>* stmts = clause->statements();
ZonePtrList<Statement>* stmts = clause->statements();
RECURSE(VisitStatements(stmts));
}
}
......@@ -330,7 +330,7 @@ void AstTraversalVisitor<Subclass>::VisitRegExpLiteral(RegExpLiteral* expr) {
template <class Subclass>
void AstTraversalVisitor<Subclass>::VisitObjectLiteral(ObjectLiteral* expr) {
PROCESS_EXPRESSION(expr);
ZoneList<ObjectLiteralProperty*>* props = expr->properties();
ZonePtrList<ObjectLiteralProperty>* props = expr->properties();
for (int i = 0; i < props->length(); ++i) {
ObjectLiteralProperty* prop = props->at(i);
RECURSE_EXPRESSION(Visit(prop->key()));
......@@ -341,7 +341,7 @@ void AstTraversalVisitor<Subclass>::VisitObjectLiteral(ObjectLiteral* expr) {
template <class Subclass>
void AstTraversalVisitor<Subclass>::VisitArrayLiteral(ArrayLiteral* expr) {
PROCESS_EXPRESSION(expr);
ZoneList<Expression*>* values = expr->values();
ZonePtrList<Expression>* values = expr->values();
for (int i = 0; i < values->length(); ++i) {
Expression* value = values->at(i);
RECURSE_EXPRESSION(Visit(value));
......@@ -404,7 +404,7 @@ template <class Subclass>
void AstTraversalVisitor<Subclass>::VisitCall(Call* expr) {
PROCESS_EXPRESSION(expr);
RECURSE_EXPRESSION(Visit(expr->expression()));
ZoneList<Expression*>* args = expr->arguments();
ZonePtrList<Expression>* args = expr->arguments();
for (int i = 0; i < args->length(); ++i) {
Expression* arg = args->at(i);
RECURSE_EXPRESSION(Visit(arg));
......@@ -415,7 +415,7 @@ template <class Subclass>
void AstTraversalVisitor<Subclass>::VisitCallNew(CallNew* expr) {
PROCESS_EXPRESSION(expr);
RECURSE_EXPRESSION(Visit(expr->expression()));
ZoneList<Expression*>* args = expr->arguments();
ZonePtrList<Expression>* args = expr->arguments();
for (int i = 0; i < args->length(); ++i) {
Expression* arg = args->at(i);
RECURSE_EXPRESSION(Visit(arg));
......@@ -425,7 +425,7 @@ void AstTraversalVisitor<Subclass>::VisitCallNew(CallNew* expr) {
template <class Subclass>
void AstTraversalVisitor<Subclass>::VisitCallRuntime(CallRuntime* expr) {
PROCESS_EXPRESSION(expr);
ZoneList<Expression*>* args = expr->arguments();
ZonePtrList<Expression>* args = expr->arguments();
for (int i = 0; i < args->length(); ++i) {
Expression* arg = args->at(i);
RECURSE_EXPRESSION(Visit(arg));
......@@ -487,7 +487,7 @@ void AstTraversalVisitor<Subclass>::VisitClassLiteral(ClassLiteral* expr) {
if (expr->instance_fields_initializer_function() != nullptr) {
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) {
ClassLiteralProperty* prop = props->at(i);
if (!prop->key()->IsLiteral()) {
......@@ -501,7 +501,7 @@ template <class Subclass>
void AstTraversalVisitor<Subclass>::VisitInitializeClassFieldsStatement(
InitializeClassFieldsStatement* stmt) {
PROCESS_NODE(stmt);
ZoneList<ClassLiteralProperty*>* props = stmt->fields();
ZonePtrList<ClassLiteral::Property>* props = stmt->fields();
for (int i = 0; i < props->length(); ++i) {
ClassLiteralProperty* prop = props->at(i);
if (!prop->key()->IsLiteral()) {
......
......@@ -856,7 +856,7 @@ Call::CallType Call::GetCallType() const {
return OTHER_CALL;
}
CaseClause::CaseClause(Expression* label, ZoneList<Statement*>* statements)
CaseClause::CaseClause(Expression* label, ZonePtrList<Statement>* statements)
: label_(label), statements_(statements) {}
bool Literal::IsPropertyName() const {
......@@ -979,7 +979,7 @@ const char* CallRuntime::debug_name() {
case k##NodeType: \
return static_cast<const NodeType*>(this)->labels();
ZoneList<const AstRawString*>* BreakableStatement::labels() const {
ZonePtrList<const AstRawString>* BreakableStatement::labels() const {
switch (node_type()) {
BREAKABLE_NODE_LIST(RETURN_LABELS)
ITERATION_NODE_LIST(RETURN_LABELS)
......
......@@ -257,7 +257,7 @@ class BreakableStatement : public Statement {
TARGET_FOR_NAMED_ONLY
};
ZoneList<const AstRawString*>* labels() const;
ZonePtrList<const AstRawString>* labels() const;
// Testers.
bool is_target_for_anonymous() const {
......@@ -279,12 +279,12 @@ class BreakableStatement : public Statement {
class Block : public BreakableStatement {
public:
ZoneList<Statement*>* statements() { return &statements_; }
ZonePtrList<Statement>* statements() { return &statements_; }
bool ignore_completion_value() const {
return IgnoreCompletionField::decode(bit_field_);
}
inline ZoneList<const AstRawString*>* labels() const;
inline ZonePtrList<const AstRawString>* labels() const;
bool IsJump() const {
return !statements_.is_empty() && statements_.last()->IsJump() &&
......@@ -297,7 +297,7 @@ class Block : public BreakableStatement {
private:
friend class AstNodeFactory;
ZoneList<Statement*> statements_;
ZonePtrList<Statement> statements_;
Scope* scope_;
class IgnoreCompletionField
......@@ -306,7 +306,7 @@ class Block : public BreakableStatement {
: public BitField<bool, IgnoreCompletionField::kNext, 1> {};
protected:
Block(Zone* zone, ZoneList<const AstRawString*>* labels, int capacity,
Block(Zone* zone, ZonePtrList<const AstRawString>* labels, int capacity,
bool ignore_completion_value)
: BreakableStatement(TARGET_FOR_NAMED_ONLY, kNoSourcePosition, kBlock),
statements_(capacity, zone),
......@@ -321,18 +321,18 @@ class LabeledBlock final : public Block {
friend class AstNodeFactory;
friend class Block;
LabeledBlock(Zone* zone, ZoneList<const AstRawString*>* labels, int capacity,
bool ignore_completion_value)
LabeledBlock(Zone* zone, ZonePtrList<const AstRawString>* labels,
int capacity, bool ignore_completion_value)
: Block(zone, labels, capacity, ignore_completion_value),
labels_(labels) {
DCHECK_NOT_NULL(labels);
DCHECK_GT(labels->length(), 0);
}
ZoneList<const AstRawString*>* labels_;
ZonePtrList<const AstRawString>* labels_;
};
inline ZoneList<const AstRawString*>* Block::labels() const {
inline ZonePtrList<const AstRawString>* Block::labels() const {
if (IsLabeledField::decode(bit_field_)) {
return static_cast<const LabeledBlock*>(this)->labels_;
}
......@@ -439,10 +439,10 @@ class IterationStatement : public BreakableStatement {
Statement* body() const { return body_; }
void set_body(Statement* s) { body_ = s; }
ZoneList<const AstRawString*>* labels() const { return labels_; }
ZonePtrList<const AstRawString>* labels() const { return labels_; }
protected:
IterationStatement(ZoneList<const AstRawString*>* labels, int pos,
IterationStatement(ZonePtrList<const AstRawString>* labels, int pos,
NodeType type)
: BreakableStatement(TARGET_FOR_ANONYMOUS, pos, type),
labels_(labels),
......@@ -453,7 +453,7 @@ class IterationStatement : public BreakableStatement {
BreakableStatement::kNextBitFieldIndex;
private:
ZoneList<const AstRawString*>* labels_;
ZonePtrList<const AstRawString>* labels_;
Statement* body_;
};
......@@ -470,7 +470,7 @@ class DoWhileStatement final : public IterationStatement {
private:
friend class AstNodeFactory;
DoWhileStatement(ZoneList<const AstRawString*>* labels, int pos)
DoWhileStatement(ZonePtrList<const AstRawString>* labels, int pos)
: IterationStatement(labels, pos, kDoWhileStatement), cond_(nullptr) {}
Expression* cond_;
......@@ -489,7 +489,7 @@ class WhileStatement final : public IterationStatement {
private:
friend class AstNodeFactory;
WhileStatement(ZoneList<const AstRawString*>* labels, int pos)
WhileStatement(ZonePtrList<const AstRawString>* labels, int pos)
: IterationStatement(labels, pos, kWhileStatement), cond_(nullptr) {}
Expression* cond_;
......@@ -513,7 +513,7 @@ class ForStatement final : public IterationStatement {
private:
friend class AstNodeFactory;
ForStatement(ZoneList<const AstRawString*>* labels, int pos)
ForStatement(ZonePtrList<const AstRawString>* labels, int pos)
: IterationStatement(labels, pos, kForStatement),
init_(nullptr),
cond_(nullptr),
......@@ -539,7 +539,7 @@ class ForEachStatement : public IterationStatement {
}
protected:
ForEachStatement(ZoneList<const AstRawString*>* labels, int pos,
ForEachStatement(ZonePtrList<const AstRawString>* labels, int pos,
NodeType type)
: IterationStatement(labels, pos, type) {}
};
......@@ -566,7 +566,7 @@ class ForInStatement final : public ForEachStatement {
private:
friend class AstNodeFactory;
ForInStatement(ZoneList<const AstRawString*>* labels, int pos)
ForInStatement(ZonePtrList<const AstRawString>* labels, int pos)
: ForEachStatement(labels, pos, kForInStatement),
each_(nullptr),
subject_(nullptr) {
......@@ -632,7 +632,7 @@ class ForOfStatement final : public ForEachStatement {
private:
friend class AstNodeFactory;
ForOfStatement(ZoneList<const AstRawString*>* labels, int pos)
ForOfStatement(ZonePtrList<const AstRawString>* labels, int pos)
: ForEachStatement(labels, pos, kForOfStatement),
iterator_(nullptr),
assign_iterator_(nullptr),
......@@ -759,40 +759,40 @@ class CaseClause final : public ZoneObject {
DCHECK(!is_default());
return label_;
}
ZoneList<Statement*>* statements() const { return statements_; }
ZonePtrList<Statement>* statements() const { return statements_; }
private:
friend class AstNodeFactory;
CaseClause(Expression* label, ZoneList<Statement*>* statements);
CaseClause(Expression* label, ZonePtrList<Statement>* statements);
Expression* label_;
ZoneList<Statement*>* statements_;
ZonePtrList<Statement>* statements_;
};
class SwitchStatement final : public BreakableStatement {
public:
ZoneList<const AstRawString*>* labels() const { return labels_; }
ZonePtrList<const AstRawString>* labels() const { return labels_; }
Expression* tag() const { return tag_; }
void set_tag(Expression* t) { tag_ = t; }
ZoneList<CaseClause*>* cases() { return &cases_; }
ZonePtrList<CaseClause>* cases() { return &cases_; }
private:
friend class AstNodeFactory;
SwitchStatement(Zone* zone, ZoneList<const AstRawString*>* labels,
SwitchStatement(Zone* zone, ZonePtrList<const AstRawString>* labels,
Expression* tag, int pos)
: BreakableStatement(TARGET_FOR_ANONYMOUS, pos, kSwitchStatement),
labels_(labels),
tag_(tag),
cases_(4, zone) {}
ZoneList<const AstRawString*>* labels_;
ZonePtrList<const AstRawString>* labels_;
Expression* tag_;
ZoneList<CaseClause*> cases_;
ZonePtrList<CaseClause> cases_;
};
......@@ -1282,7 +1282,7 @@ class ObjectLiteral final : public AggregateLiteral {
return constant_properties_;
}
int properties_count() const { return boilerplate_properties_; }
ZoneList<Property*>* properties() const { return properties_; }
ZonePtrList<Property>* properties() const { return properties_; }
bool has_elements() const { return HasElementsField::decode(bit_field_); }
bool has_rest_property() const {
return HasRestPropertyField::decode(bit_field_);
......@@ -1357,7 +1357,7 @@ class ObjectLiteral final : public AggregateLiteral {
private:
friend class AstNodeFactory;
ObjectLiteral(ZoneList<Property*>* properties,
ObjectLiteral(ZonePtrList<Property>* properties,
uint32_t boilerplate_properties, int pos,
bool has_rest_property)
: AggregateLiteral(pos, kObjectLiteral),
......@@ -1383,7 +1383,7 @@ class ObjectLiteral final : public AggregateLiteral {
uint32_t boilerplate_properties_;
Handle<BoilerplateDescription> constant_properties_;
ZoneList<Property*>* properties_;
ZonePtrList<Property>* properties_;
class HasElementsField
: public BitField<bool, AggregateLiteral::kNextBitFieldIndex, 1> {};
......@@ -1429,7 +1429,7 @@ class ArrayLiteral final : public AggregateLiteral {
return constant_elements_;
}
ZoneList<Expression*>* values() const { return values_; }
ZonePtrList<Expression>* values() const { return values_; }
int first_spread_index() const { return first_spread_index_; }
......@@ -1460,15 +1460,14 @@ class ArrayLiteral final : public AggregateLiteral {
private:
friend class AstNodeFactory;
ArrayLiteral(ZoneList<Expression*>* values, int first_spread_index, int pos)
ArrayLiteral(ZonePtrList<Expression>* values, int first_spread_index, int pos)
: AggregateLiteral(pos, kArrayLiteral),
first_spread_index_(first_spread_index),
values_(values) {
}
values_(values) {}
int first_spread_index_;
Handle<ConstantElementsPair> constant_elements_;
ZoneList<Expression*>* values_;
ZonePtrList<Expression>* values_;
};
enum class HoleCheckMode { kRequired, kElided };
......@@ -1635,7 +1634,7 @@ class ResolvedProperty final : public Expression {
class Call final : public Expression {
public:
Expression* expression() const { return expression_; }
ZoneList<Expression*>* arguments() const { return arguments_; }
ZonePtrList<Expression>* arguments() const { return arguments_; }
bool is_possibly_eval() const {
return IsPossiblyEvalField::decode(bit_field_);
......@@ -1674,17 +1673,15 @@ class Call final : public Expression {
private:
friend class AstNodeFactory;
Call(Expression* expression, ZoneList<Expression*>* arguments, int pos,
Call(Expression* expression, ZonePtrList<Expression>* arguments, int pos,
PossiblyEval possibly_eval)
: Expression(pos, kCall),
expression_(expression),
arguments_(arguments) {
: Expression(pos, kCall), expression_(expression), arguments_(arguments) {
bit_field_ |=
IsPossiblyEvalField::encode(possibly_eval == IS_POSSIBLY_EVAL) |
IsTaggedTemplateField::encode(false);
}
Call(Expression* expression, ZoneList<Expression*>* arguments, int pos,
Call(Expression* expression, ZonePtrList<Expression>* arguments, int pos,
TaggedTemplateTag tag)
: Expression(pos, kCall), expression_(expression), arguments_(arguments) {
bit_field_ |= IsPossiblyEvalField::encode(false) |
......@@ -1697,14 +1694,14 @@ class Call final : public Expression {
: public BitField<bool, IsPossiblyEvalField::kNext, 1> {};
Expression* expression_;
ZoneList<Expression*>* arguments_;
ZonePtrList<Expression>* arguments_;
};
class CallNew final : public Expression {
public:
Expression* expression() const { return expression_; }
ZoneList<Expression*>* arguments() const { return arguments_; }
ZonePtrList<Expression>* arguments() const { return arguments_; }
bool only_last_arg_is_spread() {
return !arguments_->is_empty() && arguments_->last()->IsSpread();
......@@ -1713,14 +1710,13 @@ class CallNew final : public Expression {
private:
friend class AstNodeFactory;
CallNew(Expression* expression, ZoneList<Expression*>* arguments, int pos)
CallNew(Expression* expression, ZonePtrList<Expression>* arguments, int pos)
: Expression(pos, kCallNew),
expression_(expression),
arguments_(arguments) {
}
arguments_(arguments) {}
Expression* expression_;
ZoneList<Expression*>* arguments_;
ZonePtrList<Expression>* arguments_;
};
// The CallRuntime class does not represent any official JavaScript
......@@ -1729,7 +1725,7 @@ class CallNew final : public Expression {
// implemented in JavaScript.
class CallRuntime final : public Expression {
public:
ZoneList<Expression*>* arguments() const { return arguments_; }
ZonePtrList<Expression>* arguments() const { return arguments_; }
bool is_jsruntime() const { return function_ == nullptr; }
int context_index() const {
......@@ -1747,11 +1743,11 @@ class CallRuntime final : public Expression {
friend class AstNodeFactory;
CallRuntime(const Runtime::Function* function,
ZoneList<Expression*>* arguments, int pos)
ZonePtrList<Expression>* arguments, int pos)
: Expression(pos, kCallRuntime),
function_(function),
arguments_(arguments) {}
CallRuntime(int context_index, ZoneList<Expression*>* arguments, int pos)
CallRuntime(int context_index, ZonePtrList<Expression>* arguments, int pos)
: Expression(pos, kCallRuntime),
context_index_(context_index),
function_(nullptr),
......@@ -1759,7 +1755,7 @@ class CallRuntime final : public Expression {
int context_index_;
const Runtime::Function* function_;
ZoneList<Expression*>* arguments_;
ZonePtrList<Expression>* arguments_;
};
......@@ -2192,7 +2188,7 @@ class FunctionLiteral final : public Expression {
const AstConsString* raw_name() const { return raw_name_; }
void set_raw_name(const AstConsString* name) { raw_name_ = name; }
DeclarationScope* scope() const { return scope_; }
ZoneList<Statement*>* body() const { return body_; }
ZonePtrList<Statement>* body() const { return body_; }
void set_function_token_position(int pos) { function_token_position_ = pos; }
int function_token_position() const { return function_token_position_; }
int start_position() const;
......@@ -2312,7 +2308,7 @@ class FunctionLiteral final : public Expression {
FunctionLiteral(
Zone* zone, const AstRawString* name, AstValueFactory* ast_value_factory,
DeclarationScope* scope, ZoneList<Statement*>* body,
DeclarationScope* scope, ZonePtrList<Statement>* body,
int expected_property_count, int parameter_count, int function_length,
FunctionType function_type, ParameterFlag has_duplicate_parameters,
EagerCompileHint eager_compile_hint, int position, bool has_braces,
......@@ -2361,7 +2357,7 @@ class FunctionLiteral final : public Expression {
const AstConsString* raw_name_;
DeclarationScope* scope_;
ZoneList<Statement*>* body_;
ZonePtrList<Statement>* body_;
const AstConsString* raw_inferred_name_;
Handle<String> inferred_name_;
ProducedPreParsedScopeData* produced_preparsed_scope_data_;
......@@ -2409,15 +2405,16 @@ class ClassLiteralProperty final : public LiteralProperty {
class InitializeClassFieldsStatement final : public Statement {
public:
typedef ClassLiteralProperty Property;
ZoneList<Property*>* fields() const { return fields_; }
ZonePtrList<Property>* fields() const { return fields_; }
private:
friend class AstNodeFactory;
InitializeClassFieldsStatement(ZoneList<Property*>* fields, int pos)
InitializeClassFieldsStatement(ZonePtrList<Property>* fields, int pos)
: Statement(pos, kInitializeClassFieldsStatement), fields_(fields) {}
ZoneList<Property*>* fields_;
ZonePtrList<Property>* fields_;
};
class ClassLiteral final : public Expression {
......@@ -2428,7 +2425,7 @@ class ClassLiteral final : public Expression {
Variable* class_variable() const { return class_variable_; }
Expression* extends() const { return extends_; }
FunctionLiteral* constructor() const { return constructor_; }
ZoneList<Property*>* properties() const { return properties_; }
ZonePtrList<Property>* properties() const { return properties_; }
int start_position() const { return position(); }
int end_position() const { return end_position_; }
bool has_name_static_property() const {
......@@ -2457,7 +2454,7 @@ class ClassLiteral final : public Expression {
friend class AstNodeFactory;
ClassLiteral(Scope* scope, Variable* class_variable, Expression* extends,
FunctionLiteral* constructor, ZoneList<Property*>* properties,
FunctionLiteral* constructor, ZonePtrList<Property>* properties,
FunctionLiteral* static_fields_initializer,
FunctionLiteral* instance_fields_initializer_function,
int start_position, int end_position,
......@@ -2483,7 +2480,7 @@ class ClassLiteral final : public Expression {
Variable* class_variable_;
Expression* extends_;
FunctionLiteral* constructor_;
ZoneList<Property*>* properties_;
ZonePtrList<Property>* properties_;
FunctionLiteral* static_fields_initializer_;
FunctionLiteral* instance_fields_initializer_function_;
class HasNameStaticProperty
......@@ -2638,10 +2635,10 @@ class GetIterator final : public Expression {
// (defined at https://tc39.github.io/ecma262/#sec-gettemplateobject).
class GetTemplateObject final : public Expression {
public:
const ZoneList<const AstRawString*>* cooked_strings() const {
const ZonePtrList<const AstRawString>* cooked_strings() const {
return cooked_strings_;
}
const ZoneList<const AstRawString*>* raw_strings() const {
const ZonePtrList<const AstRawString>* raw_strings() const {
return raw_strings_;
}
......@@ -2650,34 +2647,35 @@ class GetTemplateObject final : public Expression {
private:
friend class AstNodeFactory;
GetTemplateObject(const ZoneList<const AstRawString*>* cooked_strings,
const ZoneList<const AstRawString*>* raw_strings, int pos)
GetTemplateObject(const ZonePtrList<const AstRawString>* cooked_strings,
const ZonePtrList<const AstRawString>* raw_strings, int pos)
: Expression(pos, kGetTemplateObject),
cooked_strings_(cooked_strings),
raw_strings_(raw_strings) {}
const ZoneList<const AstRawString*>* cooked_strings_;
const ZoneList<const AstRawString*>* raw_strings_;
const ZonePtrList<const AstRawString>* cooked_strings_;
const ZonePtrList<const AstRawString>* raw_strings_;
};
class TemplateLiteral final : public Expression {
public:
using StringList = ZoneList<const AstRawString*>;
using ExpressionList = ZoneList<Expression*>;
const StringList* string_parts() const { return string_parts_; }
const ExpressionList* substitutions() const { return substitutions_; }
const ZonePtrList<const AstRawString>* string_parts() const {
return string_parts_;
}
const ZonePtrList<Expression>* substitutions() const {
return substitutions_;
}
private:
friend class AstNodeFactory;
TemplateLiteral(const StringList* parts, const ExpressionList* substitutions,
int pos)
TemplateLiteral(const ZonePtrList<const AstRawString>* parts,
const ZonePtrList<Expression>* substitutions, int pos)
: Expression(pos, kTemplateLiteral),
string_parts_(parts),
substitutions_(substitutions) {}
const StringList* string_parts_;
const ExpressionList* substitutions_;
const ZonePtrList<const AstRawString>* string_parts_;
const ZonePtrList<Expression>* substitutions_;
};
// ----------------------------------------------------------------------------
......@@ -2694,7 +2692,7 @@ class AstVisitor BASE_EMBEDDED {
for (Declaration* decl : *declarations) Visit(decl);
}
void VisitStatements(ZoneList<Statement*>* statements) {
void VisitStatements(ZonePtrList<Statement>* statements) {
for (int i = 0; i < statements->length(); i++) {
Statement* stmt = statements->at(i);
Visit(stmt);
......@@ -2702,7 +2700,7 @@ class AstVisitor BASE_EMBEDDED {
}
}
void VisitExpressions(ZoneList<Expression*>* expressions) {
void VisitExpressions(ZonePtrList<Expression>* expressions) {
for (int i = 0; i < expressions->length(); i++) {
// The variable statement visiting code may pass null expressions
// to this code. Maybe this should be handled by introducing an
......@@ -2796,7 +2794,7 @@ class AstNodeFactory final BASE_EMBEDDED {
}
Block* NewBlock(int capacity, bool ignore_completion_value,
ZoneList<const AstRawString*>* labels = nullptr) {
ZonePtrList<const AstRawString>* labels = nullptr) {
return labels != nullptr
? new (zone_) LabeledBlock(zone_, labels, capacity,
ignore_completion_value)
......@@ -2805,7 +2803,7 @@ class AstNodeFactory final BASE_EMBEDDED {
}
#define STATEMENT_WITH_LABELS(NodeType) \
NodeType* New##NodeType(ZoneList<const AstRawString*>* labels, int pos) { \
NodeType* New##NodeType(ZonePtrList<const AstRawString>* labels, int pos) { \
return new (zone_) NodeType(labels, pos); \
}
STATEMENT_WITH_LABELS(DoWhileStatement)
......@@ -2813,13 +2811,13 @@ class AstNodeFactory final BASE_EMBEDDED {
STATEMENT_WITH_LABELS(ForStatement)
#undef STATEMENT_WITH_LABELS
SwitchStatement* NewSwitchStatement(ZoneList<const AstRawString*>* labels,
SwitchStatement* NewSwitchStatement(ZonePtrList<const AstRawString>* labels,
Expression* tag, int pos) {
return new (zone_) SwitchStatement(zone_, labels, tag, pos);
}
ForEachStatement* NewForEachStatement(ForEachStatement::VisitMode visit_mode,
ZoneList<const AstRawString*>* labels,
ZonePtrList<const AstRawString>* labels,
int pos) {
switch (visit_mode) {
case ForEachStatement::ENUMERATE: {
......@@ -2832,7 +2830,7 @@ class AstNodeFactory final BASE_EMBEDDED {
UNREACHABLE();
}
ForOfStatement* NewForOfStatement(ZoneList<const AstRawString*>* labels,
ForOfStatement* NewForOfStatement(ZonePtrList<const AstRawString>* labels,
int pos) {
return new (zone_) ForOfStatement(labels, pos);
}
......@@ -2923,7 +2921,7 @@ class AstNodeFactory final BASE_EMBEDDED {
}
CaseClause* NewCaseClause(Expression* label,
ZoneList<Statement*>* statements) {
ZonePtrList<Statement>* statements) {
return new (zone_) CaseClause(label, statements);
}
......@@ -2963,7 +2961,7 @@ class AstNodeFactory final BASE_EMBEDDED {
}
ObjectLiteral* NewObjectLiteral(
ZoneList<ObjectLiteral::Property*>* properties,
ZonePtrList<ObjectLiteral::Property>* properties,
uint32_t boilerplate_properties, int pos, bool has_rest_property) {
return new (zone_) ObjectLiteral(properties, boilerplate_properties, pos,
has_rest_property);
......@@ -2988,12 +2986,11 @@ class AstNodeFactory final BASE_EMBEDDED {
return new (zone_) RegExpLiteral(pattern, flags, pos);
}
ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values,
int pos) {
ArrayLiteral* NewArrayLiteral(ZonePtrList<Expression>* values, int pos) {
return new (zone_) ArrayLiteral(values, -1, pos);
}
ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values,
ArrayLiteral* NewArrayLiteral(ZonePtrList<Expression>* values,
int first_spread_index, int pos) {
return new (zone_) ArrayLiteral(values, first_spread_index, pos);
}
......@@ -3029,35 +3026,34 @@ class AstNodeFactory final BASE_EMBEDDED {
return new (zone_) ResolvedProperty(obj, property, pos);
}
Call* NewCall(Expression* expression, ZoneList<Expression*>* arguments,
Call* NewCall(Expression* expression, ZonePtrList<Expression>* arguments,
int pos, Call::PossiblyEval possibly_eval = Call::NOT_EVAL) {
return new (zone_) Call(expression, arguments, pos, possibly_eval);
}
Call* NewTaggedTemplate(Expression* expression,
ZoneList<Expression*>* arguments, int pos) {
ZonePtrList<Expression>* arguments, int pos) {
return new (zone_)
Call(expression, arguments, pos, Call::TaggedTemplateTag::kTrue);
}
CallNew* NewCallNew(Expression* expression,
ZoneList<Expression*>* arguments,
int pos) {
ZonePtrList<Expression>* arguments, int pos) {
return new (zone_) CallNew(expression, arguments, pos);
}
CallRuntime* NewCallRuntime(Runtime::FunctionId id,
ZoneList<Expression*>* arguments, int pos) {
ZonePtrList<Expression>* arguments, int pos) {
return new (zone_) CallRuntime(Runtime::FunctionForId(id), arguments, pos);
}
CallRuntime* NewCallRuntime(const Runtime::Function* function,
ZoneList<Expression*>* arguments, int pos) {
ZonePtrList<Expression>* arguments, int pos) {
return new (zone_) CallRuntime(function, arguments, pos);
}
CallRuntime* NewCallRuntime(int context_index,
ZoneList<Expression*>* arguments, int pos) {
ZonePtrList<Expression>* arguments, int pos) {
return new (zone_) CallRuntime(context_index, arguments, pos);
}
......@@ -3160,7 +3156,7 @@ class AstNodeFactory final BASE_EMBEDDED {
FunctionLiteral* NewFunctionLiteral(
const AstRawString* name, DeclarationScope* scope,
ZoneList<Statement*>* body, int expected_property_count,
ZonePtrList<Statement>* body, int expected_property_count,
int parameter_count, int function_length,
FunctionLiteral::ParameterFlag has_duplicate_parameters,
FunctionLiteral::FunctionType function_type,
......@@ -3178,7 +3174,7 @@ class AstNodeFactory final BASE_EMBEDDED {
// result of an eval (top-level or otherwise), or the result of calling
// the Function constructor.
FunctionLiteral* NewScriptOrEvalFunctionLiteral(DeclarationScope* scope,
ZoneList<Statement*>* body,
ZonePtrList<Statement>* body,
int expected_property_count,
int parameter_count) {
return new (zone_) FunctionLiteral(
......@@ -3200,7 +3196,7 @@ class AstNodeFactory final BASE_EMBEDDED {
ClassLiteral* NewClassLiteral(
Scope* scope, Variable* variable, Expression* extends,
FunctionLiteral* constructor,
ZoneList<ClassLiteral::Property*>* properties,
ZonePtrList<ClassLiteral::Property>* properties,
FunctionLiteral* static_fields_initializer,
FunctionLiteral* instance_fields_initializer_function, int start_position,
int end_position, bool has_name_static_property,
......@@ -3257,14 +3253,14 @@ class AstNodeFactory final BASE_EMBEDDED {
}
GetTemplateObject* NewGetTemplateObject(
const ZoneList<const AstRawString*>* cooked_strings,
const ZoneList<const AstRawString*>* raw_strings, int pos) {
const ZonePtrList<const AstRawString>* cooked_strings,
const ZonePtrList<const AstRawString>* raw_strings, int pos) {
return new (zone_) GetTemplateObject(cooked_strings, raw_strings, pos);
}
TemplateLiteral* NewTemplateLiteral(
const ZoneList<const AstRawString*>* string_parts,
const ZoneList<Expression*>* substitutions, int pos) {
const ZonePtrList<const AstRawString>* string_parts,
const ZonePtrList<Expression>* substitutions, int pos) {
return new (zone_) TemplateLiteral(string_parts, substitutions, pos);
}
......@@ -3273,7 +3269,7 @@ class AstNodeFactory final BASE_EMBEDDED {
}
InitializeClassFieldsStatement* NewInitializeClassFieldsStatement(
ZoneList<ClassLiteralProperty*>* args, int pos) {
ZonePtrList<ClassLiteral::Property>* args, int pos) {
return new (zone_) InitializeClassFieldsStatement(args, pos);
}
......
......@@ -498,16 +498,14 @@ void CallPrinter::VisitRewritableExpression(RewritableExpression* node) {
Find(node->expression());
}
void CallPrinter::FindStatements(ZoneList<Statement*>* statements) {
void CallPrinter::FindStatements(ZonePtrList<Statement>* statements) {
if (statements == nullptr) return;
for (int i = 0; i < statements->length(); i++) {
Find(statements->at(i));
}
}
void CallPrinter::FindArguments(ZoneList<Expression*>* arguments) {
void CallPrinter::FindArguments(ZonePtrList<Expression>* arguments) {
if (found_) return;
for (int i = 0; i < arguments->length(); i++) {
Find(arguments->at(i));
......@@ -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) {
for (int i = 0; i < labels->length(); i++) {
PrintLiteral(labels->at(i), false);
......@@ -748,8 +746,7 @@ void AstPrinter::PrintLiteralWithModeIndented(const char* info, Variable* var,
}
}
void AstPrinter::PrintLabelsIndented(ZoneList<const AstRawString*>* labels) {
void AstPrinter::PrintLabelsIndented(ZonePtrList<const AstRawString>* labels) {
if (labels == nullptr || labels->length() == 0) return;
PrintIndented("LABELS ");
PrintLabels(labels);
......@@ -809,15 +806,13 @@ void AstPrinter::PrintParameters(DeclarationScope* scope) {
}
}
void AstPrinter::PrintStatements(ZoneList<Statement*>* statements) {
void AstPrinter::PrintStatements(ZonePtrList<Statement>* statements) {
for (int i = 0; i < statements->length(); i++) {
Visit(statements->at(i));
}
}
void AstPrinter::PrintArguments(ZoneList<Expression*>* arguments) {
void AstPrinter::PrintArguments(ZonePtrList<Expression>* arguments) {
for (int i = 0; i < arguments->length(); i++) {
Visit(arguments->at(i));
}
......@@ -1040,7 +1035,7 @@ void AstPrinter::VisitInitializeClassFieldsStatement(
}
void AstPrinter::PrintClassProperties(
ZoneList<ClassLiteral::Property*>* properties) {
ZonePtrList<ClassLiteral::Property>* properties) {
for (int i = 0; i < properties->length(); i++) {
ClassLiteral::Property* property = properties->at(i);
const char* prop_kind = nullptr;
......@@ -1119,7 +1114,7 @@ void AstPrinter::VisitObjectLiteral(ObjectLiteral* node) {
}
void AstPrinter::PrintObjectProperties(
ZoneList<ObjectLiteral::Property*>* properties) {
ZonePtrList<ObjectLiteral::Property>* properties) {
for (int i = 0; i < properties->length(); i++) {
ObjectLiteral::Property* property = properties->at(i);
const char* prop_kind = nullptr;
......
......@@ -56,8 +56,8 @@ class CallPrinter final : public AstVisitor<CallPrinter> {
protected:
void PrintLiteral(Handle<Object> value, bool quote);
void PrintLiteral(const AstRawString* value, bool quote);
void FindStatements(ZoneList<Statement*>* statements);
void FindArguments(ZoneList<Expression*>* arguments);
void FindStatements(ZonePtrList<Statement>* statements);
void FindArguments(ZonePtrList<Expression>* arguments);
};
......@@ -88,17 +88,17 @@ class AstPrinter final : public AstVisitor<AstPrinter> {
void Init();
void PrintLabels(ZoneList<const AstRawString*>* labels);
void PrintLabels(ZonePtrList<const AstRawString>* labels);
void PrintLiteral(const AstRawString* value, bool quote);
void PrintLiteral(const AstConsString* value, bool quote);
void PrintLiteral(Literal* literal, bool quote);
void PrintIndented(const char* txt);
void PrintIndentedVisit(const char* s, AstNode* node);
void PrintStatements(ZoneList<Statement*>* statements);
void PrintStatements(ZonePtrList<Statement>* statements);
void PrintDeclarations(Declaration::List* declarations);
void PrintParameters(DeclarationScope* scope);
void PrintArguments(ZoneList<Expression*>* arguments);
void PrintArguments(ZonePtrList<Expression>* arguments);
void PrintCaseClause(CaseClause* clause);
void PrintLiteralIndented(const char* info, Literal* literal, bool quote);
void PrintLiteralIndented(const char* info, const AstRawString* value,
......@@ -107,9 +107,9 @@ class AstPrinter final : public AstVisitor<AstPrinter> {
bool quote);
void PrintLiteralWithModeIndented(const char* info, Variable* var,
const AstRawString* value);
void PrintLabelsIndented(ZoneList<const AstRawString*>* labels);
void PrintObjectProperties(ZoneList<ObjectLiteral::Property*>* properties);
void PrintClassProperties(ZoneList<ClassLiteral::Property*>* properties);
void PrintLabelsIndented(ZonePtrList<const AstRawString>* labels);
void PrintObjectProperties(ZonePtrList<ObjectLiteral::Property>* properties);
void PrintClassProperties(ZonePtrList<ClassLiteral::Property>* properties);
void inc_indent() { indent_++; }
void dec_indent() { indent_--; }
......
......@@ -1334,7 +1334,7 @@ Declaration* Scope::CheckConflictingVarDeclarations() {
}
Declaration* Scope::CheckLexDeclarationsConflictingWith(
const ZoneList<const AstRawString*>& names) {
const ZonePtrList<const AstRawString>& names) {
DCHECK(is_block_scope());
for (int i = 0; i < names.length(); ++i) {
Variable* var = LookupLocal(names.at(i));
......
......@@ -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
// scopes.
Declaration* CheckLexDeclarationsConflictingWith(
const ZoneList<const AstRawString*>& names);
const ZonePtrList<const AstRawString>& names);
// ---------------------------------------------------------------------------
// Scope-specific info.
......@@ -963,7 +963,7 @@ class V8_EXPORT_PRIVATE DeclarationScope : public Scope {
bool has_inferred_function_name_ : 1;
// Parameter list in source order.
ZoneList<Variable*> params_;
ZonePtrList<Variable> params_;
// Map of function names to lists of functions defined in sloppy blocks
SloppyBlockFunctionMap* sloppy_block_function_map_;
// Convenience variable.
......
......@@ -1327,7 +1327,7 @@ void BytecodeGenerator::VisitDeclarations(Declaration::List* declarations) {
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++) {
// Allocate an outer register allocations scope for the statement.
RegisterAllocationScope allocation_scope(this);
......@@ -1416,7 +1416,7 @@ void BytecodeGenerator::VisitWithStatement(WithStatement* stmt) {
void BytecodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) {
// We need this scope because we visit for register values. We have to
// 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,
clauses->length());
ControlScopeForBreakable scope(this, stmt, &switch_builder);
......@@ -2315,15 +2315,15 @@ void BytecodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
}
void BytecodeGenerator::BuildArrayLiteralElementsInsertion(
Register array, int first_spread_index, ZoneList<Expression*>* elements,
Register array, int first_spread_index, ZonePtrList<Expression>* elements,
bool skip_constants) {
DCHECK_LT(first_spread_index, elements->length());
Register index = register_allocator()->NewRegister();
int array_index = 0;
ZoneList<Expression*>::iterator iter = elements->begin();
ZoneList<Expression*>::iterator first_spread_or_end =
ZonePtrList<Expression>::iterator iter = elements->begin();
ZonePtrList<Expression>::iterator first_spread_or_end =
first_spread_index >= 0 ? elements->begin() + first_spread_index
: elements->end();
......@@ -3424,7 +3424,7 @@ void BytecodeGenerator::VisitResolvedProperty(ResolvedProperty* expr) {
UNREACHABLE();
}
void BytecodeGenerator::VisitArguments(ZoneList<Expression*>* args,
void BytecodeGenerator::VisitArguments(ZonePtrList<Expression>* args,
RegisterList* arg_regs) {
// Visit arguments.
for (int i = 0; i < static_cast<int>(args->length()); i++) {
......@@ -3595,7 +3595,7 @@ void BytecodeGenerator::VisitCall(Call* expr) {
void BytecodeGenerator::VisitCallSuper(Call* expr) {
RegisterAllocationScope register_scope(this);
SuperCallReference* super = expr->expression()->AsSuperCallReference();
ZoneList<Expression*>* args = expr->arguments();
ZonePtrList<Expression>* args = expr->arguments();
int first_spread_index = 0;
for (; first_spread_index < args->length(); first_spread_index++) {
......@@ -4309,8 +4309,8 @@ void BytecodeGenerator::VisitGetTemplateObject(GetTemplateObject* expr) {
}
void BytecodeGenerator::VisitTemplateLiteral(TemplateLiteral* expr) {
const TemplateLiteral::StringList& parts = *expr->string_parts();
const TemplateLiteral::ExpressionList& substitutions = *expr->substitutions();
const ZonePtrList<const AstRawString>& parts = *expr->string_parts();
const ZonePtrList<Expression>& substitutions = *expr->substitutions();
// Template strings with no substitutions are turned into StringLiterals.
DCHECK_GT(substitutions.length(), 0);
DCHECK_EQ(parts.length(), substitutions.length() + 1);
......
......@@ -43,7 +43,7 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
// Visiting function for declarations list and statements are overridden.
void VisitDeclarations(Declaration::List* declarations);
void VisitStatements(ZoneList<Statement*>* statments);
void VisitStatements(ZonePtrList<Statement>* statments);
private:
class ContextScope;
......@@ -100,7 +100,7 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
// Visit the arguments expressions in |args| and store them in |args_regs|,
// 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
// |opt_receiver_out| register will have the receiver stored to it
......@@ -179,7 +179,7 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
FeedbackSlot element_slot);
void BuildArrayLiteralElementsInsertion(Register array,
int first_spread_index,
ZoneList<Expression*>* elements,
ZonePtrList<Expression>* elements,
bool skip_constants);
void AllocateTopLevelRegisters();
......
......@@ -55,7 +55,7 @@ void Reparenter::VisitClassLiteral(ClassLiteral* class_literal) {
#if DEBUG
// The same goes for the rest of the class, but we do some
// 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) {
ClassLiteralProperty* prop = props->at(i);
// No need to visit the values, since all values are functions with
......
......@@ -553,7 +553,7 @@ class ParserBase {
Scope* scope;
BlockT init_block;
BlockT inner_block;
ZoneList<const AstRawString*> bound_names;
ZonePtrList<const AstRawString> bound_names;
};
struct ForInfo {
......@@ -563,7 +563,7 @@ class ParserBase {
mode(ForEachStatement::ENUMERATE),
position(kNoSourcePosition),
parsing_result() {}
ZoneList<const AstRawString*> bound_names;
ZonePtrList<const AstRawString> bound_names;
ForEachStatement::VisitMode mode;
int position;
DeclarationParsingResult parsing_result;
......@@ -1191,17 +1191,17 @@ class ParserBase {
BlockT ParseVariableDeclarations(VariableDeclarationContext var_context,
DeclarationParsingResult* parsing_result,
ZoneList<const AstRawString*>* names,
ZonePtrList<const AstRawString>* names,
bool* ok);
StatementT ParseAsyncFunctionDeclaration(ZoneList<const AstRawString*>* names,
bool default_export, bool* ok);
StatementT ParseAsyncFunctionDeclaration(
ZonePtrList<const AstRawString>* names, bool default_export, bool* ok);
StatementT ParseFunctionDeclaration(bool* ok);
StatementT ParseHoistableDeclaration(ZoneList<const AstRawString*>* names,
StatementT ParseHoistableDeclaration(ZonePtrList<const AstRawString>* names,
bool default_export, bool* ok);
StatementT ParseHoistableDeclaration(int pos, ParseFunctionFlags flags,
ZoneList<const AstRawString*>* names,
ZonePtrList<const AstRawString>* names,
bool default_export, bool* ok);
StatementT ParseClassDeclaration(ZoneList<const AstRawString*>* names,
StatementT ParseClassDeclaration(ZonePtrList<const AstRawString>* names,
bool default_export, bool* ok);
StatementT ParseNativeDeclaration(bool* ok);
......@@ -1232,22 +1232,22 @@ class ParserBase {
Token::Value end_token, bool may_abort,
bool* ok);
StatementT ParseStatementListItem(bool* ok);
StatementT ParseStatement(ZoneList<const AstRawString*>* labels, bool* ok) {
StatementT ParseStatement(ZonePtrList<const AstRawString>* labels, bool* ok) {
return ParseStatement(labels, kDisallowLabelledFunctionStatement, ok);
}
StatementT ParseStatement(ZoneList<const AstRawString*>* labels,
StatementT ParseStatement(ZonePtrList<const AstRawString>* labels,
AllowLabelledFunctionStatement allow_function,
bool* ok);
BlockT ParseBlock(ZoneList<const AstRawString*>* labels, bool* ok);
BlockT ParseBlock(ZonePtrList<const AstRawString>* labels, bool* ok);
// Parse a SubStatement in strict mode, or with an extra block scope in
// sloppy mode to handle
// ES#sec-functiondeclarations-in-ifstatement-statement-clauses
StatementT ParseScopedStatement(ZoneList<const AstRawString*>* labels,
StatementT ParseScopedStatement(ZonePtrList<const AstRawString>* labels,
bool* ok);
StatementT ParseVariableStatement(VariableDeclarationContext var_context,
ZoneList<const AstRawString*>* names,
ZonePtrList<const AstRawString>* names,
bool* ok);
// Magical syntax support.
......@@ -1258,43 +1258,45 @@ class ParserBase {
StatementT ParseDebuggerStatement(bool* ok);
StatementT ParseExpressionOrLabelledStatement(
ZoneList<const AstRawString*>* labels,
ZonePtrList<const AstRawString>* labels,
AllowLabelledFunctionStatement allow_function, bool* ok);
StatementT ParseIfStatement(ZoneList<const AstRawString*>* labels, bool* ok);
StatementT ParseIfStatement(ZonePtrList<const AstRawString>* labels,
bool* ok);
StatementT ParseContinueStatement(bool* ok);
StatementT ParseBreakStatement(ZoneList<const AstRawString*>* labels,
StatementT ParseBreakStatement(ZonePtrList<const AstRawString>* labels,
bool* ok);
StatementT ParseReturnStatement(bool* ok);
StatementT ParseWithStatement(ZoneList<const AstRawString*>* labels,
StatementT ParseWithStatement(ZonePtrList<const AstRawString>* labels,
bool* ok);
StatementT ParseDoWhileStatement(ZoneList<const AstRawString*>* labels,
StatementT ParseDoWhileStatement(ZonePtrList<const AstRawString>* labels,
bool* ok);
StatementT ParseWhileStatement(ZoneList<const AstRawString*>* labels,
StatementT ParseWhileStatement(ZonePtrList<const AstRawString>* labels,
bool* ok);
StatementT ParseThrowStatement(bool* ok);
StatementT ParseSwitchStatement(ZoneList<const AstRawString*>* labels,
StatementT ParseSwitchStatement(ZonePtrList<const AstRawString>* labels,
bool* ok);
StatementT ParseTryStatement(bool* ok);
StatementT ParseForStatement(ZoneList<const AstRawString*>* labels, bool* ok);
StatementT ParseForStatement(ZonePtrList<const AstRawString>* labels,
bool* ok);
StatementT ParseForEachStatementWithDeclarations(
int stmt_pos, ForInfo* for_info, ZoneList<const AstRawString*>* labels,
int stmt_pos, ForInfo* for_info, ZonePtrList<const AstRawString>* labels,
Scope* inner_block_scope, bool* ok);
StatementT ParseForEachStatementWithoutDeclarations(
int stmt_pos, ExpressionT expression, int lhs_beg_pos, int lhs_end_pos,
ForInfo* for_info, ZoneList<const AstRawString*>* labels, bool* ok);
ForInfo* for_info, ZonePtrList<const AstRawString>* labels, bool* ok);
// Parse a C-style for loop: 'for (<init>; <cond>; <next>) { ... }'
// "for (<init>;" is assumed to have been parser already.
ForStatementT ParseStandardForLoop(int stmt_pos,
ZoneList<const AstRawString*>* labels,
ZonePtrList<const AstRawString>* labels,
ExpressionT* cond, StatementT* next,
StatementT* body, bool* ok);
// Same as the above, but handles those cases where <init> is a
// lexical variable declaration.
StatementT ParseStandardForLoopWithLexicalDeclarations(
int stmt_pos, StatementT init, ForInfo* for_info,
ZoneList<const AstRawString*>* labels, bool* ok);
StatementT ParseForAwaitStatement(ZoneList<const AstRawString*>* labels,
ZonePtrList<const AstRawString>* labels, bool* ok);
StatementT ParseForAwaitStatement(ZonePtrList<const AstRawString>* labels,
bool* ok);
bool IsNextLetKeyword();
......@@ -3849,7 +3851,7 @@ template <typename Impl>
typename ParserBase<Impl>::BlockT ParserBase<Impl>::ParseVariableDeclarations(
VariableDeclarationContext var_context,
DeclarationParsingResult* parsing_result,
ZoneList<const AstRawString*>* names, bool* ok) {
ZonePtrList<const AstRawString>* names, bool* ok) {
// VariableDeclarations ::
// ('var' | 'const' | 'let') (Identifier ('=' AssignmentExpression)?)+[',']
//
......@@ -4007,7 +4009,7 @@ ParserBase<Impl>::ParseFunctionDeclaration(bool* ok) {
template <typename Impl>
typename ParserBase<Impl>::StatementT
ParserBase<Impl>::ParseHoistableDeclaration(
ZoneList<const AstRawString*>* names, bool default_export, bool* ok) {
ZonePtrList<const AstRawString>* names, bool default_export, bool* ok) {
Expect(Token::FUNCTION, CHECK_OK_CUSTOM(NullStatement));
int pos = position();
ParseFunctionFlags flags = ParseFunctionFlags::kIsNormal;
......@@ -4020,7 +4022,7 @@ ParserBase<Impl>::ParseHoistableDeclaration(
template <typename Impl>
typename ParserBase<Impl>::StatementT
ParserBase<Impl>::ParseHoistableDeclaration(
int pos, ParseFunctionFlags flags, ZoneList<const AstRawString*>* names,
int pos, ParseFunctionFlags flags, ZonePtrList<const AstRawString>* names,
bool default_export, bool* ok) {
// FunctionDeclaration ::
// 'function' Identifier '(' FormalParameters ')' '{' FunctionBody '}'
......@@ -4089,7 +4091,7 @@ ParserBase<Impl>::ParseHoistableDeclaration(
template <typename Impl>
typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseClassDeclaration(
ZoneList<const AstRawString*>* names, bool default_export, bool* ok) {
ZonePtrList<const AstRawString>* names, bool default_export, bool* ok) {
// ClassDeclaration ::
// 'class' Identifier ('extends' LeftHandExpression)? '{' ClassBody '}'
// 'class' ('extends' LeftHandExpression)? '{' ClassBody '}'
......@@ -4159,7 +4161,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseNativeDeclaration(
template <typename Impl>
typename ParserBase<Impl>::StatementT
ParserBase<Impl>::ParseAsyncFunctionDeclaration(
ZoneList<const AstRawString*>* names, bool default_export, bool* ok) {
ZonePtrList<const AstRawString>* names, bool default_export, bool* ok) {
// AsyncFunctionDeclaration ::
// async [no LineTerminator here] function BindingIdentifier[Await]
// ( FormalParameters[Await] ) { AsyncFunctionBody }
......@@ -4981,7 +4983,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseStatementListItem(
template <typename Impl>
typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseStatement(
ZoneList<const AstRawString*>* labels,
ZonePtrList<const AstRawString>* labels,
AllowLabelledFunctionStatement allow_function, bool* ok) {
// Statement ::
// Block
......@@ -5081,7 +5083,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseStatement(
template <typename Impl>
typename ParserBase<Impl>::BlockT ParserBase<Impl>::ParseBlock(
ZoneList<const AstRawString*>* labels, bool* ok) {
ZonePtrList<const AstRawString>* labels, bool* ok) {
// Block ::
// '{' StatementList '}'
......@@ -5113,7 +5115,7 @@ typename ParserBase<Impl>::BlockT ParserBase<Impl>::ParseBlock(
template <typename Impl>
typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseScopedStatement(
ZoneList<const AstRawString*>* labels, bool* ok) {
ZonePtrList<const AstRawString>* labels, bool* ok) {
if (is_strict(language_mode()) || peek() != Token::FUNCTION) {
return ParseStatement(labels, ok);
} else {
......@@ -5133,7 +5135,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseScopedStatement(
template <typename Impl>
typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseVariableStatement(
VariableDeclarationContext var_context,
ZoneList<const AstRawString*>* names, bool* ok) {
ZonePtrList<const AstRawString>* names, bool* ok) {
// VariableStatement ::
// VariableDeclarations ';'
......@@ -5174,7 +5176,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseDebuggerStatement(
template <typename Impl>
typename ParserBase<Impl>::StatementT
ParserBase<Impl>::ParseExpressionOrLabelledStatement(
ZoneList<const AstRawString*>* labels,
ZonePtrList<const AstRawString>* labels,
AllowLabelledFunctionStatement allow_function, bool* ok) {
// ExpressionStatement | LabelledStatement ::
// Expression ';'
......@@ -5245,7 +5247,7 @@ ParserBase<Impl>::ParseExpressionOrLabelledStatement(
template <typename Impl>
typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseIfStatement(
ZoneList<const AstRawString*>* labels, bool* ok) {
ZonePtrList<const AstRawString>* labels, bool* ok) {
// IfStatement ::
// 'if' '(' Expression ')' Statement ('else' Statement)?
......@@ -5315,7 +5317,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseContinueStatement(
template <typename Impl>
typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseBreakStatement(
ZoneList<const AstRawString*>* labels, bool* ok) {
ZonePtrList<const AstRawString>* labels, bool* ok) {
// BreakStatement ::
// 'break' Identifier? ';'
......@@ -5396,7 +5398,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseReturnStatement(
template <typename Impl>
typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseWithStatement(
ZoneList<const AstRawString*>* labels, bool* ok) {
ZonePtrList<const AstRawString>* labels, bool* ok) {
// WithStatement ::
// 'with' '(' Expression ')' Statement
......@@ -5426,7 +5428,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseWithStatement(
template <typename Impl>
typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseDoWhileStatement(
ZoneList<const AstRawString*>* labels, bool* ok) {
ZonePtrList<const AstRawString>* labels, bool* ok) {
// DoStatement ::
// 'do' Statement 'while' '(' Expression ')' ';'
......@@ -5461,7 +5463,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseDoWhileStatement(
template <typename Impl>
typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseWhileStatement(
ZoneList<const AstRawString*>* labels, bool* ok) {
ZonePtrList<const AstRawString>* labels, bool* ok) {
// WhileStatement ::
// 'while' '(' Expression ')' Statement
......@@ -5510,7 +5512,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseThrowStatement(
template <typename Impl>
typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseSwitchStatement(
ZoneList<const AstRawString*>* labels, bool* ok) {
ZonePtrList<const AstRawString>* labels, bool* ok) {
// SwitchStatement ::
// 'switch' '(' Expression ')' '{' CaseClause* '}'
// CaseClause ::
......@@ -5676,7 +5678,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseTryStatement(
template <typename Impl>
typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseForStatement(
ZoneList<const AstRawString*>* labels, bool* ok) {
ZonePtrList<const AstRawString>* labels, bool* ok) {
// Either a standard for loop
// for (<init>; <cond>; <next>) { ... }
// or a for-each loop
......@@ -5788,7 +5790,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseForStatement(
template <typename Impl>
typename ParserBase<Impl>::StatementT
ParserBase<Impl>::ParseForEachStatementWithDeclarations(
int stmt_pos, ForInfo* for_info, ZoneList<const AstRawString*>* labels,
int stmt_pos, ForInfo* for_info, ZonePtrList<const AstRawString>* labels,
Scope* inner_block_scope, bool* ok) {
// Just one declaration followed by in/of.
if (for_info->parsing_result.declarations.size() != 1) {
......@@ -5885,7 +5887,7 @@ template <typename Impl>
typename ParserBase<Impl>::StatementT
ParserBase<Impl>::ParseForEachStatementWithoutDeclarations(
int stmt_pos, ExpressionT expression, int lhs_beg_pos, int lhs_end_pos,
ForInfo* for_info, ZoneList<const AstRawString*>* labels, bool* ok) {
ForInfo* for_info, ZonePtrList<const AstRawString>* labels, bool* ok) {
// Initializer is reference followed by in/of.
if (!expression->IsArrayLiteral() && !expression->IsObjectLiteral()) {
expression = CheckAndRewriteReferenceExpression(
......@@ -5922,7 +5924,7 @@ template <typename Impl>
typename ParserBase<Impl>::StatementT
ParserBase<Impl>::ParseStandardForLoopWithLexicalDeclarations(
int stmt_pos, StatementT init, ForInfo* for_info,
ZoneList<const AstRawString*>* labels, bool* ok) {
ZonePtrList<const AstRawString>* labels, bool* ok) {
// The condition and the next statement of the for loop must be parsed
// in a new scope.
Scope* inner_scope = NewScope(BLOCK_SCOPE);
......@@ -5977,7 +5979,7 @@ ParserBase<Impl>::ParseStandardForLoopWithLexicalDeclarations(
template <typename Impl>
typename ParserBase<Impl>::ForStatementT ParserBase<Impl>::ParseStandardForLoop(
int stmt_pos, ZoneList<const AstRawString*>* labels, ExpressionT* cond,
int stmt_pos, ZonePtrList<const AstRawString>* labels, ExpressionT* cond,
StatementT* next, StatementT* body, bool* ok) {
ForStatementT loop = factory()->NewForStatement(labels, stmt_pos);
typename Types::Target target(this, loop);
......@@ -6016,7 +6018,7 @@ void ParserBase<Impl>::MarkLoopVariableAsAssigned(
template <typename Impl>
typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseForAwaitStatement(
ZoneList<const AstRawString*>* labels, bool* ok) {
ZonePtrList<const AstRawString>* labels, bool* ok) {
// for await '(' ForDeclaration of AssignmentExpression ')'
DCHECK(is_async_function());
......
......@@ -92,12 +92,12 @@ FunctionLiteral* Parser::DefaultConstructor(const AstRawString* name,
// Set start and end position to the same value
function_scope->set_start_position(pos);
function_scope->set_end_position(pos);
ZoneList<Statement*>* body = nullptr;
ZonePtrList<Statement>* body = nullptr;
{
FunctionState function_state(&function_state_, &scope_, function_scope);
body = new (zone()) ZoneList<Statement*>(call_super ? 2 : 1, zone());
body = new (zone()) ZonePtrList<Statement>(call_super ? 2 : 1, zone());
if (call_super) {
// Create a SuperCallReference and handle in BytecodeGenerator.
auto constructor_args_name = ast_value_factory()->empty_string();
......@@ -108,8 +108,8 @@ FunctionLiteral* Parser::DefaultConstructor(const AstRawString* name,
constructor_args_name, VariableMode::kTemporary, is_optional, is_rest,
&is_duplicate, ast_value_factory(), pos);
ZoneList<Expression*>* args =
new (zone()) ZoneList<Expression*>(1, zone());
ZonePtrList<Expression>* args =
new (zone()) ZonePtrList<Expression>(1, zone());
Spread* spread_args = factory()->NewSpread(
factory()->NewVariableProxy(constructor_args), pos, pos);
......@@ -283,7 +283,8 @@ Expression* Parser::BuildUnaryExpression(Expression* expression,
Expression* Parser::NewThrowError(Runtime::FunctionId id,
MessageTemplate::Template message,
const AstRawString* arg, int pos) {
ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(2, zone());
ZonePtrList<Expression>* args =
new (zone()) ZonePtrList<Expression>(2, zone());
args->Add(factory()->NewSmiLiteral(message, pos), zone());
args->Add(factory()->NewStringLiteral(arg, pos), zone());
CallRuntime* call_constructor = factory()->NewCallRuntime(id, args, pos);
......@@ -321,7 +322,7 @@ Expression* Parser::NewTargetExpression(int pos) {
Expression* Parser::ImportMetaExpression(int pos) {
return factory()->NewCallRuntime(
Runtime::kInlineGetImportMetaObject,
new (zone()) ZoneList<Expression*>(0, zone()), pos);
new (zone()) ZonePtrList<Expression>(0, zone()), pos);
}
Literal* Parser::ExpressionFromLiteral(Token::Value token, int pos) {
......@@ -350,7 +351,7 @@ Literal* Parser::ExpressionFromLiteral(Token::Value token, int pos) {
}
Expression* Parser::NewV8Intrinsic(const AstRawString* name,
ZoneList<Expression*>* args, int pos,
ZonePtrList<Expression>* args, int pos,
bool* ok) {
if (extension_ != nullptr) {
// The extension structures are only accessible while parsing the
......@@ -558,7 +559,8 @@ FunctionLiteral* Parser::DoParseProgram(Isolate* isolate, ParseInfo* info) {
scope->set_start_position(0);
FunctionState function_state(&function_state_, &scope_, scope);
ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(16, zone());
ZonePtrList<Statement>* body =
new (zone()) ZonePtrList<Statement>(16, zone());
bool ok = true;
int beg_pos = scanner()->location().beg_pos;
if (parsing_module_) {
......@@ -639,15 +641,14 @@ FunctionLiteral* Parser::DoParseProgram(Isolate* isolate, ParseInfo* info) {
return result;
}
ZoneList<const AstRawString*>* Parser::PrepareWrappedArguments(Isolate* isolate,
ParseInfo* info,
Zone* zone) {
ZonePtrList<const AstRawString>* Parser::PrepareWrappedArguments(
Isolate* isolate, ParseInfo* info, Zone* zone) {
DCHECK(parsing_on_main_thread_);
DCHECK_NOT_NULL(isolate);
Handle<FixedArray> arguments(info->script()->wrapped_arguments(), isolate);
int arguments_length = arguments->length();
ZoneList<const AstRawString*>* arguments_for_wrapped_function =
new (zone) ZoneList<const AstRawString*>(arguments_length, zone);
ZonePtrList<const AstRawString>* arguments_for_wrapped_function =
new (zone) ZonePtrList<const AstRawString>(arguments_length, zone);
for (int i = 0; i < arguments_length; i++) {
const AstRawString* argument_string = ast_value_factory()->GetString(
Handle<String>(String::cast(arguments->get(i)), isolate));
......@@ -657,7 +658,7 @@ ZoneList<const AstRawString*>* Parser::PrepareWrappedArguments(Isolate* isolate,
}
void Parser::ParseWrapped(Isolate* isolate, ParseInfo* info,
ZoneList<Statement*>* body,
ZonePtrList<Statement>* body,
DeclarationScope* outer_scope, Zone* zone, bool* ok) {
DCHECK_EQ(parsing_on_main_thread_, isolate != nullptr);
DCHECK(info->is_wrapped_as_function());
......@@ -670,7 +671,7 @@ void Parser::ParseWrapped(Isolate* isolate, ParseInfo* info,
const AstRawString* function_name = nullptr;
Scanner::Location location(0, 0);
ZoneList<const AstRawString*>* arguments_for_wrapped_function =
ZonePtrList<const AstRawString>* arguments_for_wrapped_function =
PrepareWrappedArguments(isolate, info, zone);
FunctionLiteral* function_literal = ParseFunctionLiteral(
......@@ -863,7 +864,7 @@ FunctionLiteral* Parser::DoParseFunction(Isolate* isolate, ParseInfo* info,
result = DefaultConstructor(raw_name, IsDerivedConstructor(kind),
info->start_position(), info->end_position());
} else {
ZoneList<const AstRawString*>* arguments_for_wrapped_function =
ZonePtrList<const AstRawString>* arguments_for_wrapped_function =
info->is_wrapped_as_function()
? PrepareWrappedArguments(isolate, info, zone())
: nullptr;
......@@ -915,8 +916,7 @@ Statement* Parser::ParseModuleItem(bool* ok) {
return ParseStatementListItem(ok);
}
void Parser::ParseModuleItemList(ZoneList<Statement*>* body, bool* ok) {
void Parser::ParseModuleItemList(ZonePtrList<Statement>* body, bool* ok) {
// ecma262/#prod-Module
// Module :
// ModuleBody?
......@@ -943,10 +943,9 @@ const AstRawString* Parser::ParseModuleSpecifier(bool* ok) {
return GetSymbol();
}
void Parser::ParseExportClause(ZoneList<const AstRawString*>* export_names,
void Parser::ParseExportClause(ZonePtrList<const AstRawString>* export_names,
ZoneList<Scanner::Location>* export_locations,
ZoneList<const AstRawString*>* local_names,
ZonePtrList<const AstRawString>* local_names,
Scanner::Location* reserved_loc, bool* ok) {
// ExportClause :
// '{' '}'
......@@ -994,9 +993,8 @@ void Parser::ParseExportClause(ZoneList<const AstRawString*>* export_names,
Expect(Token::RBRACE, CHECK_OK_VOID);
}
ZoneList<const Parser::NamedImport*>* Parser::ParseNamedImports(
int pos, bool* ok) {
ZonePtrList<const Parser::NamedImport>* Parser::ParseNamedImports(int pos,
bool* ok) {
// NamedImports :
// '{' '}'
// '{' ImportsList '}'
......@@ -1012,7 +1010,7 @@ ZoneList<const Parser::NamedImport*>* Parser::ParseNamedImports(
Expect(Token::LBRACE, CHECK_OK);
auto result = new (zone()) ZoneList<const NamedImport*>(1, zone());
auto result = new (zone()) ZonePtrList<const NamedImport>(1, zone());
while (peek() != Token::RBRACE) {
const AstRawString* import_name = ParseIdentifierName(CHECK_OK);
const AstRawString* local_name = import_name;
......@@ -1093,7 +1091,7 @@ void Parser::ParseImportDeclaration(bool* ok) {
// Parse NameSpaceImport or NamedImports if present.
const AstRawString* module_namespace_binding = nullptr;
Scanner::Location module_namespace_binding_loc;
const ZoneList<const NamedImport*>* named_imports = nullptr;
const ZonePtrList<const NamedImport>* named_imports = nullptr;
if (import_default_binding == nullptr || Check(Token::COMMA)) {
switch (peek()) {
case Token::MUL: {
......@@ -1167,7 +1165,7 @@ Statement* Parser::ParseExportDefault(bool* ok) {
Expect(Token::DEFAULT, CHECK_OK);
Scanner::Location default_loc = scanner()->location();
ZoneList<const AstRawString*> local_names(1, zone());
ZonePtrList<const AstRawString> local_names(1, zone());
Statement* result = nullptr;
switch (peek()) {
case Token::FUNCTION:
......@@ -1236,7 +1234,7 @@ Statement* Parser::ParseExportDeclaration(bool* ok) {
int pos = position();
Statement* result = nullptr;
ZoneList<const AstRawString*> names(1, zone());
ZonePtrList<const AstRawString> names(1, zone());
Scanner::Location loc = scanner()->peek_location();
switch (peek()) {
case Token::DEFAULT:
......@@ -1266,9 +1264,9 @@ Statement* Parser::ParseExportDeclaration(bool* ok) {
// encountered, and then throw a SyntaxError if we are in the
// non-FromClause case.
Scanner::Location reserved_loc = Scanner::Location::invalid();
ZoneList<const AstRawString*> export_names(1, zone());
ZonePtrList<const AstRawString> export_names(1, zone());
ZoneList<Scanner::Location> export_locations(1, zone());
ZoneList<const AstRawString*> original_names(1, zone());
ZonePtrList<const AstRawString> original_names(1, zone());
ParseExportClause(&export_names, &export_locations, &original_names,
&reserved_loc, CHECK_OK);
const AstRawString* module_specifier = nullptr;
......@@ -1410,7 +1408,7 @@ Variable* Parser::Declare(Declaration* declaration,
Block* Parser::BuildInitializationBlock(
DeclarationParsingResult* parsing_result,
ZoneList<const AstRawString*>* names, bool* ok) {
ZonePtrList<const AstRawString>* names, bool* ok) {
Block* result = factory()->NewBlock(1, true);
for (auto declaration : parsing_result->declarations) {
DeclareAndInitializeVariables(result, &(parsing_result->descriptor),
......@@ -1422,7 +1420,7 @@ Block* Parser::BuildInitializationBlock(
Statement* Parser::DeclareFunction(const AstRawString* variable_name,
FunctionLiteral* function, VariableMode mode,
int pos, bool is_sloppy_block_function,
ZoneList<const AstRawString*>* names,
ZonePtrList<const AstRawString>* names,
bool* ok) {
VariableProxy* proxy =
factory()->NewVariableProxy(variable_name, NORMAL_VARIABLE, pos);
......@@ -1443,7 +1441,7 @@ Statement* Parser::DeclareFunction(const AstRawString* variable_name,
Statement* Parser::DeclareClass(const AstRawString* variable_name,
Expression* value,
ZoneList<const AstRawString*>* names,
ZonePtrList<const AstRawString>* names,
int class_token_pos, int end_pos, bool* ok) {
Declaration* decl = DeclareVariable(variable_name, VariableMode::kLet,
class_token_pos, CHECK_OK);
......@@ -1475,8 +1473,8 @@ Statement* Parser::DeclareNative(const AstRawString* name, int pos, bool* ok) {
pos);
}
ZoneList<const AstRawString*>* Parser::DeclareLabel(
ZoneList<const AstRawString*>* labels, VariableProxy* var, bool* ok) {
ZonePtrList<const AstRawString>* Parser::DeclareLabel(
ZonePtrList<const AstRawString>* labels, VariableProxy* var, bool* ok) {
DCHECK(IsIdentifier(var));
const AstRawString* label = var->raw_name();
// TODO(1240780): We don't check for redeclaration of labels
......@@ -1490,7 +1488,7 @@ ZoneList<const AstRawString*>* Parser::DeclareLabel(
return nullptr;
}
if (labels == nullptr) {
labels = new (zone()) ZoneList<const AstRawString*>(1, zone());
labels = new (zone()) ZonePtrList<const AstRawString>(1, zone());
}
labels->Add(label, zone());
// Remove the "ghost" variable that turned out to be a label
......@@ -1500,7 +1498,7 @@ ZoneList<const AstRawString*>* Parser::DeclareLabel(
return labels;
}
bool Parser::ContainsLabel(ZoneList<const AstRawString*>* labels,
bool Parser::ContainsLabel(ZonePtrList<const AstRawString>* labels,
const AstRawString* label) {
DCHECK_NOT_NULL(label);
if (labels != nullptr) {
......@@ -1681,7 +1679,7 @@ Statement* Parser::RewriteTryStatement(Block* try_block, Block* catch_block,
}
void Parser::ParseAndRewriteGeneratorFunctionBody(int pos, FunctionKind kind,
ZoneList<Statement*>* body,
ZonePtrList<Statement>* body,
bool* ok) {
// For ES6 Generators, we just prepend the initial yield.
Expression* initial_yield = BuildInitialYield(pos, kind);
......@@ -1691,7 +1689,7 @@ void Parser::ParseAndRewriteGeneratorFunctionBody(int pos, FunctionKind kind,
}
void Parser::ParseAndRewriteAsyncGeneratorFunctionBody(
int pos, FunctionKind kind, ZoneList<Statement*>* body, bool* ok) {
int pos, FunctionKind kind, ZonePtrList<Statement>* body, bool* ok) {
// For ES2017 Async Generators, we produce:
//
// try {
......@@ -1733,8 +1731,8 @@ void Parser::ParseAndRewriteAsyncGeneratorFunctionBody(
// For AsyncGenerators, a top-level catch block will reject the Promise.
Scope* catch_scope = NewHiddenCatchScope();
ZoneList<Expression*>* reject_args =
new (zone()) ZoneList<Expression*>(2, zone());
ZonePtrList<Expression>* reject_args =
new (zone()) ZonePtrList<Expression>(2, zone());
reject_args->Add(factory()->NewVariableProxy(
function_state_->scope()->generator_object_var()),
zone());
......@@ -1753,8 +1751,8 @@ void Parser::ParseAndRewriteAsyncGeneratorFunctionBody(
try_block->statements()->Add(try_catch, zone());
Block* finally_block = factory()->NewBlock(1, false);
ZoneList<Expression*>* close_args =
new (zone()) ZoneList<Expression*>(1, zone());
ZonePtrList<Expression>* close_args =
new (zone()) ZonePtrList<Expression>(1, zone());
VariableProxy* call_proxy = factory()->NewVariableProxy(
function_state_->scope()->generator_object_var());
close_args->Add(call_proxy, zone());
......@@ -1790,8 +1788,8 @@ Expression* Parser::BuildIteratorNextResult(VariableProxy* iterator,
Variable* result, IteratorType type,
int pos) {
Expression* next_property = factory()->NewResolvedProperty(iterator, next);
ZoneList<Expression*>* next_arguments =
new (zone()) ZoneList<Expression*>(0, zone());
ZonePtrList<Expression>* next_arguments =
new (zone()) ZonePtrList<Expression>(0, zone());
Expression* next_call =
factory()->NewCall(next_property, next_arguments, kNoSourcePosition);
if (type == IteratorType::kAsync) {
......@@ -1803,16 +1801,16 @@ Expression* Parser::BuildIteratorNextResult(VariableProxy* iterator,
factory()->NewAssignment(Token::ASSIGN, result_proxy, next_call, pos);
// %_IsJSReceiver(...)
ZoneList<Expression*>* is_spec_object_args =
new (zone()) ZoneList<Expression*>(1, zone());
ZonePtrList<Expression>* is_spec_object_args =
new (zone()) ZonePtrList<Expression>(1, zone());
is_spec_object_args->Add(left, zone());
Expression* is_spec_object_call = factory()->NewCallRuntime(
Runtime::kInlineIsJSReceiver, is_spec_object_args, pos);
// %ThrowIteratorResultNotAnObject(result)
Expression* result_proxy_again = factory()->NewVariableProxy(result);
ZoneList<Expression*>* throw_arguments =
new (zone()) ZoneList<Expression*>(1, zone());
ZonePtrList<Expression>* throw_arguments =
new (zone()) ZonePtrList<Expression>(1, zone());
throw_arguments->Add(result_proxy_again, zone());
Expression* throw_call = factory()->NewCallRuntime(
Runtime::kThrowIteratorResultNotAnObject, throw_arguments, pos);
......@@ -2147,7 +2145,7 @@ Statement* Parser::DesugarLexicalBindingsInForStatement(
// }
DCHECK_GT(for_info.bound_names.length(), 0);
ZoneList<Variable*> temps(for_info.bound_names.length(), zone());
ZonePtrList<Variable> temps(for_info.bound_names.length(), zone());
Block* outer_block =
factory()->NewBlock(for_info.bound_names.length() + 4, false);
......@@ -2206,7 +2204,7 @@ Statement* Parser::DesugarLexicalBindingsInForStatement(
Block* ignore_completion_block =
factory()->NewBlock(for_info.bound_names.length() + 3, true);
ZoneList<Variable*> inner_vars(for_info.bound_names.length(), zone());
ZonePtrList<Variable> inner_vars(for_info.bound_names.length(), zone());
// For each let variable x:
// make statement: let/const x = temp_x.
for (int i = 0; i < for_info.bound_names.length(); i++) {
......@@ -2461,7 +2459,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
FunctionNameValidity function_name_validity, FunctionKind kind,
int function_token_pos, FunctionLiteral::FunctionType function_type,
LanguageMode language_mode,
ZoneList<const AstRawString*>* arguments_for_wrapped_function, bool* ok) {
ZonePtrList<const AstRawString>* arguments_for_wrapped_function, bool* ok) {
// Function ::
// '(' FormalParameterList? ')' '{' FunctionBody '}'
//
......@@ -2572,7 +2570,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
bool should_preparse =
(parse_lazily() && is_lazy_top_level_function) || should_preparse_inner;
ZoneList<Statement*>* body = nullptr;
ZonePtrList<Statement>* body = nullptr;
int expected_property_count = -1;
int suspend_count = -1;
int num_parameters = -1;
......@@ -2951,7 +2949,7 @@ Block* Parser::BuildRejectPromiseOnException(Block* inner_block) {
{
Expression* create_promise = factory()->NewCallRuntime(
Context::ASYNC_FUNCTION_PROMISE_CREATE_INDEX,
new (zone()) ZoneList<Expression*>(0, zone()), kNoSourcePosition);
new (zone()) ZonePtrList<Expression>(0, zone()), kNoSourcePosition);
Assignment* assign_promise = factory()->NewAssignment(
Token::ASSIGN, factory()->NewVariableProxy(PromiseVariable()),
create_promise, kNoSourcePosition);
......@@ -2979,7 +2977,8 @@ Block* Parser::BuildRejectPromiseOnException(Block* inner_block) {
// finally { %AsyncFunctionPromiseRelease(.promise, can_suspend) }
Block* finally_block;
{
ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(1, zone());
ZonePtrList<Expression>* args =
new (zone()) ZonePtrList<Expression>(1, zone());
args->Add(factory()->NewVariableProxy(PromiseVariable()), zone());
args->Add(factory()->NewBooleanLiteral(function_state_->CanSuspend(),
kNoSourcePosition),
......@@ -3000,7 +2999,8 @@ Block* Parser::BuildRejectPromiseOnException(Block* inner_block) {
Expression* Parser::BuildResolvePromise(Expression* value, int pos) {
// %ResolvePromise(.promise, value), .promise
ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(2, zone());
ZonePtrList<Expression>* args =
new (zone()) ZonePtrList<Expression>(2, zone());
args->Add(factory()->NewVariableProxy(PromiseVariable()), zone());
args->Add(value, zone());
Expression* call_runtime =
......@@ -3014,7 +3014,8 @@ Expression* Parser::BuildRejectPromise(Expression* value, int pos) {
// %promise_internal_reject(.promise, value, false), .promise
// Disables the additional debug event for the rejection since a debug event
// already happened for the exception that got us here.
ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(3, zone());
ZonePtrList<Expression>* args =
new (zone()) ZonePtrList<Expression>(3, zone());
args->Add(factory()->NewVariableProxy(PromiseVariable()), zone());
args->Add(value, zone());
args->Add(factory()->NewBooleanLiteral(false, pos), zone());
......@@ -3048,13 +3049,13 @@ Expression* Parser::BuildInitialYield(int pos, FunctionKind kind) {
Suspend::kOnExceptionThrow);
}
ZoneList<Statement*>* Parser::ParseFunction(
ZonePtrList<Statement>* Parser::ParseFunction(
const AstRawString* function_name, int pos, FunctionKind kind,
FunctionLiteral::FunctionType function_type,
DeclarationScope* function_scope, int* num_parameters, int* function_length,
bool* has_duplicate_parameters, int* expected_property_count,
int* suspend_count,
ZoneList<const AstRawString*>* arguments_for_wrapped_function, bool* ok) {
ZonePtrList<const AstRawString>* arguments_for_wrapped_function, bool* ok) {
ParsingModeScope mode(this, allow_lazy_ ? PARSE_LAZILY : PARSE_EAGERLY);
FunctionState function_state(&function_state_, &scope_, function_scope);
......@@ -3121,7 +3122,7 @@ ZoneList<Statement*>* Parser::ParseFunction(
*num_parameters = formals.num_parameters();
*function_length = formals.function_length;
ZoneList<Statement*>* body = new (zone()) ZoneList<Statement*>(8, zone());
ZonePtrList<Statement>* body = new (zone()) ZonePtrList<Statement>(8, zone());
ParseFunctionBody(body, function_name, pos, formals, kind, function_type, ok);
// Validate parameter names. We can do this only after parsing the function,
......@@ -3232,11 +3233,11 @@ void Parser::DeclareClassProperty(const AstRawString* class_name,
}
FunctionLiteral* Parser::CreateInitializerFunction(
DeclarationScope* scope, ZoneList<ClassLiteral::Property*>* fields) {
DeclarationScope* scope, ZonePtrList<ClassLiteral::Property>* fields) {
DCHECK_EQ(scope->function_kind(),
FunctionKind::kClassFieldsInitializerFunction);
// function() { .. class fields initializer .. }
ZoneList<Statement*>* statements = NewStatementList(1);
ZonePtrList<Statement>* statements = NewStatementList(1);
InitializeClassFieldsStatement* static_fields =
factory()->NewInitializeClassFieldsStatement(fields, kNoSourcePosition);
statements->Add(static_fields, zone());
......@@ -3494,9 +3495,9 @@ Expression* Parser::CloseTemplateLiteral(TemplateLiteralState* state, int start,
Expression* tag) {
TemplateLiteral* lit = *state;
int pos = lit->position();
const ZoneList<const AstRawString*>* cooked_strings = lit->cooked();
const ZoneList<const AstRawString*>* raw_strings = lit->raw();
const ZoneList<Expression*>* expressions = lit->expressions();
const ZonePtrList<const AstRawString>* cooked_strings = lit->cooked();
const ZonePtrList<const AstRawString>* raw_strings = lit->raw();
const ZonePtrList<Expression>* expressions = lit->expressions();
DCHECK_EQ(cooked_strings->length(), raw_strings->length());
DCHECK_EQ(cooked_strings->length(), expressions->length() + 1);
......@@ -3511,8 +3512,8 @@ Expression* Parser::CloseTemplateLiteral(TemplateLiteralState* state, int start,
factory()->NewGetTemplateObject(cooked_strings, raw_strings, pos);
// Call TagFn
ZoneList<Expression*>* call_args =
new (zone()) ZoneList<Expression*>(expressions->length() + 1, zone());
ZonePtrList<Expression>* call_args =
new (zone()) ZonePtrList<Expression>(expressions->length() + 1, zone());
call_args->Add(template_object, zone());
call_args->AddAll(*expressions, zone());
return factory()->NewTaggedTemplate(tag, call_args, pos);
......@@ -3521,7 +3522,7 @@ Expression* Parser::CloseTemplateLiteral(TemplateLiteralState* state, int start,
namespace {
bool OnlyLastArgIsSpread(ZoneList<Expression*>* args) {
bool OnlyLastArgIsSpread(ZonePtrList<Expression>* args) {
for (int i = 0; i < args->length() - 1; i++) {
if (args->at(i)->IsSpread()) {
return false;
......@@ -3533,7 +3534,7 @@ bool OnlyLastArgIsSpread(ZoneList<Expression*>* args) {
} // namespace
ArrayLiteral* Parser::ArrayLiteralFromListWithSpread(
ZoneList<Expression*>* list) {
ZonePtrList<Expression>* list) {
// If there's only a single spread argument, a fast path using CallWithSpread
// is taken.
DCHECK_LT(1, list->length());
......@@ -3549,14 +3550,15 @@ ArrayLiteral* Parser::ArrayLiteralFromListWithSpread(
}
Expression* Parser::SpreadCall(Expression* function,
ZoneList<Expression*>* args_list, int pos,
ZonePtrList<Expression>* args_list, int pos,
Call::PossiblyEval is_possibly_eval) {
// Handle this case in BytecodeGenerator.
if (OnlyLastArgIsSpread(args_list) || function->IsSuperCallReference()) {
return factory()->NewCall(function, args_list, pos);
}
ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(3, zone());
ZonePtrList<Expression>* args =
new (zone()) ZonePtrList<Expression>(3, zone());
if (function->IsProperty()) {
// Method calls
if (function->AsProperty()->IsSuperAccess()) {
......@@ -3584,12 +3586,13 @@ Expression* Parser::SpreadCall(Expression* function,
}
Expression* Parser::SpreadCallNew(Expression* function,
ZoneList<Expression*>* args_list, int pos) {
ZonePtrList<Expression>* args_list, int pos) {
if (OnlyLastArgIsSpread(args_list)) {
// Handle in BytecodeGenerator.
return factory()->NewCallNew(function, args_list, pos);
}
ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(2, zone());
ZonePtrList<Expression>* args =
new (zone()) ZonePtrList<Expression>(2, zone());
args->Add(function, zone());
args->Add(ArrayLiteralFromListWithSpread(args_list), zone());
......@@ -3617,7 +3620,7 @@ void Parser::SetAsmModule() {
scope()->AsDeclarationScope()->set_asm_module();
}
Expression* Parser::ExpressionListToExpression(ZoneList<Expression*>* args) {
Expression* Parser::ExpressionListToExpression(ZonePtrList<Expression>* args) {
Expression* expr = args->at(0);
for (int i = 1; i < args->length(); ++i) {
expr = factory()->NewBinaryOperation(Token::COMMA, expr, args->at(i),
......@@ -3627,8 +3630,9 @@ Expression* Parser::ExpressionListToExpression(ZoneList<Expression*>* args) {
}
// This method completes the desugaring of the body of async_function.
void Parser::RewriteAsyncFunctionBody(ZoneList<Statement*>* body, Block* block,
Expression* return_value, bool* ok) {
void Parser::RewriteAsyncFunctionBody(ZonePtrList<Statement>* body,
Block* block, Expression* return_value,
bool* ok) {
// function async_function() {
// .generator_object = %CreateJSGeneratorObject();
// BuildRejectPromiseOnException({
......@@ -3760,7 +3764,7 @@ Statement* Parser::CheckCallable(Variable* var, Expression* error, int pos) {
return validate_var;
}
void Parser::BuildIteratorClose(ZoneList<Statement*>* statements,
void Parser::BuildIteratorClose(ZonePtrList<Statement>* statements,
Variable* iterator, Variable* input,
Variable* var_output, IteratorType type) {
//
......@@ -3812,7 +3816,7 @@ void Parser::BuildIteratorClose(ZoneList<Statement*>* statements,
// output = %_Call(iteratorReturn, iterator, input);
Statement* call_return;
{
auto args = new (zone()) ZoneList<Expression*>(3, zone());
auto args = new (zone()) ZonePtrList<Expression>(3, zone());
args->Add(factory()->NewVariableProxy(var_return), zone());
args->Add(factory()->NewVariableProxy(iterator), zone());
args->Add(factory()->NewVariableProxy(input), zone());
......@@ -3834,7 +3838,7 @@ void Parser::BuildIteratorClose(ZoneList<Statement*>* statements,
{
Expression* is_receiver_call;
{
auto args = new (zone()) ZoneList<Expression*>(1, zone());
auto args = new (zone()) ZonePtrList<Expression>(1, zone());
args->Add(factory()->NewVariableProxy(var_output), zone());
is_receiver_call =
factory()->NewCallRuntime(Runtime::kInlineIsJSReceiver, args, nopos);
......@@ -3842,7 +3846,7 @@ void Parser::BuildIteratorClose(ZoneList<Statement*>* statements,
Statement* throw_call;
{
auto args = new (zone()) ZoneList<Expression*>(1, zone());
auto args = new (zone()) ZonePtrList<Expression>(1, zone());
args->Add(factory()->NewVariableProxy(var_output), zone());
Expression* call = factory()->NewCallRuntime(
Runtime::kThrowIteratorResultNotAnObject, args, nopos);
......@@ -3940,7 +3944,7 @@ void Parser::FinalizeIteratorUse(Variable* completion, Expression* condition,
// TryCatchStatementForReThrow below (which does not clear the pending
// message), rather than a TryCatchStatement.
{
auto args = new (zone()) ZoneList<Expression*>(1, zone());
auto args = new (zone()) ZonePtrList<Expression>(1, zone());
args->Add(factory()->NewVariableProxy(catch_scope->catch_variable()),
zone());
rethrow = factory()->NewExpressionStatement(
......@@ -3969,7 +3973,7 @@ void Parser::FinalizeIteratorUse(Variable* completion, Expression* condition,
target->statements()->Add(try_finally, zone());
}
void Parser::BuildIteratorCloseForCompletion(ZoneList<Statement*>* statements,
void Parser::BuildIteratorCloseForCompletion(ZonePtrList<Statement>* statements,
Variable* iterator,
Expression* completion,
IteratorType type) {
......@@ -4031,7 +4035,7 @@ void Parser::BuildIteratorCloseForCompletion(ZoneList<Statement*>* statements,
// try { %_Call(iteratorReturn, iterator) } catch (_) { }
Statement* try_call_return;
{
auto args = new (zone()) ZoneList<Expression*>(2, zone());
auto args = new (zone()) ZonePtrList<Expression>(2, zone());
args->Add(factory()->NewVariableProxy(var_return), zone());
args->Add(factory()->NewVariableProxy(iterator), zone());
......@@ -4061,7 +4065,7 @@ void Parser::BuildIteratorCloseForCompletion(ZoneList<Statement*>* statements,
Variable* var_output = NewTemporary(ast_value_factory()->empty_string());
Statement* call_return;
{
auto args = new (zone()) ZoneList<Expression*>(2, zone());
auto args = new (zone()) ZonePtrList<Expression>(2, zone());
args->Add(factory()->NewVariableProxy(var_return), zone());
args->Add(factory()->NewVariableProxy(iterator), zone());
Expression* call =
......@@ -4079,7 +4083,7 @@ void Parser::BuildIteratorCloseForCompletion(ZoneList<Statement*>* statements,
Expression* is_receiver_call;
{
auto args = new (zone()) ZoneList<Expression*>(1, zone());
auto args = new (zone()) ZonePtrList<Expression>(1, zone());
args->Add(factory()->NewVariableProxy(var_output), zone());
is_receiver_call =
factory()->NewCallRuntime(Runtime::kInlineIsJSReceiver, args, nopos);
......@@ -4087,7 +4091,7 @@ void Parser::BuildIteratorCloseForCompletion(ZoneList<Statement*>* statements,
Statement* throw_call;
{
auto args = new (zone()) ZoneList<Expression*>(1, zone());
auto args = new (zone()) ZonePtrList<Expression>(1, zone());
args->Add(factory()->NewVariableProxy(var_output), zone());
Expression* call = factory()->NewCallRuntime(
Runtime::kThrowIteratorResultNotAnObject, args, nopos);
......
......@@ -125,12 +125,12 @@ struct ParserTypes<Parser> {
typedef ClassLiteral::Property* ClassLiteralProperty;
typedef v8::internal::Suspend* Suspend;
typedef v8::internal::RewritableExpression* RewritableExpression;
typedef ZoneList<v8::internal::Expression*>* ExpressionList;
typedef ZoneList<ObjectLiteral::Property*>* ObjectPropertyList;
typedef ZoneList<ClassLiteral::Property*>* ClassPropertyList;
typedef ZonePtrList<v8::internal::Expression>* ExpressionList;
typedef ZonePtrList<ObjectLiteral::Property>* ObjectPropertyList;
typedef ZonePtrList<ClassLiteral::Property>* ClassPropertyList;
typedef ParserFormalParameters FormalParameters;
typedef v8::internal::Statement* Statement;
typedef ZoneList<v8::internal::Statement*>* StatementList;
typedef ZonePtrList<v8::internal::Statement>* StatementList;
typedef v8::internal::Block* Block;
typedef v8::internal::BreakableStatement* BreakableStatement;
typedef v8::internal::ForStatement* ForStatement;
......@@ -226,10 +226,10 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
// We manually construct the AST and scopes for a top-level function and the
// function wrapper.
void ParseWrapped(Isolate* isolate, ParseInfo* info,
ZoneList<Statement*>* body, DeclarationScope* scope,
ZonePtrList<Statement>* body, DeclarationScope* scope,
Zone* zone, bool* ok);
ZoneList<const AstRawString*>* PrepareWrappedArguments(Isolate* isolate,
ZonePtrList<const AstRawString>* PrepareWrappedArguments(Isolate* isolate,
ParseInfo* info,
Zone* zone);
......@@ -256,15 +256,15 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
return reusable_preparser_;
}
void ParseModuleItemList(ZoneList<Statement*>* body, bool* ok);
void ParseModuleItemList(ZonePtrList<Statement>* body, bool* ok);
Statement* ParseModuleItem(bool* ok);
const AstRawString* ParseModuleSpecifier(bool* ok);
void ParseImportDeclaration(bool* ok);
Statement* ParseExportDeclaration(bool* ok);
Statement* ParseExportDefault(bool* ok);
void ParseExportClause(ZoneList<const AstRawString*>* export_names,
void ParseExportClause(ZonePtrList<const AstRawString>* export_names,
ZoneList<Scanner::Location>* export_locations,
ZoneList<const AstRawString*>* local_names,
ZonePtrList<const AstRawString>* local_names,
Scanner::Location* reserved_loc, bool* ok);
struct NamedImport : public ZoneObject {
const AstRawString* import_name;
......@@ -276,13 +276,13 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
local_name(local_name),
location(location) {}
};
ZoneList<const NamedImport*>* ParseNamedImports(int pos, bool* ok);
ZonePtrList<const NamedImport>* ParseNamedImports(int pos, bool* ok);
Block* BuildInitializationBlock(DeclarationParsingResult* parsing_result,
ZoneList<const AstRawString*>* names,
ZonePtrList<const AstRawString>* names,
bool* ok);
ZoneList<const AstRawString*>* DeclareLabel(
ZoneList<const AstRawString*>* labels, VariableProxy* expr, bool* ok);
bool ContainsLabel(ZoneList<const AstRawString*>* labels,
ZonePtrList<const AstRawString>* DeclareLabel(
ZonePtrList<const AstRawString>* labels, VariableProxy* expr, bool* ok);
bool ContainsLabel(ZonePtrList<const AstRawString>* labels,
const AstRawString* label);
Expression* RewriteReturn(Expression* return_value, int pos);
Statement* RewriteSwitchStatement(SwitchStatement* switch_statement,
......@@ -295,10 +295,10 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
const SourceRange& finally_range,
const CatchInfo& catch_info, int pos);
void ParseAndRewriteGeneratorFunctionBody(int pos, FunctionKind kind,
ZoneList<Statement*>* body,
ZonePtrList<Statement>* body,
bool* ok);
void ParseAndRewriteAsyncGeneratorFunctionBody(int pos, FunctionKind kind,
ZoneList<Statement*>* body,
ZonePtrList<Statement>* body,
bool* ok);
void DeclareFunctionNameVar(const AstRawString* function_name,
FunctionLiteral::FunctionType function_type,
......@@ -307,14 +307,14 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
Statement* DeclareFunction(const AstRawString* variable_name,
FunctionLiteral* function, VariableMode mode,
int pos, bool is_sloppy_block_function,
ZoneList<const AstRawString*>* names, bool* ok);
ZonePtrList<const AstRawString>* names, bool* ok);
Variable* CreateSyntheticContextVariable(const AstRawString* synthetic_name,
bool* ok);
FunctionLiteral* CreateInitializerFunction(
DeclarationScope* scope, ZoneList<ClassLiteral::Property*>* fields);
DeclarationScope* scope, ZonePtrList<ClassLiteral::Property>* fields);
V8_INLINE Statement* DeclareClass(const AstRawString* variable_name,
Expression* value,
ZoneList<const AstRawString*>* names,
ZonePtrList<const AstRawString>* names,
int class_token_pos, int end_pos, bool* ok);
V8_INLINE void DeclareClassVariable(const AstRawString* name,
ClassInfo* class_info,
......@@ -342,7 +342,7 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
void DeclareAndInitializeVariables(
Block* block, const DeclarationDescriptor* declaration_descriptor,
const DeclarationParsingResult::Declaration* declaration,
ZoneList<const AstRawString*>* names, bool* ok);
ZonePtrList<const AstRawString>* names, bool* ok);
void RewriteDestructuringAssignment(RewritableExpression* expr);
Expression* RewriteDestructuringAssignment(Assignment* assignment);
......@@ -383,7 +383,8 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
FunctionNameValidity function_name_validity, FunctionKind kind,
int function_token_position, FunctionLiteral::FunctionType type,
LanguageMode language_mode,
ZoneList<const AstRawString*>* arguments_for_wrapped_function, bool* ok);
ZonePtrList<const AstRawString>* arguments_for_wrapped_function,
bool* ok);
ObjectLiteral* InitializeObjectLiteral(ObjectLiteral* object_literal) {
object_literal->CalculateEmitStore(main_zone());
......@@ -448,13 +449,14 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
const ParserFormalParameters& parameters, bool* ok);
Block* BuildRejectPromiseOnException(Block* block);
ZoneList<Statement*>* ParseFunction(
ZonePtrList<Statement>* ParseFunction(
const AstRawString* function_name, int pos, FunctionKind kind,
FunctionLiteral::FunctionType function_type,
DeclarationScope* function_scope, int* num_parameters,
int* function_length, bool* has_duplicate_parameters,
int* expected_property_count, int* suspend_count,
ZoneList<const AstRawString*>* arguments_for_wrapped_function, bool* ok);
ZonePtrList<const AstRawString>* arguments_for_wrapped_function,
bool* ok);
void ThrowPendingError(Isolate* isolate, Handle<Script> script);
......@@ -463,9 +465,9 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
TemplateLiteral(Zone* zone, int pos)
: cooked_(8, zone), raw_(8, zone), expressions_(8, zone), pos_(pos) {}
const ZoneList<const AstRawString*>* cooked() const { return &cooked_; }
const ZoneList<const AstRawString*>* raw() const { return &raw_; }
const ZoneList<Expression*>* expressions() const { return &expressions_; }
const ZonePtrList<const AstRawString>* cooked() const { return &cooked_; }
const ZonePtrList<const AstRawString>* raw() const { return &raw_; }
const ZonePtrList<Expression>* expressions() const { return &expressions_; }
int position() const { return pos_; }
void AddTemplateSpan(const AstRawString* cooked, const AstRawString* raw,
......@@ -481,9 +483,9 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
}
private:
ZoneList<const AstRawString*> cooked_;
ZoneList<const AstRawString*> raw_;
ZoneList<Expression*> expressions_;
ZonePtrList<const AstRawString> cooked_;
ZonePtrList<const AstRawString> raw_;
ZonePtrList<Expression> expressions_;
int pos_;
};
......@@ -503,10 +505,10 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
Expression* CloseTemplateLiteral(TemplateLiteralState* state, int start,
Expression* tag);
ArrayLiteral* ArrayLiteralFromListWithSpread(ZoneList<Expression*>* list);
Expression* SpreadCall(Expression* function, ZoneList<Expression*>* args,
ArrayLiteral* ArrayLiteralFromListWithSpread(ZonePtrList<Expression>* list);
Expression* SpreadCall(Expression* function, ZonePtrList<Expression>* args,
int pos, Call::PossiblyEval is_possibly_eval);
Expression* SpreadCallNew(Expression* function, ZoneList<Expression*>* args,
Expression* SpreadCallNew(Expression* function, ZonePtrList<Expression>* args,
int pos);
Expression* RewriteSuperCall(Expression* call_expression);
......@@ -542,15 +544,16 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
Statement* FinalizeForOfStatement(ForOfStatement* loop, Variable* completion,
IteratorType type, int pos);
void BuildIteratorClose(ZoneList<Statement*>* statements, Variable* iterator,
Variable* input, Variable* output, IteratorType type);
void BuildIteratorCloseForCompletion(ZoneList<Statement*>* statements,
void BuildIteratorClose(ZonePtrList<Statement>* statements,
Variable* iterator, Variable* input, Variable* output,
IteratorType type);
void BuildIteratorCloseForCompletion(ZonePtrList<Statement>* statements,
Variable* iterator,
Expression* completion,
IteratorType type);
Statement* CheckCallable(Variable* var, Expression* error, int pos);
V8_INLINE void RewriteAsyncFunctionBody(ZoneList<Statement*>* body,
V8_INLINE void RewriteAsyncFunctionBody(ZonePtrList<Statement>* body,
Block* block,
Expression* return_value, bool* ok);
......@@ -710,7 +713,8 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
// A shortcut for performing a ToString operation
V8_INLINE Expression* ToString(Expression* expr) {
if (expr->IsStringLiteral()) return expr;
ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(1, zone());
ZonePtrList<Expression>* args =
new (zone()) ZonePtrList<Expression>(1, zone());
args->Add(expr, zone());
return factory()->NewCallRuntime(Runtime::kInlineToString, args,
expr->position());
......@@ -796,10 +800,12 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
V8_INLINE static std::nullptr_t NullIdentifier() { return nullptr; }
V8_INLINE static std::nullptr_t NullExpression() { return nullptr; }
V8_INLINE static std::nullptr_t NullLiteralProperty() { return nullptr; }
V8_INLINE static ZoneList<Expression*>* NullExpressionList() {
V8_INLINE static ZonePtrList<Expression>* NullExpressionList() {
return nullptr;
}
V8_INLINE static ZonePtrList<Statement>* NullStatementList() {
return nullptr;
}
V8_INLINE static ZoneList<Statement*>* NullStatementList() { return nullptr; }
V8_INLINE static std::nullptr_t NullStatement() { return nullptr; }
template <typename T>
......@@ -857,23 +863,23 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
return factory()->NewStringLiteral(symbol, pos);
}
V8_INLINE ZoneList<Expression*>* NewExpressionList(int size) const {
return new (zone()) ZoneList<Expression*>(size, zone());
V8_INLINE ZonePtrList<Expression>* NewExpressionList(int size) const {
return new (zone()) ZonePtrList<Expression>(size, zone());
}
V8_INLINE ZoneList<ObjectLiteral::Property*>* NewObjectPropertyList(
V8_INLINE ZonePtrList<ObjectLiteral::Property>* NewObjectPropertyList(
int size) const {
return new (zone()) ZoneList<ObjectLiteral::Property*>(size, zone());
return new (zone()) ZonePtrList<ObjectLiteral::Property>(size, zone());
}
V8_INLINE ZoneList<ClassLiteral::Property*>* NewClassPropertyList(
V8_INLINE ZonePtrList<ClassLiteral::Property>* NewClassPropertyList(
int size) const {
return new (zone()) ZoneList<ClassLiteral::Property*>(size, zone());
return new (zone()) ZonePtrList<ClassLiteral::Property>(size, zone());
}
V8_INLINE ZoneList<Statement*>* NewStatementList(int size) const {
return new (zone()) ZoneList<Statement*>(size, zone());
V8_INLINE ZonePtrList<Statement>* NewStatementList(int size) const {
return new (zone()) ZonePtrList<Statement>(size, zone());
}
V8_INLINE Expression* NewV8Intrinsic(const AstRawString* name,
ZoneList<Expression*>* args, int pos,
ZonePtrList<Expression>* args, int pos,
bool* ok);
V8_INLINE Statement* NewThrowStatement(Expression* exception, int pos) {
......@@ -882,7 +888,7 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
}
V8_INLINE void AddParameterInitializationBlock(
const ParserFormalParameters& parameters, ZoneList<Statement*>* body,
const ParserFormalParameters& parameters, ZonePtrList<Statement>* body,
bool is_async, bool* ok) {
if (parameters.is_simple) return;
auto* init_block = BuildParameterInitializationBlock(parameters, ok);
......@@ -936,7 +942,7 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
Scanner::Location* duplicate_loc,
bool* ok);
Expression* ExpressionListToExpression(ZoneList<Expression*>* args);
Expression* ExpressionListToExpression(ZonePtrList<Expression>* args);
void SetFunctionNameFromPropertyName(LiteralProperty* property,
const AstRawString* name,
......
......@@ -29,7 +29,7 @@ class PatternRewriter final : public AstVisitor<PatternRewriter> {
Parser* parser, Block* block,
const DeclarationDescriptor* declaration_descriptor,
const Parser::DeclarationParsingResult::Declaration* declaration,
ZoneList<const AstRawString*>* names, bool* ok);
ZonePtrList<const AstRawString>* names, bool* ok);
static void RewriteDestructuringAssignment(Parser* parser,
RewritableExpression* to_rewrite,
......@@ -108,7 +108,7 @@ class PatternRewriter final : public AstVisitor<PatternRewriter> {
int value_beg_position_;
Block* block_;
const DeclarationDescriptor* descriptor_;
ZoneList<const AstRawString*>* names_;
ZonePtrList<const AstRawString>* names_;
Expression* current_value_;
int recursion_level_;
bool* ok_;
......@@ -119,7 +119,7 @@ class PatternRewriter final : public AstVisitor<PatternRewriter> {
void Parser::DeclareAndInitializeVariables(
Block* block, const DeclarationDescriptor* declaration_descriptor,
const DeclarationParsingResult::Declaration* declaration,
ZoneList<const AstRawString*>* names, bool* ok) {
ZonePtrList<const AstRawString>* names, bool* ok) {
PatternRewriter::DeclareAndInitializeVariables(
this, block, declaration_descriptor, declaration, names, ok);
}
......@@ -140,7 +140,7 @@ void PatternRewriter::DeclareAndInitializeVariables(
Parser* parser, Block* block,
const DeclarationDescriptor* declaration_descriptor,
const Parser::DeclarationParsingResult::Declaration* declaration,
ZoneList<const AstRawString*>* names, bool* ok) {
ZonePtrList<const AstRawString>* names, bool* ok) {
DCHECK(block->ignore_completion_value());
PatternRewriter rewriter(declaration_descriptor->scope, parser, BINDING);
......@@ -368,14 +368,14 @@ void PatternRewriter::VisitObjectLiteral(ObjectLiteral* pattern,
Variable** temp_var) {
auto temp = *temp_var = CreateTempVar(current_value_);
ZoneList<Expression*>* rest_runtime_callargs = nullptr;
ZonePtrList<Expression>* rest_runtime_callargs = nullptr;
if (pattern->has_rest_property()) {
// non_rest_properties_count = pattern->properties()->length - 1;
// args_length = 1 + non_rest_properties_count because we need to
// pass temp as well to the runtime function.
int args_length = pattern->properties()->length();
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());
}
......@@ -410,7 +410,7 @@ void PatternRewriter::VisitObjectLiteral(ObjectLiteral* pattern,
if (property->is_computed_name()) {
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());
auto to_name_key = CreateTempVar(factory()->NewCallRuntime(
Runtime::kToName, args, kNoSourcePosition));
......@@ -593,7 +593,7 @@ void PatternRewriter::VisitArrayLiteral(ArrayLiteral* node,
// let array = [];
Variable* array;
{
auto empty_exprs = new (zone()) ZoneList<Expression*>(0, zone());
auto empty_exprs = new (zone()) ZonePtrList<Expression>(0, zone());
array = CreateTempVar(
factory()->NewArrayLiteral(empty_exprs, kNoSourcePosition));
}
......
......@@ -268,7 +268,7 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
FunctionNameValidity function_name_validity, FunctionKind kind,
int function_token_pos, FunctionLiteral::FunctionType function_type,
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.
DCHECK_NULL(arguments_for_wrapped_function);
DCHECK_NE(FunctionLiteral::kWrapped, function_type);
......@@ -429,7 +429,7 @@ void PreParser::DeclareAndInitializeVariables(
PreParserStatement block,
const DeclarationDescriptor* declaration_descriptor,
const DeclarationParsingResult::Declaration* declaration,
ZoneList<const AstRawString*>* names, bool* ok) {
ZonePtrList<const AstRawString>* names, bool* ok) {
if (declaration->pattern.variables_ != nullptr) {
DCHECK(FLAG_lazy_inner_functions);
DCHECK(track_unresolved_variables_);
......
......@@ -94,7 +94,7 @@ class PreParserExpression {
static PreParserExpression Null() { return PreParserExpression(); }
static PreParserExpression Default(
ZoneList<VariableProxy*>* variables = nullptr) {
ZonePtrList<VariableProxy>* variables = nullptr) {
return PreParserExpression(TypeField::encode(kExpression), variables);
}
......@@ -133,7 +133,7 @@ class PreParserExpression {
return PreParserExpression(TypeField::encode(kExpression));
}
static PreParserExpression Assignment(ZoneList<VariableProxy*>* variables) {
static PreParserExpression Assignment(ZonePtrList<VariableProxy>* variables) {
return PreParserExpression(TypeField::encode(kExpression) |
ExpressionTypeField::encode(kAssignment),
variables);
......@@ -144,12 +144,13 @@ class PreParserExpression {
}
static PreParserExpression ObjectLiteral(
ZoneList<VariableProxy*>* variables) {
ZonePtrList<VariableProxy>* variables) {
return PreParserExpression(TypeField::encode(kObjectLiteralExpression),
variables);
}
static PreParserExpression ArrayLiteral(ZoneList<VariableProxy*>* variables) {
static PreParserExpression ArrayLiteral(
ZonePtrList<VariableProxy>* variables) {
return PreParserExpression(TypeField::encode(kArrayLiteralExpression),
variables);
}
......@@ -168,7 +169,7 @@ class PreParserExpression {
IsUseAsmField::encode(true));
}
static PreParserExpression This(ZoneList<VariableProxy*>* variables) {
static PreParserExpression This(ZonePtrList<VariableProxy>* variables) {
return PreParserExpression(TypeField::encode(kExpression) |
ExpressionTypeField::encode(kThisExpression),
variables);
......@@ -371,7 +372,7 @@ class PreParserExpression {
};
explicit PreParserExpression(uint32_t expression_code,
ZoneList<VariableProxy*>* variables = nullptr)
ZonePtrList<VariableProxy>* variables = nullptr)
: code_(expression_code), variables_(variables) {}
void AddVariable(VariableProxy* variable, Zone* zone) {
......@@ -379,7 +380,7 @@ class PreParserExpression {
return;
}
if (variables_ == nullptr) {
variables_ = new (zone) ZoneList<VariableProxy*>(1, zone);
variables_ = new (zone) ZonePtrList<VariableProxy>(1, zone);
}
variables_->Add(variable, zone);
}
......@@ -406,7 +407,7 @@ class PreParserExpression {
uint32_t code_;
// If the PreParser is used in the variable tracking mode, PreParserExpression
// accumulates variables in that expression.
ZoneList<VariableProxy*>* variables_;
ZonePtrList<VariableProxy>* variables_;
friend class PreParser;
friend class PreParserFactory;
......@@ -433,7 +434,7 @@ class PreParserList {
private:
explicit PreParserList(int n) : length_(n), variables_(nullptr) {}
int length_;
ZoneList<VariableProxy*>* variables_;
ZonePtrList<VariableProxy>* variables_;
friend class PreParser;
friend class PreParserFactory;
......@@ -446,7 +447,7 @@ inline void PreParserList<PreParserExpression>::Add(
DCHECK(FLAG_lazy_inner_functions);
DCHECK_NOT_NULL(zone);
if (variables_ == nullptr) {
variables_ = new (zone) ZoneList<VariableProxy*>(1, zone);
variables_ = new (zone) ZonePtrList<VariableProxy>(1, zone);
}
for (auto identifier : (*expression.variables_)) {
variables_->Add(identifier, zone);
......@@ -743,8 +744,9 @@ class PreParserFactory {
return PreParserStatement::Default();
}
PreParserStatement NewBlock(int capacity, bool ignore_completion_value,
ZoneList<const AstRawString*>* labels = nullptr) {
PreParserStatement NewBlock(
int capacity, bool ignore_completion_value,
ZonePtrList<const AstRawString>* labels = nullptr) {
return PreParserStatement::Default();
}
......@@ -784,17 +786,17 @@ class PreParserFactory {
return PreParserStatement::Default();
}
PreParserStatement NewDoWhileStatement(ZoneList<const AstRawString*>* labels,
int pos) {
PreParserStatement NewDoWhileStatement(
ZonePtrList<const AstRawString>* labels, int pos) {
return PreParserStatement::Default();
}
PreParserStatement NewWhileStatement(ZoneList<const AstRawString*>* labels,
PreParserStatement NewWhileStatement(ZonePtrList<const AstRawString>* labels,
int pos) {
return PreParserStatement::Default();
}
PreParserStatement NewSwitchStatement(ZoneList<const AstRawString*>* labels,
PreParserStatement NewSwitchStatement(ZonePtrList<const AstRawString>* labels,
const PreParserExpression& tag,
int pos) {
return PreParserStatement::Default();
......@@ -805,18 +807,18 @@ class PreParserFactory {
return PreParserStatement::Default();
}
PreParserStatement NewForStatement(ZoneList<const AstRawString*>* labels,
PreParserStatement NewForStatement(ZonePtrList<const AstRawString>* labels,
int pos) {
return PreParserStatement::Default();
}
PreParserStatement NewForEachStatement(ForEachStatement::VisitMode visit_mode,
ZoneList<const AstRawString*>* labels,
int pos) {
PreParserStatement NewForEachStatement(
ForEachStatement::VisitMode visit_mode,
ZonePtrList<const AstRawString>* labels, int pos) {
return PreParserStatement::Default();
}
PreParserStatement NewForOfStatement(ZoneList<const AstRawString*>* labels,
PreParserStatement NewForOfStatement(ZonePtrList<const AstRawString>* labels,
int pos) {
return PreParserStatement::Default();
}
......@@ -842,12 +844,12 @@ class PreParserFactory {
struct PreParserFormalParameters : FormalParametersBase {
struct Parameter : public ZoneObject {
Parameter(ZoneList<VariableProxy*>* variables, bool is_rest)
Parameter(ZonePtrList<VariableProxy>* variables, bool is_rest)
: variables_(variables), is_rest(is_rest) {}
Parameter** next() { return &next_parameter; }
Parameter* const* next() const { return &next_parameter; }
ZoneList<VariableProxy*>* variables_;
ZonePtrList<VariableProxy>* variables_;
Parameter* next_parameter = nullptr;
bool is_rest : 1;
};
......@@ -1013,7 +1015,8 @@ class PreParser : public ParserBase<PreParser> {
FunctionNameValidity function_name_validity, FunctionKind kind,
int function_token_pos, FunctionLiteral::FunctionType function_type,
LanguageMode language_mode,
ZoneList<const AstRawString*>* arguments_for_wrapped_function, bool* ok);
ZonePtrList<const AstRawString>* arguments_for_wrapped_function,
bool* ok);
PreParserExpression InitializeObjectLiteral(PreParserExpression literal) {
return literal;
......@@ -1065,10 +1068,10 @@ class PreParser : public ParserBase<PreParser> {
PreParserStatement block,
const DeclarationDescriptor* declaration_descriptor,
const DeclarationParsingResult::Declaration* declaration,
ZoneList<const AstRawString*>* names, bool* ok);
ZonePtrList<const AstRawString>* names, bool* ok);
V8_INLINE ZoneList<const AstRawString*>* DeclareLabel(
ZoneList<const AstRawString*>* labels, const PreParserExpression& expr,
V8_INLINE ZonePtrList<const AstRawString>* DeclareLabel(
ZonePtrList<const AstRawString>* labels, const PreParserExpression& expr,
bool* ok) {
DCHECK(!parsing_module_ || !expr.AsIdentifier().IsAwait());
DCHECK(IsIdentifier(expr));
......@@ -1076,7 +1079,7 @@ class PreParser : public ParserBase<PreParser> {
}
// TODO(nikolaos): The preparser currently does not keep track of labels.
V8_INLINE bool ContainsLabel(ZoneList<const AstRawString*>* labels,
V8_INLINE bool ContainsLabel(ZonePtrList<const AstRawString>* labels,
const PreParserIdentifier& label) {
return false;
}
......@@ -1163,7 +1166,7 @@ class PreParser : public ParserBase<PreParser> {
DeclareFunction(const PreParserIdentifier& variable_name,
const PreParserExpression& function, VariableMode mode,
int pos, bool is_sloppy_block_function,
ZoneList<const AstRawString*>* names, bool* ok) {
ZonePtrList<const AstRawString>* names, bool* ok) {
DCHECK_NULL(names);
if (variable_name.string_ != nullptr) {
DCHECK(track_unresolved_variables_);
......@@ -1178,7 +1181,7 @@ class PreParser : public ParserBase<PreParser> {
V8_INLINE PreParserStatement DeclareClass(
const PreParserIdentifier& variable_name,
const PreParserExpression& value, ZoneList<const AstRawString*>* names,
const PreParserExpression& value, ZonePtrList<const AstRawString>* names,
int class_token_pos, int end_pos, bool* ok) {
// Preparser shouldn't be used in contexts where we need to track the names.
DCHECK_NULL(names);
......@@ -1381,7 +1384,7 @@ class PreParser : public ParserBase<PreParser> {
V8_INLINE PreParserStatement
BuildInitializationBlock(DeclarationParsingResult* parsing_result,
ZoneList<const AstRawString*>* names, bool* ok) {
ZonePtrList<const AstRawString>* names, bool* ok) {
for (auto declaration : parsing_result->declarations) {
DeclareAndInitializeVariables(PreParserStatement::Default(),
&(parsing_result->descriptor), &declaration,
......@@ -1548,13 +1551,13 @@ class PreParser : public ParserBase<PreParser> {
}
V8_INLINE PreParserExpression ThisExpression(int pos = kNoSourcePosition) {
ZoneList<VariableProxy*>* variables = nullptr;
ZonePtrList<VariableProxy>* variables = nullptr;
if (track_unresolved_variables_) {
VariableProxy* proxy = scope()->NewUnresolved(
factory()->ast_node_factory(), ast_value_factory()->this_string(),
pos, THIS_VARIABLE);
variables = new (zone()) ZoneList<VariableProxy*>(1, zone());
variables = new (zone()) ZonePtrList<VariableProxy>(1, zone());
variables->Add(proxy, zone());
}
return PreParserExpression::This(variables);
......
......@@ -43,7 +43,7 @@ class Processor final : public AstVisitor<Processor> {
InitializeAstVisitor(parser->stack_limit());
}
void Process(ZoneList<Statement*>* statements);
void Process(ZonePtrList<Statement>* statements);
bool result_assigned() const { return result_assigned_; }
Zone* zone() { return zone_; }
......@@ -121,8 +121,7 @@ Statement* Processor::AssignUndefinedBefore(Statement* s) {
return b;
}
void Processor::Process(ZoneList<Statement*>* statements) {
void Processor::Process(ZonePtrList<Statement>* statements) {
// 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
// to assign to .result. If we're not in a breakable scope, only the last
......@@ -283,7 +282,7 @@ void Processor::VisitSwitchStatement(SwitchStatement* node) {
DCHECK(breakable_ || !is_set_);
BreakableScope scope(this);
// 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) {
CaseClause* clause = clauses->at(i);
Process(clause->statements());
......@@ -381,7 +380,7 @@ bool Rewriter::Rewrite(ParseInfo* info) {
return true;
}
ZoneList<Statement*>* body = function->body();
ZonePtrList<Statement>* body = function->body();
DCHECK_IMPLIES(scope->is_module_scope(), !body->is_empty());
if (!body->is_empty()) {
Variable* result = scope->AsDeclarationScope()->NewTemporary(
......@@ -416,7 +415,7 @@ bool Rewriter::Rewrite(Parser* parser, DeclarationScope* closure_scope,
DCHECK_EQ(closure_scope, closure_scope->GetClosureScope());
DCHECK(block->scope() == nullptr ||
block->scope()->GetClosureScope() == closure_scope);
ZoneList<Statement*>* body = block->statements();
ZonePtrList<Statement>* body = block->statements();
VariableProxy* result = expr->result();
Variable* result_var = result->var();
......
......@@ -290,6 +290,11 @@ class ZoneList final {
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
// different configurations of a concrete splay tree (see splay-tree.h).
// 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