| Index: src/parser.cc
|
| diff --git a/src/parser.cc b/src/parser.cc
|
| index 903cb3bcd465b11ff7f149314b6354accf035607..7c51b694c88022d06b66416a9764c5e7badb56b7 100644
|
| --- a/src/parser.cc
|
| +++ b/src/parser.cc
|
| @@ -4521,6 +4521,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral(Handle<String> function_name,
|
| // The heuristics are:
|
| // - It must not have been prohibited by the caller to Parse (some callers
|
| // need a full AST).
|
| + // - The outer scope must be trivial (only global variables in scope).
|
| // - The function mustn't be a function expression with an open parenthesis
|
| // before; we consider that a hint that the function will be called
|
| // immediately, and it would be a waste of time to make it lazily
|
| @@ -4528,6 +4529,8 @@ FunctionLiteral* Parser::ParseFunctionLiteral(Handle<String> function_name,
|
| // These are all things we can know at this point, without looking at the
|
| // function itself.
|
| bool is_lazily_compiled = (mode() == PARSE_LAZILY &&
|
| + top_scope_->outer_scope()->is_global_scope() &&
|
| + top_scope_->HasTrivialOuterContext() &&
|
| !parenthesized_function_);
|
| parenthesized_function_ = false; // The bit was set for this function only.
|
|
|
|
|