Skip to content

Commit b185ed4

Browse files
conradwCommit bot
authored andcommitted
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}
1 parent 359645f commit b185ed4

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/ast.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3676,9 +3676,9 @@ class AstNodeFactory final BASE_EMBEDDED {
36763676
// Handles use of temporary zones when parsing inner function bodies.
36773677
class BodyScope {
36783678
public:
3679-
BodyScope(AstNodeFactory* factory, Zone* temp_zone, bool can_use_temp_zone)
3679+
BodyScope(AstNodeFactory* factory, Zone* temp_zone, bool use_temp_zone)
36803680
: factory_(factory), prev_zone_(factory->local_zone_) {
3681-
if (can_use_temp_zone) {
3681+
if (use_temp_zone) {
36823682
factory->local_zone_ = temp_zone;
36833683
}
36843684
}

src/parser.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4224,7 +4224,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
42244224
// FunctionExpression; even without enclosing parentheses it might be
42254225
// immediately invoked.
42264226
// - The function literal shouldn't be hinted to eagerly compile.
4227-
bool can_use_temp_zone =
4227+
bool use_temp_zone =
42284228
FLAG_lazy && !allow_natives() && extension_ == NULL && allow_lazy() &&
42294229
function_type == FunctionLiteral::DECLARATION &&
42304230
eager_compile_hint != FunctionLiteral::kShouldEagerCompile;
@@ -4237,14 +4237,14 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
42374237
// parser-persistent zone (see parser_zone_ in AstNodeFactory).
42384238
{
42394239
Zone temp_zone;
4240-
AstNodeFactory::BodyScope(factory(), &temp_zone, can_use_temp_zone);
4240+
AstNodeFactory::BodyScope inner(factory(), &temp_zone, use_temp_zone);
42414241

42424242
body = ParseEagerFunctionBody(function_name, pos, formals, kind,
42434243
function_type, CHECK_OK);
42444244
}
42454245
materialized_literal_count = function_state.materialized_literal_count();
42464246
expected_property_count = function_state.expected_property_count();
4247-
if (can_use_temp_zone) {
4247+
if (use_temp_zone) {
42484248
// If the preconditions are correct the function body should never be
42494249
// accessed, but do this anyway for better behaviour if they're wrong.
42504250
body = NULL;

0 commit comments

Comments
 (0)