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

Unified Diff: src/ast.h

Issue 1304923004: When parsing inner functions, try to allocate in a temporary Zone (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Disable temp allocation of the FunctionExpression object until I can work out FunctionNameInferrer Created 5 years, 3 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 | « no previous file | src/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index 1a56b32c00e9d1ea96a6c31a58d82b135a133463..70f0a590f9b3997b5f7b005725c4e1e5d9389cc4 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -3278,13 +3278,14 @@ class AstNodeFactory final BASE_EMBEDDED {
public:
explicit AstNodeFactory(AstValueFactory* ast_value_factory)
: zone_(ast_value_factory->zone()),
titzer 2015/09/09 19:48:16 Can we rename this zone to be clearer as well?
conradw 2015/09/10 11:17:28 Done.
+ parser_zone_(ast_value_factory->zone()),
ast_value_factory_(ast_value_factory) {}
VariableDeclaration* NewVariableDeclaration(
VariableProxy* proxy, VariableMode mode, Scope* scope, int pos,
bool is_class_declaration = false, int declaration_group_start = -1) {
- return new (zone_)
- VariableDeclaration(zone_, proxy, mode, scope, pos,
+ return new (parser_zone_)
+ VariableDeclaration(parser_zone_, proxy, mode, scope, pos,
is_class_declaration, declaration_group_start);
}
@@ -3293,21 +3294,23 @@ class AstNodeFactory final BASE_EMBEDDED {
FunctionLiteral* fun,
Scope* scope,
int pos) {
- return new (zone_) FunctionDeclaration(zone_, proxy, mode, fun, scope, pos);
+ return new (parser_zone_)
+ FunctionDeclaration(parser_zone_, proxy, mode, fun, scope, pos);
}
ImportDeclaration* NewImportDeclaration(VariableProxy* proxy,
const AstRawString* import_name,
const AstRawString* module_specifier,
Scope* scope, int pos) {
- return new (zone_) ImportDeclaration(zone_, proxy, import_name,
- module_specifier, scope, pos);
+ return new (parser_zone_) ImportDeclaration(
+ parser_zone_, proxy, import_name, module_specifier, scope, pos);
}
ExportDeclaration* NewExportDeclaration(VariableProxy* proxy,
Scope* scope,
int pos) {
- return new (zone_) ExportDeclaration(zone_, proxy, scope, pos);
+ return new (parser_zone_)
+ ExportDeclaration(parser_zone_, proxy, scope, pos);
}
Block* NewBlock(ZoneList<const AstRawString*>* labels, int capacity,
@@ -3465,8 +3468,8 @@ class AstNodeFactory final BASE_EMBEDDED {
int literal_index,
bool is_strong,
int pos) {
- return new (zone_) RegExpLiteral(zone_, pattern, flags, literal_index,
- is_strong, pos);
+ return new (zone_)
+ RegExpLiteral(zone_, pattern, flags, literal_index, is_strong, pos);
}
ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values,
@@ -3487,7 +3490,8 @@ class AstNodeFactory final BASE_EMBEDDED {
VariableProxy* NewVariableProxy(Variable* var,
int start_position = RelocInfo::kNoPosition,
int end_position = RelocInfo::kNoPosition) {
- return new (zone_) VariableProxy(zone_, var, start_position, end_position);
+ return new (parser_zone_)
+ VariableProxy(parser_zone_, var, start_position, end_position);
}
VariableProxy* NewVariableProxy(const AstRawString* name,
@@ -3495,8 +3499,8 @@ class AstNodeFactory final BASE_EMBEDDED {
int start_position = RelocInfo::kNoPosition,
int end_position = RelocInfo::kNoPosition) {
DCHECK_NOT_NULL(name);
- return new (zone_)
- VariableProxy(zone_, name, variable_kind, start_position, end_position);
+ return new (parser_zone_) VariableProxy(parser_zone_, name, variable_kind,
+ start_position, end_position);
}
Property* NewProperty(Expression* obj, Expression* key, int pos) {
@@ -3606,11 +3610,11 @@ class AstNodeFactory final BASE_EMBEDDED {
FunctionLiteral::IsFunctionFlag is_function,
FunctionLiteral::EagerCompileHint eager_compile_hint, FunctionKind kind,
int position) {
- return new (zone_) FunctionLiteral(
- zone_, name, ast_value_factory, scope, body, materialized_literal_count,
- expected_property_count, parameter_count, function_type,
- has_duplicate_parameters, is_function, eager_compile_hint, kind,
- position);
+ return new (parser_zone_) FunctionLiteral(
+ parser_zone_, name, ast_value_factory, scope, body,
+ materialized_literal_count, expected_property_count, parameter_count,
+ function_type, has_duplicate_parameters, is_function,
+ eager_compile_hint, kind, position);
}
ClassLiteral* NewClassLiteral(const AstRawString* name, Scope* scope,
@@ -3618,15 +3622,16 @@ class AstNodeFactory final BASE_EMBEDDED {
FunctionLiteral* constructor,
ZoneList<ObjectLiteral::Property*>* properties,
int start_position, int end_position) {
- return new (zone_)
- ClassLiteral(zone_, name, scope, proxy, extends, constructor,
+ return new (parser_zone_)
+ ClassLiteral(parser_zone_, name, scope, proxy, extends, constructor,
properties, start_position, end_position);
}
NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name,
v8::Extension* extension,
int pos) {
- return new (zone_) NativeFunctionLiteral(zone_, name, extension, pos);
+ return new (parser_zone_)
+ NativeFunctionLiteral(parser_zone_, name, extension, pos);
}
ThisFunction* NewThisFunction(int pos) {
@@ -3636,24 +3641,31 @@ class AstNodeFactory final BASE_EMBEDDED {
SuperPropertyReference* NewSuperPropertyReference(VariableProxy* this_var,
Expression* home_object,
int pos) {
- return new (zone_)
- SuperPropertyReference(zone_, this_var, home_object, pos);
+ return new (parser_zone_)
+ SuperPropertyReference(parser_zone_, this_var, home_object, pos);
}
SuperCallReference* NewSuperCallReference(VariableProxy* this_var,
VariableProxy* new_target_var,
VariableProxy* this_function_var,
int pos) {
- return new (zone_) SuperCallReference(zone_, this_var, new_target_var,
- this_function_var, pos);
+ return new (parser_zone_) SuperCallReference(
+ parser_zone_, this_var, new_target_var, this_function_var, pos);
}
EmptyParentheses* NewEmptyParentheses(int pos) {
return new (zone_) EmptyParentheses(zone_, pos);
}
+ Zone* zone() const { return zone_; }
+
+ void set_zone(Zone* temp_zone) { zone_ = temp_zone; }
+
private:
Zone* zone_;
+ // HeapObjects which need to persist until scope analysis must be allocated in
+ // the parser-level zone.
+ Zone* parser_zone_;
AstValueFactory* ast_value_factory_;
};
« no previous file with comments | « no previous file | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698