Fix temp_zone scoping when parsing inner function literals
BUG=v8:4392 LOG=Y Review URL: https://codereview.chromium.org/1354523003 Cr-Commit-Position: refs/heads/master@{#30792}
This commit is contained in:
parent
359645f481
commit
b185ed4061
@ -3676,9 +3676,9 @@ class AstNodeFactory final BASE_EMBEDDED {
|
|||||||
// Handles use of temporary zones when parsing inner function bodies.
|
// Handles use of temporary zones when parsing inner function bodies.
|
||||||
class BodyScope {
|
class BodyScope {
|
||||||
public:
|
public:
|
||||||
BodyScope(AstNodeFactory* factory, Zone* temp_zone, bool can_use_temp_zone)
|
BodyScope(AstNodeFactory* factory, Zone* temp_zone, bool use_temp_zone)
|
||||||
: factory_(factory), prev_zone_(factory->local_zone_) {
|
: factory_(factory), prev_zone_(factory->local_zone_) {
|
||||||
if (can_use_temp_zone) {
|
if (use_temp_zone) {
|
||||||
factory->local_zone_ = temp_zone;
|
factory->local_zone_ = temp_zone;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4224,7 +4224,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
|
|||||||
// FunctionExpression; even without enclosing parentheses it might be
|
// FunctionExpression; even without enclosing parentheses it might be
|
||||||
// immediately invoked.
|
// immediately invoked.
|
||||||
// - The function literal shouldn't be hinted to eagerly compile.
|
// - The function literal shouldn't be hinted to eagerly compile.
|
||||||
bool can_use_temp_zone =
|
bool use_temp_zone =
|
||||||
FLAG_lazy && !allow_natives() && extension_ == NULL && allow_lazy() &&
|
FLAG_lazy && !allow_natives() && extension_ == NULL && allow_lazy() &&
|
||||||
function_type == FunctionLiteral::DECLARATION &&
|
function_type == FunctionLiteral::DECLARATION &&
|
||||||
eager_compile_hint != FunctionLiteral::kShouldEagerCompile;
|
eager_compile_hint != FunctionLiteral::kShouldEagerCompile;
|
||||||
@ -4237,14 +4237,14 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
|
|||||||
// parser-persistent zone (see parser_zone_ in AstNodeFactory).
|
// parser-persistent zone (see parser_zone_ in AstNodeFactory).
|
||||||
{
|
{
|
||||||
Zone temp_zone;
|
Zone temp_zone;
|
||||||
AstNodeFactory::BodyScope(factory(), &temp_zone, can_use_temp_zone);
|
AstNodeFactory::BodyScope inner(factory(), &temp_zone, use_temp_zone);
|
||||||
|
|
||||||
body = ParseEagerFunctionBody(function_name, pos, formals, kind,
|
body = ParseEagerFunctionBody(function_name, pos, formals, kind,
|
||||||
function_type, CHECK_OK);
|
function_type, CHECK_OK);
|
||||||
}
|
}
|
||||||
materialized_literal_count = function_state.materialized_literal_count();
|
materialized_literal_count = function_state.materialized_literal_count();
|
||||||
expected_property_count = function_state.expected_property_count();
|
expected_property_count = function_state.expected_property_count();
|
||||||
if (can_use_temp_zone) {
|
if (use_temp_zone) {
|
||||||
// If the preconditions are correct the function body should never be
|
// If the preconditions are correct the function body should never be
|
||||||
// accessed, but do this anyway for better behaviour if they're wrong.
|
// accessed, but do this anyway for better behaviour if they're wrong.
|
||||||
body = NULL;
|
body = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user