Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(623)

Unified Diff: src/ast/ast.h

Issue 2452403003: Changed statement ZoneList to a ZoneChunkList
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/asmjs/asm-wasm-builder.cc ('k') | src/ast/ast.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/ast.h
diff --git a/src/ast/ast.h b/src/ast/ast.h
index 81a98b641d74498d8a7c554b451a2a1c5f48325e..aca74ebfcbd132ad531281a7f1ecb8c173319f4c 100644
--- a/src/ast/ast.h
+++ b/src/ast/ast.h
@@ -19,6 +19,7 @@
#include "src/runtime/runtime.h"
#include "src/small-pointer-list.h"
#include "src/utils.h"
+#include "src/zone/zone-chunk-list.h"
namespace v8 {
namespace internal {
@@ -177,8 +178,7 @@ class AstProperties final BASE_EMBEDDED {
DEFINE_OPERATORS_FOR_FLAGS(AstProperties::Flags)
-
-class AstNode: public ZoneObject {
+class AstNode : public ZoneObject {
public:
#define DECLARE_TYPE_ENUM(type) k##type,
enum NodeType : uint8_t { AST_NODE_LIST(DECLARE_TYPE_ENUM) };
@@ -432,7 +432,7 @@ class BreakableStatement : public Statement {
class Block final : public BreakableStatement {
public:
- ZoneList<Statement*>* statements() { return &statements_; }
+ ZoneChunkList<Statement*>* statements() { return &statements_; }
bool ignore_completion_value() const {
return IgnoreCompletionField::decode(bit_field_);
}
@@ -441,8 +441,8 @@ class Block final : public BreakableStatement {
BailoutId DeclsId() const { return BailoutId(local_id(0)); }
bool IsJump() const {
- return !statements_.is_empty() && statements_.last()->IsJump()
- && labels() == NULL; // Good enough as an approximation...
+ return statements_.size() > 0 && statements_.back()->IsJump() &&
+ labels() == NULL; // Good enough as an approximation...
}
Scope* scope() const { return scope_; }
@@ -451,17 +451,17 @@ class Block final : public BreakableStatement {
private:
friend class AstNodeFactory;
- Block(Zone* zone, ZoneList<const AstRawString*>* labels, int capacity,
+ Block(Zone* zone, ZoneList<const AstRawString*>* labels,
bool ignore_completion_value, int pos)
: BreakableStatement(labels, TARGET_FOR_NAMED_ONLY, pos, kBlock),
- statements_(capacity, zone),
+ statements_(zone),
scope_(NULL) {
bit_field_ |= IgnoreCompletionField::encode(ignore_completion_value);
}
static int parent_num_ids() { return BreakableStatement::num_ids(); }
int local_id(int n) const { return base_id() + parent_num_ids() + n; }
- ZoneList<Statement*> statements_;
+ ZoneChunkList<Statement*> statements_;
Scope* scope_;
class IgnoreCompletionField
@@ -965,7 +965,7 @@ class CaseClause final : public Expression {
}
void set_label(Expression* e) { label_ = e; }
Label* body_target() { return &body_target_; }
- ZoneList<Statement*>* statements() const { return statements_; }
+ ZoneChunkList<Statement*>* statements() const { return statements_; }
static int num_ids() { return parent_num_ids() + 2; }
BailoutId EntryId() const { return BailoutId(local_id(0)); }
@@ -988,12 +988,12 @@ class CaseClause final : public Expression {
friend class AstNodeFactory;
static int parent_num_ids() { return Expression::num_ids(); }
- CaseClause(Expression* label, ZoneList<Statement*>* statements, int pos);
+ CaseClause(Expression* label, ZoneChunkList<Statement*>* statements, int pos);
int local_id(int n) const { return base_id() + parent_num_ids() + n; }
Expression* label_;
Label body_target_;
- ZoneList<Statement*>* statements_;
+ ZoneChunkList<Statement*>* statements_;
AstType* compare_type_;
FeedbackVectorSlot type_feedback_slot_;
};
@@ -1451,7 +1451,7 @@ class ObjectLiteral final : public MaterializedLiteral {
kDisableMementos = 1 << 2
};
- struct Accessors: public ZoneObject {
+ struct Accessors : public ZoneObject {
Accessors() : getter(NULL), setter(NULL), bailout_id(BailoutId::None()) {}
ObjectLiteralProperty* getter;
ObjectLiteralProperty* setter;
@@ -2576,7 +2576,7 @@ class FunctionLiteral final : public Expression {
const AstString* raw_name() const { return raw_name_; }
void set_raw_name(const AstString* name) { raw_name_ = name; }
DeclarationScope* scope() const { return scope_; }
- ZoneList<Statement*>* body() const { return body_; }
+ ZoneChunkList<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;
@@ -2708,9 +2708,10 @@ class FunctionLiteral final : public Expression {
FunctionLiteral(Zone* zone, const AstString* name,
AstValueFactory* ast_value_factory, DeclarationScope* scope,
- ZoneList<Statement*>* body, int materialized_literal_count,
- int expected_property_count, int parameter_count,
- int function_length, FunctionType function_type,
+ ZoneChunkList<Statement*>* body,
+ int materialized_literal_count, int expected_property_count,
+ int parameter_count, int function_length,
+ FunctionType function_type,
ParameterFlag has_duplicate_parameters,
EagerCompileHint eager_compile_hint, int position,
bool is_function)
@@ -2761,7 +2762,7 @@ class FunctionLiteral final : public Expression {
const AstString* raw_name_;
DeclarationScope* scope_;
- ZoneList<Statement*>* body_;
+ ZoneChunkList<Statement*>* body_;
const AstString* raw_inferred_name_;
Handle<String> inferred_name_;
AstProperties ast_properties_;
@@ -2964,11 +2965,10 @@ class AstVisitor BASE_EMBEDDED {
}
}
- void VisitStatements(ZoneList<Statement*>* statements) {
- for (int i = 0; i < statements->length(); i++) {
- Statement* stmt = statements->at(i);
- Visit(stmt);
- if (stmt->IsJump()) break;
+ void VisitStatements(ZoneChunkList<Statement*>* statements) {
+ for (Statement* statement : *statements) {
+ Visit(statement);
+ if (statement->IsJump()) break;
}
}
@@ -3132,10 +3132,9 @@ class AstNodeFactory final BASE_EMBEDDED {
return new (zone_) FunctionDeclaration(proxy, fun, scope, pos);
}
- Block* NewBlock(ZoneList<const AstRawString*>* labels, int capacity,
+ Block* NewBlock(ZoneList<const AstRawString*>* labels,
bool ignore_completion_value, int pos) {
- return new (zone_)
- Block(zone_, labels, capacity, ignore_completion_value, pos);
+ return new (zone_) Block(zone_, labels, ignore_completion_value, pos);
}
#define STATEMENT_WITH_LABELS(NodeType) \
@@ -3256,8 +3255,8 @@ class AstNodeFactory final BASE_EMBEDDED {
NewEmptyStatement(kNoSourcePosition), scope);
}
- CaseClause* NewCaseClause(
- Expression* label, ZoneList<Statement*>* statements, int pos) {
+ CaseClause* NewCaseClause(Expression* label,
+ ZoneChunkList<Statement*>* statements, int pos) {
return new (zone_) CaseClause(label, statements, pos);
}
@@ -3451,7 +3450,7 @@ class AstNodeFactory final BASE_EMBEDDED {
FunctionLiteral* NewFunctionLiteral(
const AstRawString* name, DeclarationScope* scope,
- ZoneList<Statement*>* body, int materialized_literal_count,
+ ZoneChunkList<Statement*>* body, int materialized_literal_count,
int expected_property_count, int parameter_count, int function_length,
FunctionLiteral::ParameterFlag has_duplicate_parameters,
FunctionLiteral::FunctionType function_type,
@@ -3467,7 +3466,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,
+ DeclarationScope* scope, ZoneChunkList<Statement*>* body,
int materialized_literal_count, int expected_property_count,
int parameter_count) {
return new (zone_) FunctionLiteral(
« no previous file with comments | « src/asmjs/asm-wasm-builder.cc ('k') | src/ast/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698