Commit bcde4e27 authored by adamk's avatar adamk Committed by Commit bot

Propagate the "calls eval" bit from ScopeInfo to lazily-compiled arrow functions

This avoids generating different scopes on the two compilation passes, which
results in various delirious side-effects.

There's some cleanup to be done in lazy arrow function parsing, but I'd
rather do that in a separate patch, with this one targeted at fixing the
particular crash.

BUG=chromium:572589
LOG=n

Review URL: https://codereview.chromium.org/1575333004

Cr-Commit-Position: refs/heads/master@{#33311}
parent 5312bfb9
......@@ -1037,9 +1037,19 @@ FunctionLiteral* Parser::ParseLazy(Isolate* isolate, ParseInfo* info,
bool ok = true;
if (shared_info->is_arrow()) {
// TODO(adamk): We should construct this scope from the ScopeInfo.
Scope* scope =
NewScope(scope_, FUNCTION_SCOPE, FunctionKind::kArrowFunction);
// These two bits only need to be explicitly set because we're
// not passing the ScopeInfo to the Scope constructor.
// TODO(adamk): Remove these calls once the above NewScope call
// passes the ScopeInfo.
if (shared_info->scope_info()->CallsEval()) {
scope->RecordEvalCall();
}
SetLanguageMode(scope, shared_info->language_mode());
scope->set_start_position(shared_info->start_position());
ExpressionClassifier formals_classifier;
ParserFormalParameters formals(scope);
......
......@@ -945,6 +945,7 @@
'regress/regress-542100': [SKIP],
'regress/regress-544991': [SKIP],
'regress/regress-568765': [SKIP],
'regress/regress-572589': [SKIP],
'regress/regress-580': [SKIP],
'regress/regress-618': [SKIP],
'regress/regress-69': [SKIP],
......
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Flags: --allow-natives-syntax --no-lazy
// Flags: --harmony-destructuring-bind
"use strict";
eval();
var f = ({x}) => { };
%OptimizeFunctionOnNextCall(f);
assertThrows(f);
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